Skip to content

Commit 65916f5

Browse files
committed
---
yaml --- r: 160253 b: refs/heads/snap-stage3 c: 004db80 h: refs/heads/master i: 160251: 0045043 v: v3
1 parent 67244e7 commit 65916f5

File tree

7 files changed

+32
-19
lines changed

7 files changed

+32
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: bfaa7bcab3459907014c31d3bf980f65ccd14b08
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: dd5ce5ae2f254cc42763518909f6e7c486d9502a
4+
refs/heads/snap-stage3: 004db80afe08b28d79741c486ceb8398e6725829
55
refs/heads/try: 225de0d60f8ca8dcc62ab2fd8818ebbda4b58cfe
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/doc/reference.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,13 +1114,13 @@ Rust:
11141114
##### Unsafe functions
11151115

11161116
Unsafe functions are functions that are not safe in all contexts and/or for all
1117-
possible inputs. Such a function must be prefixed with the keyword `unsafe` and
1118-
can only be called from an `unsafe` block or another `unsafe` function.
1117+
possible inputs. Such a function must be prefixed with the keyword `unsafe`.
11191118

11201119
##### Unsafe blocks
11211120

1122-
A block of code can be prefixed with the `unsafe` keyword, to permit calling
1123-
`unsafe` functions or dereferencing raw pointers within a safe function.
1121+
A block of code can also be prefixed with the `unsafe` keyword, to permit
1122+
calling `unsafe` functions or dereferencing raw pointers within a safe
1123+
function.
11241124

