Auto merge of #36177 - jonathandturner:rollup, r=jonathandturner

Rollup of 13 pull requests

- Successful merges: #35773, #35786, #35911, #35927, #36083, #36087, #36098, #36114, #36118, #36123, #36129, #36152, #36169
- Failed merges:
This commit is contained in:
bors 2016-08-31 17:40:39 -07:00 committed by GitHub
commit 3135b7877a
20 changed files with 309 additions and 88 deletions

View File

@ -1,4 +1,4 @@
.TH RUSTC "1" "August 2016" "rustc 1.12.0" "User Commands"
.TH RUSTC "1" "September 2016" "rustc 1.13.0" "User Commands"
.SH NAME
rustc \- The Rust compiler
.SH SYNOPSIS

View File

@ -1,4 +1,4 @@
.TH RUSTDOC "1" "August 2016" "rustdoc 1.12.0" "User Commands"
.TH RUSTDOC "1" "September 2016" "rustdoc 1.13.0" "User Commands"
.SH NAME
rustdoc \- generate documentation from Rust source code
.SH SYNOPSIS

View File

@ -528,7 +528,7 @@ impl Build {
let path = Path::new(line[1..].split(' ').skip(1).next().unwrap());
let state = if line.starts_with('-') {
State::NotInitialized
} else if line.starts_with('*') {
} else if line.starts_with('+') {
State::OutOfSync
} else if line.starts_with(' ') {
State::MaybeDirty

View File

@ -42,17 +42,23 @@
/// A cheap, reference-to-reference conversion.
///
/// `AsRef` is very similar to, but different than, `Borrow`. See
/// `AsRef` is very similar to, but different than, [`Borrow`]. See
/// [the book][book] for more.
///
/// [book]: ../../book/borrow-and-asref.html
/// [`Borrow`]: ../../std/borrow/trait.Borrow.html
///
/// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which
/// returns an `Option<T>` or a `Result<T, E>`.
/// returns an [`Option<T>`] or a [`Result<T, E>`].
///
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
///
/// # Examples
///
/// Both `String` and `&str` implement `AsRef<str>`:
/// Both [`String`] and `&str` implement `AsRef<str>`:
///
/// [`String`]: ../../std/string/struct.String.html
///
/// ```
/// fn is_hello<T: AsRef<str>>(s: T) {
@ -81,7 +87,10 @@ pub trait AsRef<T: ?Sized> {
/// A cheap, mutable reference-to-mutable reference conversion.
///
/// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which
/// returns an `Option<T>` or a `Result<T, E>`.
/// returns an [`Option<T>`] or a [`Result<T, E>`].
///
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
///
/// # Generic Impls
///
@ -97,16 +106,16 @@ pub trait AsMut<T: ?Sized> {
/// A conversion that consumes `self`, which may or may not be expensive.
///
/// **Note: this trait must not fail**. If the conversion can fail, use `TryInto` or a dedicated
/// method which returns an `Option<T>` or a `Result<T, E>`.
/// **Note: this trait must not fail**. If the conversion can fail, use [`TryInto`] or a dedicated
/// method which returns an [`Option<T>`] or a [`Result<T, E>`].
///
/// Library authors should not directly implement this trait, but should prefer implementing
/// the `From` trait, which offers greater flexibility and provides an equivalent `Into`
/// the [`From`][From] trait, which offers greater flexibility and provides an equivalent `Into`
/// implementation for free, thanks to a blanket implementation in the standard library.
///
/// # Examples
///
/// `String` implements `Into<Vec<u8>>`:
/// [`String`] implements `Into<Vec<u8>>`:
///
/// ```
/// fn is_hello<T: Into<Vec<u8>>>(s: T) {
@ -120,9 +129,15 @@ pub trait AsMut<T: ?Sized> {
///
/// # Generic Impls
///
/// - `From<T> for U` implies `Into<U> for T`
/// - `into()` is reflexive, which means that `Into<T> for T` is implemented
/// - `[From<T>][From] for U` implies `Into<U> for T`
/// - [`into()`] is reflexive, which means that `Into<T> for T` is implemented
///
/// [`TryInto`]: trait.TryInto.html
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`String`]: ../../std/string/struct.String.html
/// [From]: trait.From.html
/// [`into()`]: trait.Into.html#tymethod.into
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Into<T>: Sized {
/// Performs the conversion.
@ -132,12 +147,12 @@ pub trait Into<T>: Sized {
/// Construct `Self` via a conversion.
///
/// **Note: this trait must not fail**. If the conversion can fail, use `TryFrom` or a dedicated
/// method which returns an `Option<T>` or a `Result<T, E>`.
/// **Note: this trait must not fail**. If the conversion can fail, use [`TryFrom`] or a dedicated
/// method which returns an [`Option<T>`] or a [`Result<T, E>`].
///
/// # Examples
///
/// `String` implements `From<&str>`:
/// [`String`] implements `From<&str>`:
///
/// ```
/// let string = "hello".to_string();
@ -147,9 +162,15 @@ pub trait Into<T>: Sized {
/// ```
/// # Generic impls
///
/// - `From<T> for U` implies `Into<U> for T`
/// - `from()` is reflexive, which means that `From<T> for T` is implemented
/// - `From<T> for U` implies `[Into<U>] for T`
/// - [`from()`] is reflexive, which means that `From<T> for T` is implemented
///
/// [`TryFrom`]: trait.TryFrom.html
/// [`Option<T>`]: ../../std/option/enum.Option.html
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
/// [`String`]: ../../std/string/struct.String.html
/// [Into<U>]: trait.Into.html
/// [`from()`]: trait.From.html#tymethod.from
#[stable(feature = "rust1", since = "1.0.0")]
pub trait From<T>: Sized {
/// Performs the conversion.
@ -160,8 +181,10 @@ pub trait From<T>: Sized {
/// An attempted conversion that consumes `self`, which may or may not be expensive.
///
/// Library authors should not directly implement this trait, but should prefer implementing
/// the `TryFrom` trait, which offers greater flexibility and provides an equivalent `TryInto`
/// the [`TryFrom`] trait, which offers greater flexibility and provides an equivalent `TryInto`
/// implementation for free, thanks to a blanket implementation in the standard library.
///
/// [`TryFrom`]: trait.TryFrom.html
#[unstable(feature = "try_from", issue = "33417")]
pub trait TryInto<T>: Sized {
/// The type returned in the event of a conversion error.

View File

@ -1564,24 +1564,66 @@ rem_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
///
/// # Examples
///
/// A trivial implementation of `BitAndAssign`. When `Foo &= Foo` happens, it ends up
/// calling `bitand_assign`, and therefore, `main` prints `Bitwise And-ing!`.
/// In this example, the `&=` operator is lifted to a trivial `Scalar` type.
///
/// ```
/// use std::ops::BitAndAssign;
///
/// struct Foo;
/// #[derive(Debug, PartialEq)]
/// struct Scalar(bool);
///
/// impl BitAndAssign for Foo {
/// fn bitand_assign(&mut self, _rhs: Foo) {
/// println!("Bitwise And-ing!");
/// impl BitAndAssign for Scalar {
/// // rhs is the "right-hand side" of the expression `a &= b`
/// fn bitand_assign(&mut self, rhs: Self) {
/// *self = Scalar(self.0 & rhs.0)
/// }
/// }
///
/// # #[allow(unused_assignments)]
/// fn main() {
/// let mut foo = Foo;
/// foo &= Foo;
/// let mut scalar = Scalar(true);
/// scalar &= Scalar(true);
/// assert_eq!(scalar, Scalar(true));
///
/// let mut scalar = Scalar(true);
/// scalar &= Scalar(false);
/// assert_eq!(scalar, Scalar(false));
///
/// let mut scalar = Scalar(false);
/// scalar &= Scalar(true);
/// assert_eq!(scalar, Scalar(false));
///
/// let mut scalar = Scalar(false);
/// scalar &= Scalar(false);
/// assert_eq!(scalar, Scalar(false));
/// }
/// ```
///
/// In this example, the `BitAndAssign` trait is implemented for a
/// `BooleanVector` struct.
///
/// ```
/// use std::ops::BitAndAssign;
///
/// #[derive(Debug, PartialEq)]
/// struct BooleanVector(Vec<bool>);
///
/// impl BitAndAssign for BooleanVector {
/// // rhs is the "right-hand side" of the expression `a &= b`
/// fn bitand_assign(&mut self, rhs: Self) {
/// assert_eq!(self.0.len(), rhs.0.len());
/// *self = BooleanVector(self.0
/// .iter()
/// .zip(rhs.0.iter())
/// .map(|(x, y)| *x && *y)
/// .collect());
/// }
/// }
///
/// fn main() {
/// let mut bv = BooleanVector(vec![true, true, false, false]);
/// bv &= BooleanVector(vec![true, false, true, false]);
/// let expected = BooleanVector(vec![true, false, false, false]);
/// assert_eq!(bv, expected);
/// }
/// ```
#[lang = "bitand_assign"]

View File

@ -173,12 +173,16 @@ fn test_unsized_unique() {
}
#[test]
fn test_variadic_fnptr() {
#[allow(warnings)]
// Have a symbol for the test below. It doesnt need to be an actual variadic function, match the
// ABI, or even point to an actual executable code, because the function itself is never invoked.
#[no_mangle]
pub fn test_variadic_fnptr() {
use core::hash::{Hash, SipHasher};
extern "C" {
fn printf(_: *const u8, ...);
extern {
fn test_variadic_fnptr(_: u64, ...) -> f64;
}
let p: unsafe extern "C" fn(*const u8, ...) = printf;
let p: unsafe extern fn(u64, ...) -> f64 = test_variadic_fnptr;
let q = p.clone();
assert_eq!(p, q);
assert!(!(p < q));

View File

@ -27,7 +27,7 @@
//!
//! extern crate rustc;
//!
//! use rustc::plugin::Registry;
//! use rustc_plugin::Registry;
//!
//! #[plugin_registrar]
//! pub fn plugin_registrar(reg: &mut Registry) {

View File

@ -3349,7 +3349,11 @@ impl<'a> Resolver<'a> {
};
let mut err = match (old_binding.is_extern_crate(), binding.is_extern_crate()) {
(true, true) => struct_span_err!(self.session, span, E0259, "{}", msg),
(true, true) => {
let mut e = struct_span_err!(self.session, span, E0259, "{}", msg);
e.span_label(span, &format!("`{}` was already imported", name));
e
},
(true, _) | (_, true) if binding.is_import() || old_binding.is_import() => {
let mut e = struct_span_err!(self.session, span, E0254, "{}", msg);
e.span_label(span, &"already imported");

View File

@ -515,12 +515,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
// defaults. This will lead to an ICE if we are not
// careful!
if default_needs_object_self(def) {
span_err!(tcx.sess, span, E0393,
"the type parameter `{}` must be explicitly specified \
in an object type because its default value `{}` references \
the type `Self`",
def.name,
default);
struct_span_err!(tcx.sess, span, E0393,
"the type parameter `{}` must be explicitly specified",
def.name)
.span_label(span, &format!("missing reference to `{}`", def.name))
.note(&format!("because of the default `Self` reference, \
type parameters must be specified on object types"))
.emit();
tcx.types.err
} else {
// This is a default type parameter.

View File

@ -3592,7 +3592,6 @@ mod tests {
}
}
#[test]
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_streaming_parser() {
assert_stream_equal(
r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#,
@ -3631,7 +3630,6 @@ mod tests {
}
#[test]
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_read_object_streaming() {
assert_eq!(last_event("{ "), Error(SyntaxError(EOFWhileParsingObject, 1, 3)));
assert_eq!(last_event("{1"), Error(SyntaxError(KeyMustBeAString, 1, 2)));
@ -3715,7 +3713,6 @@ mod tests {
);
}
#[test]
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_read_array_streaming() {
assert_stream_equal(
"[]",

View File

@ -1510,8 +1510,11 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
/// Returns an iterator over the entries within a directory.
///
/// The iterator will yield instances of `io::Result<DirEntry>`. New errors may
/// be encountered after an iterator is initially constructed.
/// The iterator will yield instances of [`io::Result`]`<`[`DirEntry`]`>`.
/// New errors may be encountered after an iterator is initially constructed.
///
/// [`io::Result`]: ../io/type.Result.html
/// [`DirEntry`]: struct.DirEntry.html
///
/// # Platform-specific behavior
///

View File

@ -79,7 +79,7 @@ struct Custom {
/// It is used with the [`io::Error`] type.
///
/// [`io::Error`]: struct.Error.html
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[stable(feature = "rust1", since = "1.0.0")]
#[allow(deprecated)]
pub enum ErrorKind {
@ -161,7 +161,8 @@ pub enum ErrorKind {
#[stable(feature = "read_exact", since = "1.6.0")]
UnexpectedEof,
/// Any I/O error not part of this list.
/// A marker variant that tells the compiler that users of this enum cannot
/// match it exhaustively.
#[unstable(feature = "io_error_internals",
reason = "better expressed through extensible enums that this \
enum cannot be exhaustively matched against",

View File

@ -1028,11 +1028,16 @@ impl<'a> cmp::Ord for Components<'a> {
// Basic types and traits
////////////////////////////////////////////////////////////////////////////////
/// An owned, mutable path (akin to `String`).
/// An owned, mutable path (akin to [`String`]).
///
/// This type provides methods like `push` and `set_extension` that mutate the
/// path in place. It also implements `Deref` to `Path`, meaning that all
/// methods on `Path` slices are available on `PathBuf` values as well.
/// This type provides methods like [`push`] and [`set_extension`] that mutate
/// the path in place. It also implements [`Deref`] to [`Path`], meaning that
/// all methods on [`Path`] slices are available on `PathBuf` values as well.
///
/// [`String`]: ../string/struct.String.html
/// [`Path`]: struct.Path.html
/// [`push`]: struct.PathBuf.html#method.push
/// [`set_extension`]: struct.PathBuf.html#method.set_extension
///
/// More details about the overall approach can be found in
/// the module documentation.
@ -1059,12 +1064,31 @@ impl PathBuf {
}
/// Allocates an empty `PathBuf`.
///
/// # Examples
///
/// ```
/// use std::path::PathBuf;
///
/// let path = PathBuf::new();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn new() -> PathBuf {
PathBuf { inner: OsString::new() }
}
/// Coerces to a `Path` slice.
/// Coerces to a [`Path`] slice.
///
/// [`Path`]: struct.Path.html
///
/// # Examples
///
/// ```
/// use std::path::{Path, PathBuf};
///
/// let p = PathBuf::from("/test");
/// assert_eq!(Path::new("/test"), p.as_path());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn as_path(&self) -> &Path {
self
@ -1129,10 +1153,26 @@ impl PathBuf {
self.inner.push(path);
}
/// Truncate `self` to `self.parent()`.
/// Truncate `self` to [`self.parent()`].
///
/// Returns false and does nothing if `self.file_name()` is `None`.
/// Returns false and does nothing if [`self.file_name()`] is `None`.
/// Otherwise, returns `true`.
///
/// [`self.parent()`]: struct.PathBuf.html#method.parent
/// [`self.file_name()`]: struct.PathBuf.html#method.file_name
///
/// # Examples
///
/// ```
/// use std::path::{Path, PathBuf};
///
/// let mut p = PathBuf::from("/test/test.rs");
///
/// p.pop();
/// assert_eq!(Path::new("/test"), p.as_path());
/// p.pop();
/// assert_eq!(Path::new("/"), p.as_path());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn pop(&mut self) -> bool {
match self.parent().map(|p| p.as_u8_slice().len()) {
@ -1144,11 +1184,13 @@ impl PathBuf {
}
}
/// Updates `self.file_name()` to `file_name`.
/// Updates [`self.file_name()`] to `file_name`.
///
/// If `self.file_name()` was `None`, this is equivalent to pushing
/// If [`self.file_name()`] was `None`, this is equivalent to pushing
/// `file_name`.
///
/// [`self.file_name()`]: struct.PathBuf.html#method.file_name
///
/// # Examples
///
/// ```
@ -1175,12 +1217,29 @@ impl PathBuf {
self.push(file_name);
}
/// Updates `self.extension()` to `extension`.
/// Updates [`self.extension()`] to `extension`.
///
/// If `self.file_name()` is `None`, does nothing and returns `false`.
/// If [`self.file_name()`] is `None`, does nothing and returns `false`.
///
/// Otherwise, returns `true`; if `self.extension()` is `None`, the extension
/// is added; otherwise it is replaced.
/// Otherwise, returns `true`; if [`self.extension()`] is `None`, the
/// extension is added; otherwise it is replaced.
///
/// [`self.file_name()`]: struct.PathBuf.html#method.file_name
/// [`self.extension()`]: struct.PathBuf.html#method.extension
///
/// # Examples
///
/// ```
/// use std::path::{Path, PathBuf};
///
/// let mut p = PathBuf::from("/feel/the");
///
/// p.set_extension("force");
/// assert_eq!(Path::new("/feel/the.force"), p.as_path());
///
/// p.set_extension("dark_side");
/// assert_eq!(Path::new("/feel/the.dark_side"), p.as_path());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn set_extension<S: AsRef<OsStr>>(&mut self, extension: S) -> bool {
self._set_extension(extension.as_ref())
@ -1205,7 +1264,18 @@ impl PathBuf {
true
}
/// Consumes the `PathBuf`, yielding its internal `OsString` storage.
/// Consumes the `PathBuf`, yielding its internal [`OsString`] storage.
///
/// [`OsString`]: ../ffi/struct.OsString.html
///
/// # Examples
///
/// ```
/// use std::path::PathBuf;
///
/// let p = PathBuf::from("/the/head");
/// let os_str = p.into_os_string();
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn into_os_string(self) -> OsString {
self.inner
@ -1343,7 +1413,7 @@ impl Into<OsString> for PathBuf {
}
}
/// A slice of a path (akin to `str`).
/// A slice of a path (akin to [`str`]).
///
/// This type supports a number of operations for inspecting a path, including
/// breaking the path into its components (separated by `/` or `\`, depending on
@ -1352,7 +1422,10 @@ impl Into<OsString> for PathBuf {
/// the module documentation.
///
/// This is an *unsized* type, meaning that it must always be used behind a
/// pointer like `&` or `Box`.
/// pointer like `&` or [`Box`].
///
/// [`str`]: ../primitive.str.html
/// [`Box`]: ../boxed/struct.Box.html
///
/// # Examples
///
@ -1414,7 +1487,9 @@ impl Path {
unsafe { mem::transmute(s.as_ref()) }
}
/// Yields the underlying `OsStr` slice.
/// Yields the underlying [`OsStr`] slice.
///
/// [`OsStr`]: ../ffi/struct.OsStr.html
///
/// # Examples
///
@ -1429,10 +1504,12 @@ impl Path {
&self.inner
}
/// Yields a `&str` slice if the `Path` is valid unicode.
/// Yields a [`&str`] slice if the `Path` is valid unicode.
///
/// This conversion may entail doing a check for UTF-8 validity.
///
/// [`&str`]: ../primitive.str.html
///
/// # Examples
///
/// ```
@ -1446,10 +1523,12 @@ impl Path {
self.inner.to_str()
}
/// Converts a `Path` to a `Cow<str>`.
/// Converts a `Path` to a [`Cow<str>`].
///
/// Any non-Unicode sequences are replaced with U+FFFD REPLACEMENT CHARACTER.
///
/// [`Cow<str>`]: ../borrow/enum.Cow.html
///
/// # Examples
///
/// ```
@ -1463,7 +1542,9 @@ impl Path {
self.inner.to_string_lossy()
}
/// Converts a `Path` to an owned `PathBuf`.
/// Converts a `Path` to an owned [`PathBuf`].
///
/// [`PathBuf`]: struct.PathBuf.html
///
/// # Examples
///
@ -1611,6 +1692,18 @@ impl Path {
///
/// If `base` is not a prefix of `self` (i.e. `starts_with`
/// returns `false`), returns `Err`.
///
/// # Examples
///
/// ```
/// use std::path::Path;
///
/// let path = Path::new("/test/haha/foo.txt");
///
/// assert_eq!(path.strip_prefix("/test"), Ok(Path::new("haha/foo.txt")));
/// assert_eq!(path.strip_prefix("test").is_ok(), false);
/// assert_eq!(path.strip_prefix("/haha").is_ok(), false);
/// ```
#[stable(since = "1.7.0", feature = "path_strip_prefix")]
pub fn strip_prefix<'a, P: ?Sized>(&'a self, base: &'a P)
-> Result<&'a Path, StripPrefixError>
@ -1672,7 +1765,9 @@ impl Path {
iter_after(self.components().rev(), child.components().rev()).is_some()
}
/// Extracts the stem (non-extension) portion of `self.file_name()`.
/// Extracts the stem (non-extension) portion of [`self.file_name()`].
///
/// [`self.file_name()`]: struct.Path.html#method.file_name
///
/// The stem is:
///
@ -1695,7 +1790,9 @@ impl Path {
self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.or(after))
}
/// Extracts the extension of `self.file_name()`, if possible.
/// Extracts the extension of [`self.file_name()`], if possible.
///
/// [`self.file_name()`]: struct.Path.html#method.file_name
///
/// The extension is:
///
@ -1718,9 +1815,12 @@ impl Path {
self.file_name().map(split_file_at_dot).and_then(|(before, after)| before.and(after))
}
/// Creates an owned `PathBuf` with `path` adjoined to `self`.
/// Creates an owned [`PathBuf`] with `path` adjoined to `self`.
///
/// See `PathBuf::push` for more details on what it means to adjoin a path.
/// See [`PathBuf::push`] for more details on what it means to adjoin a path.
///
/// [`PathBuf`]: struct.PathBuf.html
/// [`PathBuf::push`]: struct.PathBuf.html#method.push
///
/// # Examples
///
@ -1740,9 +1840,12 @@ impl Path {
buf
}
/// Creates an owned `PathBuf` like `self` but with the given file name.
/// Creates an owned [`PathBuf`] like `self` but with the given file name.
///
/// See `PathBuf::set_file_name` for more details.
/// See [`PathBuf::set_file_name`] for more details.
///
/// [`PathBuf`]: struct.PathBuf.html
/// [`PathBuf::set_file_name`]: struct.PathBuf.html#method.set_file_name
///
/// # Examples
///
@ -1763,9 +1866,12 @@ impl Path {
buf
}
/// Creates an owned `PathBuf` like `self` but with the given extension.
/// Creates an owned [`PathBuf`] like `self` but with the given extension.
///
/// See `PathBuf::set_extension` for more details.
/// See [`PathBuf::set_extension`] for more details.
///
/// [`PathBuf`]: struct.PathBuf.html
/// [`PathBuf::set_extension`]: struct.PathBuf.html#method.set_extension
///
/// # Examples
///
@ -1813,7 +1919,9 @@ impl Path {
}
}
/// Produce an iterator over the path's components viewed as `OsStr` slices.
/// Produce an iterator over the path's components viewed as [`OsStr`] slices.
///
/// [`OsStr`]: ../ffi/struct.OsStr.html
///
/// # Examples
///
@ -1832,9 +1940,11 @@ impl Path {
Iter { inner: self.components() }
}
/// Returns an object that implements `Display` for safely printing paths
/// Returns an object that implements [`Display`] for safely printing paths
/// that may contain non-Unicode data.
///
/// [`Display`]: ../fmt/trait.Display.html
///
/// # Examples
///
/// ```
@ -1896,11 +2006,13 @@ impl Path {
/// Returns an iterator over the entries within a directory.
///
/// The iterator will yield instances of `io::Result<DirEntry>`. New errors may
/// be encountered after an iterator is initially constructed.
/// The iterator will yield instances of [`io::Result`]`<`[`DirEntry`]`>`. New
/// errors may be encountered after an iterator is initially constructed.
///
/// This is an alias to [`fs::read_dir`].
///
/// [`io::Result`]: ../io/type.Result.html
/// [`DirEntry`]: ../fs/struct.DirEntry.html
/// [`fs::read_dir`]: ../fs/fn.read_dir.html
#[stable(feature = "path_ext", since = "1.5.0")]
pub fn read_dir(&self) -> io::Result<fs::ReadDir> {

View File

@ -9,6 +9,10 @@
// except according to those terms.
extern crate collections;
extern crate libc as collections; //~ ERROR E0259
//~^ NOTE previous import of `collections` here
extern crate libc as collections;
//~^ ERROR E0259
//~| NOTE `collections` was already imported
fn main() {}

View File

@ -10,7 +10,10 @@
trait A<T=Self> {}
fn together_we_will_rule_the_galaxy(son: &A) {} //~ ERROR E0393
fn together_we_will_rule_the_galaxy(son: &A) {}
//~^ ERROR E0393
//~| NOTE missing reference to `T`
//~| NOTE because of the default `Self` reference, type parameters must be specified on object types
fn main() {
}

View File

@ -15,6 +15,9 @@ use std::ops::Add;
fn main() {
let x = &10 as
&Add;
//~^ ERROR the type parameter `RHS` must be explicitly specified in an object type because its default value `Self` references the type `Self`
//~| ERROR the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified
//~^ ERROR E0393
//~| NOTE missing reference to `RHS`
//~| NOTE because of the default `Self` reference, type parameters must be specified on object types
//~| ERROR E0191
//~| NOTE missing associated type `Output` value
}

View File

@ -13,6 +13,8 @@
trait A<T=Self> {}
fn f(a: &A) {}
//~^ ERROR the type parameter `T` must be explicitly specified in an object type because its default value `Self` references the type `Self`
//~^ ERROR E0393
//~| NOTE missing reference to `T`
//~| NOTE because of the default `Self` reference, type parameters must be specified on object types
fn main() {}

View File

@ -13,9 +13,13 @@
use std::ops::{Add, Sub};
type Test = Add +
//~^ ERROR the type parameter `RHS` must be explicitly specified in an object type because its default value `Self` references the type `Self`
//~^^ ERROR the value of the associated type `Output` (from the trait `std::ops::Add`) must be specified [E0191]
//~^ ERROR E0393
//~| NOTE missing reference to `RHS`
//~| NOTE because of the default `Self` reference, type parameters must be specified on object types
//~| ERROR E0191
//~| NOTE missing associated type `Output` value
Sub;
//~^ ERROR only the builtin traits can be used as closure or object bounds
//~^ ERROR E0225
//~| NOTE non-builtin trait used as bounds
fn main() { }

View File

@ -0,0 +1,18 @@
// 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.
extern {
static error_message_count: u32;
}
pub static BAZ: u32 = *&error_message_count;
//~^ ERROR cannot refer to other statics by value
fn main() {}

View File

@ -18,7 +18,7 @@ pub fn main() {
let args: Vec<String> = env::args().collect();
if args.len() >= 2 && args[1] == "signal" {
// Raise a segfault.
unsafe { *(0 as *mut isize) = 0; }
unsafe { *(1 as *mut isize) = 0; }
} else {
let status = Command::new(&args[0]).arg("signal").status().unwrap();
assert!(status.code().is_none());