diff options
| author | bors <bors@rust-lang.org> | 2014-11-20 10:01:42 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-11-20 10:01:42 +0000 |
| commit | b825b3496aff1ed784f7a7ca935245208b95aabb (patch) | |
| tree | e68c0589de4162fdcf072913d6fe547afa1b7c7b /src/libstd | |
| parent | dd5ce5ae2f254cc42763518909f6e7c486d9502a (diff) | |
| parent | c287afb2fa530d22563391737ac1d44faf2f9b2e (diff) | |
| download | rust-b825b3496aff1ed784f7a7ca935245208b95aabb.tar.gz rust-b825b3496aff1ed784f7a7ca935245208b95aabb.zip | |
auto merge of #18638 : aturon/rust/as_slice_dst, r=japaric
This PR 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.
The PR also relaxes constraints on generics and traits within the
`core::ops` module and for the `Equiv` trait.
[breaking-change]
r? @nikomatsakis
cc @japaric
Diffstat (limited to 'src/libstd')
| -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; |