11251125
When a programmer has sufficient conviction that a sequence of potentially
11261126
unsafe operations is actually safe, they can encapsulate that sequence (taken
@@ -1140,11 +1140,12 @@ represented with reference-counted pointers in safe code. By using `unsafe`
11401140
blocks to represent the reverse links as raw pointers, it can be implemented
11411141
with only boxes.
11421142

1143-
##### Behavior considered undefined
1143+
##### Behavior considered unsafe
11441144

1145-
The following is a list of behavior which is forbidden in all Rust code,
1146-
including within `unsafe` blocks and `unsafe` functions. Type checking provides
1147-
the guarantee that these issues are never caused by safe code.
1145+
This is a list of behavior which is forbidden in all Rust code. Type checking
1146+
provides the guarantee that these issues are never caused by safe code. An
1147+
`unsafe` block or function is responsible for never invoking this behaviour or
1148+
exposing an API making it possible for it to occur in safe code.
11481149

11491150
* Data races
11501151
* Dereferencing a null/dangling raw pointer

branches/snap-stage3/src/libcollections/slice.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ pub trait VectorVector<T> for Sized? {
121121
fn connect_vec(&self, sep: &T) -> Vec<T>;
122122
}
123123

124-
impl<T: Clone, V: AsSlice<T>> VectorVector<T> for [V] {
124+
impl<'a, T: Clone, V: AsSlice<T>> VectorVector<T> for [V] {
125125
fn concat_vec(&self) -> Vec<T> {
126126
let size = self.iter().fold(0u, |acc, v| acc + v.as_slice().len());
127127
let mut result = Vec::with_capacity(size);

branches/snap-stage3/src/libcollections/vec.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use core::cmp::max;
2020
use core::default::Default;
2121
use core::fmt;
2222
use core::kinds::marker::{ContravariantLifetime, InvariantType};
23+
use core::kinds::Sized;
2324
use core::mem;
2425
use core::num::{Int, UnsignedInt};
2526
use core::ops;
@@ -516,7 +517,7 @@ impl<T: PartialOrd> PartialOrd for Vec<T> {
516517
impl<T: Eq> Eq for Vec<T> {}
517518

518519
#[experimental]
519-
impl<T: PartialEq, V: AsSlice<T>> Equiv<V> for Vec<T> {
520+
impl<T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for Vec<T> {
520521
#[inline]
521522
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
522523
}
@@ -1181,7 +1182,7 @@ impl<T> AsSlice<T> for Vec<T> {
11811182
}
11821183
}
11831184

1184-
impl<T: Clone, V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
1185+
impl<T: Clone, Sized? V: AsSlice<T>> Add<V, Vec<T>> for Vec<T> {
11851186
#[inline]
11861187
fn add(&self, rhs: &V) -> Vec<T> {
11871188
let mut res = Vec::with_capacity(self.len() + rhs.as_slice().len());

branches/snap-stage3/src/libcore/slice.rs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,15 +1008,25 @@ impl<T: Clone> CloneSlicePrelude<T> for [T] {
10081008

10091009
/// Data that is viewable as a slice.
10101010
#[unstable = "may merge with other traits"]
1011-
pub trait AsSlice<T> {
1011+
pub trait AsSlice<T> for Sized? {
10121012
/// Work with `self` as a slice.
10131013
fn as_slice<'a>(&'a self) -> &'a [T];
10141014
}
10151015

10161016
#[unstable = "trait is unstable"]
1017-
impl<'a,T> AsSlice<T> for &'a [T] {
1017+
impl<T> AsSlice<T> for [T] {
10181018
#[inline(always)]
1019-
fn as_slice<'a>(&'a self) -> &'a [T] { *self }
1019+
fn as_slice<'a>(&'a self) -> &'a [T] { self }
1020+
}
1021+
1022+
impl<'a, T, Sized? U: AsSlice<T>> AsSlice<T> for &'a U {
1023+
#[inline(always)]
1024+
fn as_slice<'a>(&'a self) -> &'a [T] { AsSlice::as_slice(*self) }
1025+
}
1026+
1027+
impl<'a, T, Sized? U: AsSlice<T>> AsSlice<T> for &'a mut U {
1028+
#[inline(always)]
1029+
fn as_slice<'a>(&'a self) -> &'a [T] { AsSlice::as_slice(*self) }
10201030
}
10211031

10221032
#[unstable = "waiting for DST"]
@@ -1681,13 +1691,13 @@ impl<T: PartialEq> PartialEq for [T] {
16811691
impl<T: Eq> Eq for [T] {}
16821692

16831693
#[unstable = "waiting for DST"]
1684-
impl<T: PartialEq, V: AsSlice<T>> Equiv<V> for [T] {
1694+
impl<T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for [T] {
16851695
#[inline]
16861696
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
16871697
}
16881698

16891699
#[unstable = "waiting for DST"]
1690-
impl<'a,T:PartialEq, V: AsSlice<T>> Equiv<V> for &'a mut [T] {
1700+
impl<'a,T:PartialEq, Sized? V: AsSlice<T>> Equiv<V> for &'a mut [T] {
16911701
#[inline]
16921702
fn equiv(&self, other: &V) -> bool { self.as_slice() == other.as_slice() }
16931703
}

branches/snap-stage3/src/libgraphviz/maybe_owned_vec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl<'a, T: Ord> Ord for MaybeOwnedVector<'a, T> {
8989
}
9090
}
9191

92-
impl<'a, T: PartialEq, V: AsSlice<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
92+
impl<'a, T: PartialEq, Sized? V: AsSlice<T>> Equiv<V> for MaybeOwnedVector<'a, T> {
9393
fn equiv(&self, other: &V) -> bool {
9494
self.as_slice() == other.as_slice()
9595
}

branches/snap-stage3/src/libstd/path/posix.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering};
1616
use hash;
1717
use io::Writer;
1818
use iter::{DoubleEndedIterator, AdditiveIterator, Extend, Iterator, Map};
19+
use kinds::Sized;
1920
use option::{Option, None, Some};
2021
use str::{FromStr, Str};
2122
use str;
@@ -342,7 +343,7 @@ impl Path {
342343

343344
/// Returns a normalized byte vector representation of a path, by removing all empty
344345
/// components, and unnecessary . and .. components.
345-
fn normalize<V: AsSlice<u8>>(v: V) -> Vec<u8> {
346+
fn normalize<Sized? V: AsSlice<u8>>(v: &V) -> Vec<u8> {
346347
// borrowck is being very picky
347348
let val = {
348349
let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == SEP_BYTE;

0 commit comments

Comments
 (0)