diff options
| author | Aaron Turon <aturon@mozilla.com> | 2014-11-04 15:31:46 -0800 |
|---|---|---|
| committer | Aaron Turon <aturon@mozilla.com> | 2014-11-20 00:05:00 -0800 |
| commit | 004db80afe08b28d79741c486ceb8398e6725829 (patch) | |
| tree | d365766bb4558d1339ad6bbbef51ea6e969a9304 /src/libstd/path | |
| parent | 793624261a221aa4592381fa8067e1f597b90c22 (diff) | |
| download | rust-004db80afe08b28d79741c486ceb8398e6725829.tar.gz rust-004db80afe08b28d79741c486ceb8398e6725829.zip | |
libcore: DST-ify AsSlice
This commit changes `AsSlice` to work on unsized types, and changes the
`impl` for `&[T]` to `[T]`. Aside from making the trait more general,
this also helps some ongoing work with method resolution changes.
This is a breaking change: code that uses generics bounded by `AsSlice`
will have to change. In particular, such code previously often took
arguments of type `V` where `V: AsSlice<T>` by value. These should now
be taken by reference:
```rust
fn foo<Sized? V: AsSlice<T>>(v: &V) { .. }
```
A few std lib functions have been changed accordingly.
[breaking-change]
Diffstat (limited to 'src/libstd/path')
| -rw-r--r-- | src/libstd/path/posix.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 3e013ba20c4..2b444fdc32b 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -16,6 +16,7 @@ use cmp::{PartialEq, Eq, PartialOrd, Ord, Ordering}; use hash; use io::Writer; use iter::{DoubleEndedIterator, AdditiveIterator, Extend, Iterator, Map}; +use kinds::Sized; use option::{Option, None, Some}; use str::{FromStr, Str}; use str; @@ -342,7 +343,7 @@ impl Path { /// Returns a normalized byte vector representation of a path, by removing all empty /// components, and unnecessary . and .. components. - fn normalize<V: AsSlice<u8>>(v: V) -> Vec<u8> { + fn normalize<Sized? V: AsSlice<u8>>(v: &V) -> Vec<u8> { // borrowck is being very picky let val = { let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == SEP_BYTE; |
