Auto merge of #32200 - Manishearth:rollup, r=Manishearth

Rollup of 11 pull requests

- Successful merges: #32137, #32158, #32171, #32174, #32178, #32179, #32180, #32181, #32183, #32186, #32197
- Failed merges:
This commit is contained in:
bors 2016-03-11 17:50:45 -08:00
commit f1d6f126ef
16 changed files with 279 additions and 69 deletions

View File

@ -15,7 +15,7 @@ use std::io::prelude::*;
use std::path::Path;
pub struct ExpectedError {
pub line: usize,
pub line_num: usize,
pub kind: String,
pub msg: String,
}
@ -53,15 +53,15 @@ pub fn load_errors(testfile: &Path, cfg: Option<&str>) -> Vec<ExpectedError> {
rdr.lines()
.enumerate()
.filter_map(|(line_no, ln)| {
.filter_map(|(line_num, line)| {
parse_expected(last_nonfollow_error,
line_no + 1,
&ln.unwrap(),
line_num + 1,
&line.unwrap(),
&tag)
.map(|(which, error)| {
match which {
FollowPrevious(_) => {}
_ => last_nonfollow_error = Some(error.line),
_ => last_nonfollow_error = Some(error.line_num),
}
error
})
@ -91,23 +91,21 @@ fn parse_expected(last_nonfollow_error: Option<usize>,
.skip_while(|c| !c.is_whitespace())
.collect::<String>().trim().to_owned();
let (which, line) = if follow {
let (which, line_num) = if follow {
assert!(adjusts == 0, "use either //~| or //~^, not both.");
let line = last_nonfollow_error.unwrap_or_else(|| {
panic!("encountered //~| without preceding //~^ line.")
});
(FollowPrevious(line), line)
let line_num = last_nonfollow_error.expect("encountered //~| without \
preceding //~^ line.");
(FollowPrevious(line_num), line_num)
} else {
let which =
if adjusts > 0 { AdjustBackward(adjusts) } else { ThisLine };
let line = line_num - adjusts;
(which, line)
let line_num = line_num - adjusts;
(which, line_num)
};
debug!("line={} tag={:?} which={:?} kind={:?} msg={:?}",
line_num, tag, which, kind, msg);
Some((which, ExpectedError { line: line,
Some((which, ExpectedError { line_num: line_num,
kind: kind,
msg: msg, }))
}

View File

@ -1004,7 +1004,7 @@ fn check_expected_errors(revision: Option<&str>,
}
let prefixes = expected_errors.iter().map(|ee| {
let expected = format!("{}:{}:", testpaths.file.display(), ee.line);
let expected = format!("{}:{}:", testpaths.file.display(), ee.line_num);
// On windows just translate all '\' path separators to '/'
expected.replace(r"\", "/")
}).collect::<Vec<String>>();
@ -1076,7 +1076,7 @@ fn check_expected_errors(revision: Option<&str>,
if !flag {
let ee = &expected_errors[i];
error(revision, &format!("expected {} on line {} not found: {}",
ee.kind, ee.line, ee.msg));
ee.kind, ee.line_num, ee.msg));
not_found += 1;
}
}

View File

@ -119,19 +119,7 @@ This will download a script, and start the installation. If it all goes well,
youll see this appear:
```text
Welcome to Rust.
This script will download the Rust compiler and its package manager, Cargo, and
install them to /usr/local. You may install elsewhere by running this script
with the --prefix=<path> option.
The installer will run under sudo and may ask you for your password. If you do
not want the script to run sudo then pass it the --disable-sudo flag.
You may uninstall later by running /usr/local/lib/rustlib/uninstall.sh,
or by running this script again with the --uninstall flag.
Continue? (y/N)
Rust is ready to roll.
```
From here, press `y` for yes, and then follow the rest of the prompts.

View File

@ -167,6 +167,49 @@ use vec::{self, Vec};
/// item's ordering relative to any other item, as determined by the `Ord`
/// trait, changes while it is in the heap. This is normally only possible
/// through `Cell`, `RefCell`, global state, I/O, or unsafe code.
///
/// # Examples
///
/// ```
/// use std::collections::BinaryHeap;
///
/// // type inference lets us omit an explicit type signature (which
/// // would be `BinaryHeap<i32>` in this example).
/// let mut heap = BinaryHeap::new();
///
/// // We can use peek to look at the next item in the heap. In this case,
/// // there's no items in there yet so we get None.
/// assert_eq!(heap.peek(), None);
///
/// // Let's add some scores...
/// heap.push(1);
/// heap.push(5);
/// heap.push(2);
///
/// // Now peek shows the most important item in the heap.
/// assert_eq!(heap.peek(), Some(&5));
///
/// // We can check the length of a heap.
/// assert_eq!(heap.len(), 3);
///
/// // We can iterate over the items in the heap, although they are returned in
/// // a random order.
/// for x in heap.iter() {
/// println!("{}", x);
/// }
///
/// // If we instead pop these scores, they should come back in order.
/// assert_eq!(heap.pop(), Some(5));
/// assert_eq!(heap.pop(), Some(2));
/// assert_eq!(heap.pop(), Some(1));
/// assert_eq!(heap.pop(), None);
///
/// // We can clear the heap of any remaining items.
/// heap.clear();
///
/// // The heap should now be empty.
/// assert!(heap.is_empty())
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub struct BinaryHeap<T> {
data: Vec<T>,
@ -203,6 +246,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
@ -220,6 +265,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::with_capacity(10);
@ -235,6 +282,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4]);
@ -253,6 +302,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
@ -273,6 +324,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::with_capacity(100);
@ -297,6 +350,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
@ -318,6 +373,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
@ -331,6 +388,19 @@ impl<T: Ord> BinaryHeap<T> {
}
/// Discards as much additional capacity as possible.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap: BinaryHeap<i32> = BinaryHeap::with_capacity(100);
///
/// assert!(heap.capacity() >= 100);
/// heap.shrink_to_fit();
/// assert!(heap.capacity() == 0);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn shrink_to_fit(&mut self) {
self.data.shrink_to_fit();
@ -341,6 +411,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::from(vec![1, 3]);
@ -364,6 +436,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
@ -386,6 +460,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(binary_heap_extras)]
///
@ -424,6 +500,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// #![feature(binary_heap_extras)]
///
@ -454,6 +532,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4, 5, 6, 7]);
@ -474,6 +554,8 @@ impl<T: Ord> BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
///
@ -571,12 +653,40 @@ impl<T: Ord> BinaryHeap<T> {
}
/// Returns the length of the binary heap.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from(vec![1, 3]);
///
/// assert_eq!(heap.len(), 2);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn len(&self) -> usize {
self.data.len()
}
/// Checks if the binary heap is empty.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::new();
///
/// assert!(heap.is_empty());
///
/// heap.push(3);
/// heap.push(5);
/// heap.push(1);
///
/// assert!(!heap.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_empty(&self) -> bool {
self.len() == 0
@ -585,6 +695,23 @@ impl<T: Ord> BinaryHeap<T> {
/// Clears the binary heap, returning an iterator over the removed elements.
///
/// The elements are removed in arbitrary order.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::from(vec![1, 3]);
///
/// assert!(!heap.is_empty());
///
/// for x in heap.drain() {
/// println!("{}", x);
/// }
///
/// assert!(heap.is_empty());
/// ```
#[inline]
#[stable(feature = "drain", since = "1.6.0")]
pub fn drain(&mut self) -> Drain<T> {
@ -592,6 +719,21 @@ impl<T: Ord> BinaryHeap<T> {
}
/// Drops all items from the binary heap.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let mut heap = BinaryHeap::from(vec![1, 3]);
///
/// assert!(!heap.is_empty());
///
/// heap.clear();
///
/// assert!(heap.is_empty());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn clear(&mut self) {
self.drain();
@ -809,6 +951,8 @@ impl<T: Ord> IntoIterator for BinaryHeap<T> {
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// use std::collections::BinaryHeap;
/// let heap = BinaryHeap::from(vec![1, 2, 3, 4]);

View File

@ -535,6 +535,16 @@ fn slice_index_order_fail(index: usize, end: usize) -> ! {
// FIXME implement indexing with inclusive ranges
/// Implements slicing with syntax `&self[begin .. end]`.
///
/// Returns a slice of self for the index range [`begin`..`end`).
///
/// This operation is `O(1)`.
///
/// # Panics
///
/// Requires that `begin <= end` and `end <= self.len()`,
/// otherwise slicing will panic.
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::Index<ops::Range<usize>> for [T] {
type Output = [T];
@ -554,6 +564,13 @@ impl<T> ops::Index<ops::Range<usize>> for [T] {
}
}
}
/// Implements slicing with syntax `&self[.. end]`.
///
/// Returns a slice of self from the beginning until but not including
/// the index `end`.
///
/// Equivalent to `&self[0 .. end]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
type Output = [T];
@ -563,6 +580,12 @@ impl<T> ops::Index<ops::RangeTo<usize>> for [T] {
self.index(0 .. index.end)
}
}
/// Implements slicing with syntax `&self[begin ..]`.
///
/// Returns a slice of self from and including the index `begin` until the end.
///
/// Equivalent to `&self[begin .. self.len()]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::Index<ops::RangeFrom<usize>> for [T] {
type Output = [T];
@ -572,6 +595,12 @@ impl<T> ops::Index<ops::RangeFrom<usize>> for [T] {
self.index(index.start .. self.len())
}
}
/// Implements slicing with syntax `&self[..]`.
///
/// Returns a slice of the whole slice. This operation can not panic.
///
/// Equivalent to `&self[0 .. self.len()]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::Index<RangeFull> for [T] {
type Output = [T];
@ -608,6 +637,16 @@ impl<T> ops::Index<ops::RangeToInclusive<usize>> for [T] {
}
}
/// Implements mutable slicing with syntax `&mut self[begin .. end]`.
///
/// Returns a slice of self for the index range [`begin`..`end`).
///
/// This operation is `O(1)`.
///
/// # Panics
///
/// Requires that `begin <= end` and `end <= self.len()`,
/// otherwise slicing will panic.
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
#[inline]
@ -625,6 +664,13 @@ impl<T> ops::IndexMut<ops::Range<usize>> for [T] {
}
}
}
/// Implements mutable slicing with syntax `&mut self[.. end]`.
///
/// Returns a slice of self from the beginning until but not including
/// the index `end`.
///
/// Equivalent to `&mut self[0 .. end]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
#[inline]
@ -632,6 +678,12 @@ impl<T> ops::IndexMut<ops::RangeTo<usize>> for [T] {
self.index_mut(0 .. index.end)
}
}
/// Implements mutable slicing with syntax `&mut self[begin ..]`.
///
/// Returns a slice of self from and including the index `begin` until the end.
///
/// Equivalent to `&mut self[begin .. self.len()]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<ops::RangeFrom<usize>> for [T] {
#[inline]
@ -640,6 +692,12 @@ impl<T> ops::IndexMut<ops::RangeFrom<usize>> for [T] {
self.index_mut(index.start .. len)
}
}
/// Implements mutable slicing with syntax `&mut self[..]`.
///
/// Returns a slice of the whole slice. This operation can not panic.
///
/// Equivalent to `&mut self[0 .. self.len()]`
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> ops::IndexMut<RangeFull> for [T] {
#[inline]

View File

@ -53,7 +53,7 @@ mod debug_struct {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("Foo")
.field("bar", &true)
.field("baz", &format_args!("{}/{}", 10i32, 20i32))
.field("baz", &format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -75,7 +75,7 @@ mod debug_struct {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_struct("Foo")
.field("bar", &true)
.field("baz", &format_args!("{}/{}", 10i32, 20i32))
.field("baz", &format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -150,7 +150,7 @@ mod debug_tuple {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_tuple("Foo")
.field(&true)
.field(&format_args!("{}/{}", 10i32, 20i32))
.field(&format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -172,7 +172,7 @@ mod debug_tuple {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_tuple("Foo")
.field(&true)
.field(&format_args!("{}/{}", 10i32, 20i32))
.field(&format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -247,7 +247,7 @@ mod debug_map {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_map()
.entry(&"bar", &true)
.entry(&10i32, &format_args!("{}/{}", 10i32, 20i32))
.entry(&10, &format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -269,7 +269,7 @@ mod debug_map {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_map()
.entry(&"bar", &true)
.entry(&10i32, &format_args!("{}/{}", 10i32, 20i32))
.entry(&10, &format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -348,7 +348,7 @@ mod debug_set {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_set()
.entry(&true)
.entry(&format_args!("{}/{}", 10i32, 20i32))
.entry(&format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -370,7 +370,7 @@ mod debug_set {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_set()
.entry(&true)
.entry(&format_args!("{}/{}", 10i32, 20i32))
.entry(&format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -445,7 +445,7 @@ mod debug_list {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_list()
.entry(&true)
.entry(&format_args!("{}/{}", 10i32, 20i32))
.entry(&format_args!("{}/{}", 10, 20))
.finish()
}
}
@ -467,7 +467,7 @@ mod debug_list {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_list()
.entry(&true)
.entry(&format_args!("{}/{}", 10i32, 20i32))
.entry(&format_args!("{}/{}", 10, 20))
.finish()
}
}

View File

@ -677,7 +677,7 @@ fn test_rev() {
#[test]
fn test_cloned() {
let xs = [2u8, 4, 6, 8];
let xs = [2, 4, 6, 8];
let mut it = xs.iter().cloned();
assert_eq!(it.len(), 4);
@ -861,8 +861,8 @@ fn test_range() {
assert_eq!((-10..-1).size_hint(), (9, Some(9)));
assert_eq!((-1..-10).size_hint(), (0, Some(0)));
assert_eq!((-70..58i8).size_hint(), (128, Some(128)));
assert_eq!((-128..127i8).size_hint(), (255, Some(255)));
assert_eq!((-70..58).size_hint(), (128, Some(128)));
assert_eq!((-128..127).size_hint(), (255, Some(255)));
assert_eq!((-2..isize::MAX).size_hint(),
(isize::MAX as usize + 2, Some(isize::MAX as usize + 2)));
}
@ -1013,7 +1013,7 @@ fn bench_max_by_key2(b: &mut Bencher) {
array.iter().enumerate().max_by_key(|&(_, item)| item).unwrap().0
}
let mut data = vec![0i32; 1638];
let mut data = vec![0; 1638];
data[514] = 9999;
b.iter(|| max_index_iter(&data));

View File

@ -208,11 +208,11 @@ mod tests {
fn test_pow() {
let mut r = 2 as $T;
assert_eq!(r.pow(2u32), 4 as $T);
assert_eq!(r.pow(0u32), 1 as $T);
assert_eq!(r.pow(2), 4 as $T);
assert_eq!(r.pow(0), 1 as $T);
r = -2 as $T;
assert_eq!(r.pow(2u32), 4 as $T);
assert_eq!(r.pow(3u32), -8 as $T);
assert_eq!(r.pow(2), 4 as $T);
assert_eq!(r.pow(3), -8 as $T);
}
}

View File

@ -99,8 +99,8 @@ mod tests {
#[test]
fn test_leading_plus() {
assert_eq!("+127".parse::<u8>().ok(), Some(127u8));
assert_eq!("+9223372036854775807".parse::<i64>().ok(), Some(9223372036854775807i64));
assert_eq!("+127".parse::<u8>().ok(), Some(127));
assert_eq!("+9223372036854775807".parse::<i64>().ok(), Some(9223372036854775807));
}
#[test]

View File

@ -251,7 +251,7 @@ fn test_collect() {
#[test]
fn test_cloned() {
let val = 1u32;
let val = 1;
let val_ref = &val;
let opt_none: Option<&'static u32> = None;
let opt_ref = Some(&val);
@ -263,10 +263,10 @@ fn test_cloned() {
// Immutable ref works
assert_eq!(opt_ref.clone(), Some(&val));
assert_eq!(opt_ref.cloned(), Some(1u32));
assert_eq!(opt_ref.cloned(), Some(1));
// Double Immutable ref works
assert_eq!(opt_ref_ref.clone(), Some(&val_ref));
assert_eq!(opt_ref_ref.clone().cloned(), Some(&val));
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1u32));
assert_eq!(opt_ref_ref.cloned().cloned(), Some(1));
}

View File

@ -351,15 +351,9 @@ impl<'v> Visitor<'v> for LifeSeeder {
}
hir::ItemImpl(_, _, _, ref opt_trait, _, ref impl_items) => {
for impl_item in impl_items {
match impl_item.node {
hir::ImplItemKind::Const(..) |
hir::ImplItemKind::Method(..) => {
if opt_trait.is_some() ||
has_allow_dead_code_or_lang_attr(&impl_item.attrs) {
self.worklist.push(impl_item.id);
}
}
hir::ImplItemKind::Type(_) => {}
if opt_trait.is_some() ||
has_allow_dead_code_or_lang_attr(&impl_item.attrs) {
self.worklist.push(impl_item.id);
}
}
}

View File

@ -737,7 +737,7 @@ pub enum Expr_ {
ExprBinary(BinOp, P<Expr>, P<Expr>),
/// A unary operation (For example: `!x`, `*x`)
ExprUnary(UnOp, P<Expr>),
/// A literal (For example: `1u8`, `"foo"`)
/// A literal (For example: `1`, `"foo"`)
ExprLit(P<Lit>),
/// A cast (`foo as f64`)
ExprCast(P<Expr>, P<Ty>),
@ -804,7 +804,7 @@ pub enum Expr_ {
/// A vector literal constructed from one repeated element.
///
/// For example, `[1u8; 5]`. The first expression is the element
/// For example, `[1; 5]`. The first expression is the element
/// to be repeated; the second is the number of times to repeat it.
ExprRepeat(P<Expr>, P<Expr>),
}

View File

@ -379,7 +379,7 @@ impl Test {
fn main() {
let x = Test;
let v = &[0i32];
let v = &[0];
x.method::<i32, i32>(v); // error: only one type parameter is expected!
}
@ -398,7 +398,7 @@ impl Test {
fn main() {
let x = Test;
let v = &[0i32];
let v = &[0];
x.method::<i32>(v); // OK, we're good!
}
@ -901,7 +901,7 @@ Example of erroneous code:
```compile_fail
enum Foo { FirstValue(i32) };
let u = Foo::FirstValue { value: 0i32 }; // error: Foo::FirstValue
let u = Foo::FirstValue { value: 0 }; // error: Foo::FirstValue
// isn't a structure!
// or even simpler, if the name doesn't refer to a structure at all.
let t = u32 { value: 4 }; // error: `u32` does not name a structure.

View File

@ -22,7 +22,7 @@ use sys::os_str::{Buf, Slice};
use sys_common::{AsInner, IntoInner, FromInner};
/// A type that can represent owned, mutable platform-native strings, but is
/// cheaply interconvertable with Rust strings.
/// cheaply inter-convertible with Rust strings.
///
/// The need for this type arises from the fact that:
///
@ -272,7 +272,7 @@ impl OsStr {
unsafe { mem::transmute(inner) }
}
/// Yields a `&str` slice if the `OsStr` is valid unicode.
/// Yields a `&str` slice if the `OsStr` is valid Unicode.
///
/// This conversion may entail doing a check for UTF-8 validity.
#[stable(feature = "rust1", since = "1.0.0")]
@ -301,7 +301,7 @@ impl OsStr {
/// On Unix systems, this is a no-op.
///
/// On Windows systems, this returns `None` unless the `OsStr` is
/// valid unicode, in which case it produces UTF-8-encoded
/// valid Unicode, in which case it produces UTF-8-encoded
/// data. This may entail checking validity.
#[unstable(feature = "convert", reason = "recently added", issue = "27704")]
#[rustc_deprecated(reason = "RFC was closed, hides subtle Windows semantics",

View File

@ -6,6 +6,7 @@ S 2016-02-17 4d3eebf
winnt-i386 0c336d794a65f8e285c121866c7d59aa2dd0d1e1
winnt-x86_64 27e75b1bf99770b3564bcebd7f3230be01135a92
openbsd-x86_64 ac957c6b84de2bd67f01df085d9ea515f96e22f3
freebsd-x86_64 395adf223f3f25514c9dffecb524f493c42a0e5d
S 2015-12-18 3391630
bitrig-x86_64 6476e1562df02389b55553b4c88b1f4fd121cd40

View File

@ -0,0 +1,27 @@
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![deny(dead_code)]
trait Foo {
type Bar;
}
struct Used;
struct Ex;
impl Foo for Ex {
type Bar = Used;
}
pub fn main() {
let _x = Ex;
}