Skip to content

Commit 3135b78

Browse files
authored
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:
2 parents 2c01bb8 + 5c97100 commit 3135b78

File tree

20 files changed

+309
-88
lines changed

20 files changed

+309
-88
lines changed

man/rustc.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH RUSTC "1" "August 2016" "rustc 1.12.0" "User Commands"
1+
.TH RUSTC "1" "September 2016" "rustc 1.13.0" "User Commands"
22
.SH NAME
33
rustc \- The Rust compiler
44
.SH SYNOPSIS

man/rustdoc.1

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH RUSTDOC "1" "August 2016" "rustdoc 1.12.0" "User Commands"
1+
.TH RUSTDOC "1" "September 2016" "rustdoc 1.13.0" "User Commands"
22
.SH NAME
33
rustdoc \- generate documentation from Rust source code
44
.SH SYNOPSIS

src/bootstrap/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ impl Build {
528528
let path = Path::new(line[1..].split(' ').skip(1).next().unwrap());
529529
let state = if line.starts_with('-') {
530530
State::NotInitialized
531-
} else if line.starts_with('*') {
531+
} else if line.starts_with('+') {
532532
State::OutOfSync
533533
} else if line.starts_with(' ') {
534534
State::MaybeDirty

src/libcore/convert.rs

+39-16
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,23 @@
4242

4343
/// A cheap, reference-to-reference conversion.
4444
///
45-
/// `AsRef` is very similar to, but different than, `Borrow`. See
45+
/// `AsRef` is very similar to, but different than, [`Borrow`]. See
4646
/// [the book][book] for more.
4747
///
4848
/// [book]: ../../book/borrow-and-asref.html
49+
/// [`Borrow`]: ../../std/borrow/trait.Borrow.html
4950
///
5051
/// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which
51-
/// returns an `Option<T>` or a `Result<T, E>`.
52+
/// returns an [`Option<T>`] or a [`Result<T, E>`].
53+
///
54+
/// [`Option<T>`]: ../../std/option/enum.Option.html
55+
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
5256
///
5357
/// # Examples
5458
///
55-
/// Both `String` and `&str` implement `AsRef<str>`:
59+
/// Both [`String`] and `&str` implement `AsRef<str>`:
60+
///
61+
/// [`String`]: ../../std/string/struct.String.html
5662
///
5763
/// ```
5864
/// fn is_hello<T: AsRef<str>>(s: T) {
@@ -81,7 +87,10 @@ pub trait AsRef<T: ?Sized> {
8187
/// A cheap, mutable reference-to-mutable reference conversion.
8288
///
8389
/// **Note: this trait must not fail**. If the conversion can fail, use a dedicated method which
84-
/// returns an `Option<T>` or a `Result<T, E>`.
90+
/// returns an [`Option<T>`] or a [`Result<T, E>`].
91+
///
92+
/// [`Option<T>`]: ../../std/option/enum.Option.html
93+
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
8594
///
8695
/// # Generic Impls
8796
///
@@ -97,16 +106,16 @@ pub trait AsMut<T: ?Sized> {
97106

98107
/// A conversion that consumes `self`, which may or may not be expensive.
99108
///
100-
/// **Note: this trait must not fail**. If the conversion can fail, use `TryInto` or a dedicated
101-
/// method which returns an `Option<T>` or a `Result<T, E>`.
109+
/// **Note: this trait must not fail**. If the conversion can fail, use [`TryInto`] or a dedicated
110+
/// method which returns an [`Option<T>`] or a [`Result<T, E>`].
102111
///
103112
/// Library authors should not directly implement this trait, but should prefer implementing
104-
/// the `From` trait, which offers greater flexibility and provides an equivalent `Into`
113+
/// the [`From`][From] trait, which offers greater flexibility and provides an equivalent `Into`
105114
/// implementation for free, thanks to a blanket implementation in the standard library.
106115
///
107116
/// # Examples
108117
///
109-
/// `String` implements `Into<Vec<u8>>`:
118+
/// [`String`] implements `Into<Vec<u8>>`:
110119
///
111120
/// ```
112121
/// fn is_hello<T: Into<Vec<u8>>>(s: T) {
@@ -120,9 +129,15 @@ pub trait AsMut<T: ?Sized> {
120129
///
121130
/// # Generic Impls
122131
///
123-
/// - `From<T> for U` implies `Into<U> for T`
124-
/// - `into()` is reflexive, which means that `Into<T> for T` is implemented
132+
/// - `[From<T>][From] for U` implies `Into<U> for T`
133+
/// - [`into()`] is reflexive, which means that `Into<T> for T` is implemented
125134
///
135+
/// [`TryInto`]: trait.TryInto.html
136+
/// [`Option<T>`]: ../../std/option/enum.Option.html
137+
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
138+
/// [`String`]: ../../std/string/struct.String.html
139+
/// [From]: trait.From.html
140+
/// [`into()`]: trait.Into.html#tymethod.into
126141
#[stable(feature = "rust1", since = "1.0.0")]
127142
pub trait Into<T>: Sized {
128143
/// Performs the conversion.
@@ -132,12 +147,12 @@ pub trait Into<T>: Sized {
132147

133148
/// Construct `Self` via a conversion.
134149
///
135-
/// **Note: this trait must not fail**. If the conversion can fail, use `TryFrom` or a dedicated
136-
/// method which returns an `Option<T>` or a `Result<T, E>`.
150+
/// **Note: this trait must not fail**. If the conversion can fail, use [`TryFrom`] or a dedicated
151+
/// method which returns an [`Option<T>`] or a [`Result<T, E>`].
137152
///
138153
/// # Examples
139154
///
140-
/// `String` implements `From<&str>`:
155+
/// [`String`] implements `From<&str>`:
141156
///
142157
/// ```
143158
/// let string = "hello".to_string();
@@ -147,9 +162,15 @@ pub trait Into<T>: Sized {
147162
/// ```
148163
/// # Generic impls
149164
///
150-
/// - `From<T> for U` implies `Into<U> for T`
151-
/// - `from()` is reflexive, which means that `From<T> for T` is implemented
165+
/// - `From<T> for U` implies `[Into<U>] for T`
166+
/// - [`from()`] is reflexive, which means that `From<T> for T` is implemented
152167
///
168+
/// [`TryFrom`]: trait.TryFrom.html
169+
/// [`Option<T>`]: ../../std/option/enum.Option.html
170+
/// [`Result<T, E>`]: ../../std/result/enum.Result.html
171+
/// [`String`]: ../../std/string/struct.String.html
172+
/// [Into<U>]: trait.Into.html
173+
/// [`from()`]: trait.From.html#tymethod.from
153174
#[stable(feature = "rust1", since = "1.0.0")]
154175
pub trait From<T>: Sized {
155176
/// Performs the conversion.
@@ -160,8 +181,10 @@ pub trait From<T>: Sized {
160181
/// An attempted conversion that consumes `self`, which may or may not be expensive.
161182
///
162183
/// Library authors should not directly implement this trait, but should prefer implementing
163-
/// the `TryFrom` trait, which offers greater flexibility and provides an equivalent `TryInto`
184+
/// the [`TryFrom`] trait, which offers greater flexibility and provides an equivalent `TryInto`
164185
/// implementation for free, thanks to a blanket implementation in the standard library.
186+
///
187+
/// [`TryFrom`]: trait.TryFrom.html
165188
#[unstable(feature = "try_from", issue = "33417")]
166189
pub trait TryInto<T>: Sized {
167190
/// The type returned in the event of a conversion error.

src/libcore/ops.rs

+51-9
Original file line numberDiff line numberDiff line change
@@ -1564,24 +1564,66 @@ rem_assign_impl! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 f32 f64 }
15641564
///
15651565
/// # Examples
15661566
///
1567-
/// A trivial implementation of `BitAndAssign`. When `Foo &= Foo` happens, it ends up
1568-
/// calling `bitand_assign`, and therefore, `main` prints `Bitwise And-ing!`.
1567+
/// In this example, the `&=` operator is lifted to a trivial `Scalar` type.
15691568
///
15701569
/// ```
15711570
/// use std::ops::BitAndAssign;
15721571
///
1573-
/// struct Foo;
1572+
/// #[derive(Debug, PartialEq)]
1573+
/// struct Scalar(bool);
15741574
///
1575-
/// impl BitAndAssign for Foo {
1576-
/// fn bitand_assign(&mut self, _rhs: Foo) {
1577-
/// println!("Bitwise And-ing!");
1575+
/// impl BitAndAssign for Scalar {
1576+
/// // rhs is the "right-hand side" of the expression `a &= b`
1577+
/// fn bitand_assign(&mut self, rhs: Self) {
1578+
/// *self = Scalar(self.0 & rhs.0)
15781579
/// }
15791580
/// }
15801581
///
1581-
/// # #[allow(unused_assignments)]
15821582
/// fn main() {
1583-
/// let mut foo = Foo;
1584-
/// foo &= Foo;
1583+
/// let mut scalar = Scalar(true);
1584+
/// scalar &= Scalar(true);
1585+
/// assert_eq!(scalar, Scalar(true));
1586+
///
1587+
/// let mut scalar = Scalar(true);
1588+
/// scalar &= Scalar(false);
1589+
/// assert_eq!(scalar, Scalar(false));
1590+
///
1591+
/// let mut scalar = Scalar(false);
1592+
/// scalar &= Scalar(true);
1593+
/// assert_eq!(scalar, Scalar(false));
1594+
///
1595+
/// let mut scalar = Scalar(false);
1596+
/// scalar &= Scalar(false);
1597+
/// assert_eq!(scalar, Scalar(false));
1598+
/// }
1599+
/// ```
1600+
///
1601+
/// In this example, the `BitAndAssign` trait is implemented for a
1602+
/// `BooleanVector` struct.
1603+
///
1604+
/// ```
1605+
/// use std::ops::BitAndAssign;
1606+
///
1607+
/// #[derive(Debug, PartialEq)]
1608+
/// struct BooleanVector(Vec<bool>);
1609+
///
1610+
/// impl BitAndAssign for BooleanVector {
1611+
/// // rhs is the "right-hand side" of the expression `a &= b`
1612+
/// fn bitand_assign(&mut self, rhs: Self) {
1613+
/// assert_eq!(self.0.len(), rhs.0.len());
1614+
/// *self = BooleanVector(self.0
1615+
/// .iter()
1616+
/// .zip(rhs.0.iter())
1617+
/// .map(|(x, y)| *x && *y)
1618+
/// .collect());
1619+
/// }
1620+
/// }
1621+
///
1622+
/// fn main() {
1623+
/// let mut bv = BooleanVector(vec![true, true, false, false]);
1624+
/// bv &= BooleanVector(vec![true, false, true, false]);
1625+
/// let expected = BooleanVector(vec![true, false, false, false]);
1626+
/// assert_eq!(bv, expected);
15851627
/// }
15861628
/// ```
15871629
#[lang = "bitand_assign"]

src/libcoretest/ptr.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,16 @@ fn test_unsized_unique() {
173173
}
174174

175175
#[test]
176-
fn test_variadic_fnptr() {
176+
#[allow(warnings)]
177+
// Have a symbol for the test below. It doesn’t need to be an actual variadic function, match the
178+
// ABI, or even point to an actual executable code, because the function itself is never invoked.
179+
#[no_mangle]
180+
pub fn test_variadic_fnptr() {
177181
use core::hash::{Hash, SipHasher};
178-
extern "C" {
179-
fn printf(_: *const u8, ...);
182+
extern {
183+
fn test_variadic_fnptr(_: u64, ...) -> f64;
180184
}
181-
let p: unsafe extern "C" fn(*const u8, ...) = printf;
185+
let p: unsafe extern fn(u64, ...) -> f64 = test_variadic_fnptr;
182186
let q = p.clone();
183187
assert_eq!(p, q);
184188
assert!(!(p < q));

src/librustc_plugin/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
//!
2828
//! extern crate rustc;
2929
//!
30-
//! use rustc::plugin::Registry;
30+
//! use rustc_plugin::Registry;
3131
//!
3232
//! #[plugin_registrar]
3333
//! pub fn plugin_registrar(reg: &mut Registry) {

src/librustc_resolve/lib.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -3349,7 +3349,11 @@ impl<'a> Resolver<'a> {
33493349
};
33503350

33513351
let mut err = match (old_binding.is_extern_crate(), binding.is_extern_crate()) {
3352-
(true, true) => struct_span_err!(self.session, span, E0259, "{}", msg),
3352+
(true, true) => {
3353+
let mut e = struct_span_err!(self.session, span, E0259, "{}", msg);
3354+
e.span_label(span, &format!("`{}` was already imported", name));
3355+
e
3356+
},
33533357
(true, _) | (_, true) if binding.is_import() || old_binding.is_import() => {
33543358
let mut e = struct_span_err!(self.session, span, E0254, "{}", msg);
33553359
e.span_label(span, &"already imported");

src/librustc_typeck/astconv.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
515515
// defaults. This will lead to an ICE if we are not
516516
// careful!
517517
if default_needs_object_self(def) {
518-
span_err!(tcx.sess, span, E0393,
519-
"the type parameter `{}` must be explicitly specified \
520-
in an object type because its default value `{}` references \
521-
the type `Self`",
522-
def.name,
523-
default);
518+
struct_span_err!(tcx.sess, span, E0393,
519+
"the type parameter `{}` must be explicitly specified",
520+
def.name)
521+
.span_label(span, &format!("missing reference to `{}`", def.name))
522+
.note(&format!("because of the default `Self` reference, \
523+
type parameters must be specified on object types"))
524+
.emit();
524525
tcx.types.err
525526
} else {
526527
// This is a default type parameter.

src/libserialize/json.rs

-3
Original file line numberDiff line numberDiff line change
@@ -3592,7 +3592,6 @@ mod tests {
35923592
}
35933593
}
35943594
#[test]
3595-
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
35963595
fn test_streaming_parser() {
35973596
assert_stream_equal(
35983597
r#"{ "foo":"bar", "array" : [0, 1, 2, 3, 4, 5], "idents":[null,true,false]}"#,
@@ -3631,7 +3630,6 @@ mod tests {
36313630
}
36323631

36333632
#[test]
3634-
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
36353633
fn test_read_object_streaming() {
36363634
assert_eq!(last_event("{ "), Error(SyntaxError(EOFWhileParsingObject, 1, 3)));
36373635
assert_eq!(last_event("{1"), Error(SyntaxError(KeyMustBeAString, 1, 2)));
@@ -3715,7 +3713,6 @@ mod tests {
37153713
);
37163714
}
37173715
#[test]
3718-
#[cfg_attr(target_pointer_width = "32", ignore)] // FIXME(#14064)
37193716
fn test_read_array_streaming() {
37203717
assert_stream_equal(
37213718
"[]",

src/libstd/fs.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,11 @@ pub fn remove_dir_all<P: AsRef<Path>>(path: P) -> io::Result<()> {
15101510

15111511
/// Returns an iterator over the entries within a directory.
15121512
///
1513-
/// The iterator will yield instances of `io::Result<DirEntry>`. New errors may
1514-
/// be encountered after an iterator is initially constructed.
1513+
/// The iterator will yield instances of [`io::Result`]`<`[`DirEntry`]`>`.
1514+
/// New errors may be encountered after an iterator is initially constructed.
1515+
///
1516+
/// [`io::Result`]: ../io/type.Result.html
1517+
/// [`DirEntry`]: struct.DirEntry.html
15151518
///
15161519
/// # Platform-specific behavior
15171520
///

src/libstd/io/error.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ struct Custom {
7979
/// It is used with the [`io::Error`] type.
8080
///
8181
/// [`io::Error`]: struct.Error.html
82-
#[derive(Copy, PartialEq, Eq, Clone, Debug)]
82+
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
8383
#[stable(feature = "rust1", since = "1.0.0")]
8484
#[allow(deprecated)]
8585
pub enum ErrorKind {
@@ -161,7 +161,8 @@ pub enum ErrorKind {
161161
#[stable(feature = "read_exact", since = "1.6.0")]
162162
UnexpectedEof,
163163

164-
/// Any I/O error not part of this list.
164+
/// A marker variant that tells the compiler that users of this enum cannot
165+
/// match it exhaustively.
165166
#[unstable(feature = "io_error_internals",
166167
reason = "better expressed through extensible enums that this \
167168
enum cannot be exhaustively matched against",

0 commit comments

Comments
 (0)