Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 13 pull requests #36177

Merged
merged 27 commits into from
Sep 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5e22e30
Implement more traits for `std::io::ErrorKind`
tbu- Aug 23, 2016
c2d064e
Restore old ordering of `io::ErrorKind`s
tbu- Aug 24, 2016
f740631
Add test for #28324
apasel422 Aug 28, 2016
9ce47e3
fix git submodule status check
king6cong Aug 29, 2016
987ef78
Fix the test_variadic_ptr fn on printf-less sys
nagisa Aug 29, 2016
f53415f
Unignore the json tests on 32-bit platforms
nagisa Aug 29, 2016
8341f64
Fix run-pass/signal-exit-status to not trigger UB by writing to NULL.
eddyb Aug 30, 2016
ba69bc8
replace `BitAndAssign` example with something more evocative
matthew-piziak Aug 23, 2016
d4ca561
Change E0259 to the new error format
Aug 18, 2016
189dee6
Update E0393 to new error format
swr1bm86 Aug 29, 2016
5b5b853
Update man pages
dns2utf8 Aug 30, 2016
b712f74
Add missing urls into convert module
GuillaumeGomez Aug 28, 2016
3f7432a
Change 'rustc::plugin' to 'rustc_plugin' in doc comment
wdv4758h Aug 31, 2016
96e3103
Improve Path and PathBuf docs
GuillaumeGomez Aug 18, 2016
c75fd78
Rollup merge of #35773 - EugeneGonzalez:master, r=jonathandturner
Aug 31, 2016
4bc5bcd
Rollup merge of #35786 - GuillaumeGomez:paths_doc, r=steveklabnik
Aug 31, 2016
117cbb8
Rollup merge of #35911 - tbu-:pr_io_errorkind_traits, r=alexcrichton
Aug 31, 2016
bfe5129
Rollup merge of #35927 - matthew-piziak:bitandassign-example, r=Guill…
Aug 31, 2016
e845da9
Rollup merge of #36083 - GuillaumeGomez:missing_convert_urls, r=steve…
Aug 31, 2016
1afe1ea
Rollup merge of #36087 - apasel422:issue-28324, r=alexcrichton
Aug 31, 2016
bbb2d1d
Rollup merge of #36098 - king6cong:master, r=alexcrichton
Aug 31, 2016
5dc779b
Rollup merge of #36114 - zjhmale:fix-E0393, r=jonathandturner
Aug 31, 2016
6e045cc
Rollup merge of #36118 - nagisa:windows-has-no-sprint-again, r=brson
Aug 31, 2016
e69d65c
Rollup merge of #36123 - nagisa:unignore-json-tests, r=alexcrichton
Aug 31, 2016
1a1e9b0
Rollup merge of #36129 - eddyb:signal-exit-status, r=alexcrichton
Aug 31, 2016
240d86b
Rollup merge of #36152 - dns2utf8:man_page_date, r=nikomatsakis
Aug 31, 2016
5c97100
Rollup merge of #36169 - wdv4758h:librustc_plugin_docs, r=nikomatsakis
Aug 31, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion man/rustc.1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion man/rustdoc.1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
55 changes: 39 additions & 16 deletions src/libcore/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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
///
Expand All @@ -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) {
Expand All @@ -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.
Expand All @@ -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();
Expand All @@ -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.
Expand All @@ -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.
Expand Down
60 changes: 51 additions & 9 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
12 changes: 8 additions & 4 deletions src/libcoretest/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,16 @@ fn test_unsized_unique() {
}

#[test]
fn test_variadic_fnptr() {
#[allow(warnings)]
// Have a symbol for the test below. It doesn’t 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));
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_plugin/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//!
//! extern crate rustc;
//!
//! use rustc::plugin::Registry;
//! use rustc_plugin::Registry;
//!
//! #[plugin_registrar]
//! pub fn plugin_registrar(reg: &mut Registry) {
Expand Down
6 changes: 5 additions & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
13 changes: 7 additions & 6 deletions src/librustc_typeck/astconv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
3 changes: 0 additions & 3 deletions src/libserialize/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]}"#,
Expand Down Expand Up @@ -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)));
Expand Down Expand Up @@ -3715,7 +3713,6 @@ mod tests {
);
}
#[test]
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
fn test_read_array_streaming() {
assert_stream_equal(
"[]",
Expand Down
7 changes: 5 additions & 2 deletions src/libstd/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
///
Expand Down
5 changes: 3 additions & 2 deletions src/libstd/io/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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",
Expand Down
Loading