From 004db80afe08b28d79741c486ceb8398e6725829 Mon Sep 17 00:00:00 2001 From: Aaron Turon Date: Tue, 4 Nov 2014 15:31:46 -0800 Subject: 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` by value. These should now be taken by reference: ```rust fn foo>(v: &V) { .. } ``` A few std lib functions have been changed accordingly. [breaking-change] --- src/libstd/path/posix.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/libstd/path') 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: V) -> Vec { + fn normalize>(v: &V) -> Vec { // borrowck is being very picky let val = { let is_abs = !v.as_slice().is_empty() && v.as_slice()[0] == SEP_BYTE; -- cgit 1.4.1-3-g733a5