Skip to content

Commit

Permalink
Auto merge of #36651 - jonathandturner:rollup, r=jonathandturner
Browse files Browse the repository at this point in the history
Rollup of 7 pull requests

- Successful merges: #36330, #36423, #36539, #36571, #36589, #36600, #36632
- Failed merges:
  • Loading branch information
bors committed Sep 22, 2016
2 parents 458f411 + c1e3938 commit 4c04e36
Show file tree
Hide file tree
Showing 28 changed files with 401 additions and 199 deletions.
470 changes: 310 additions & 160 deletions src/liballoc/rc.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/libcollections/slice.rs
Expand Up @@ -1037,7 +1037,7 @@ impl<T> [T] {
self.sort_by(|a, b| a.cmp(b))
}

/// Sorts the slice, in place, using `key` to extract a key by which to
/// Sorts the slice, in place, using `f` to extract a key by which to
/// order the sort by.
///
/// This sort is stable and `O(n log n)` worst-case but allocates
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/char.rs
Expand Up @@ -800,7 +800,7 @@ pub fn decode_utf8<I: IntoIterator<Item = u8>>(i: I) -> DecodeUtf8<I::IntoIter>

/// `<DecodeUtf8 as Iterator>::next` returns this for an invalid input sequence.
#[unstable(feature = "decode_utf8", issue = "33906")]
#[derive(PartialEq, Debug)]
#[derive(PartialEq, Eq, Debug)]
pub struct InvalidSequence(());

#[unstable(feature = "decode_utf8", issue = "33906")]
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/rt/v1.rs
Expand Up @@ -31,7 +31,7 @@ pub struct FormatSpec {
}

/// Possible alignments that can be requested as part of a formatting directive.
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Eq)]
pub enum Alignment {
/// Indication that contents should be left-aligned.
Left,
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/dec2flt/mod.rs
Expand Up @@ -155,13 +155,13 @@ from_str_float_impl!(f64);
/// [`FromStr`]: ../str/trait.FromStr.html
/// [`f32`]: ../../std/primitive.f32.html
/// [`f64`]: ../../std/primitive.f64.html
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct ParseFloatError {
kind: FloatErrorKind
}

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
enum FloatErrorKind {
Empty,
Invalid,
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/num/flt2dec/decoder.rs
Expand Up @@ -21,7 +21,7 @@ use num::dec2flt::rawfp::RawFloat;
/// - Any number from `(mant - minus) * 2^exp` to `(mant + plus) * 2^exp` will
/// round to the original value. The range is inclusive only when
/// `inclusive` is true.
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct Decoded {
/// The scaled mantissa.
pub mant: u64,
Expand All @@ -38,7 +38,7 @@ pub struct Decoded {
}

/// Decoded unsigned value.
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum FullDecoded {
/// Not-a-number.
Nan,
Expand Down
6 changes: 3 additions & 3 deletions src/libcore/num/mod.rs
Expand Up @@ -2401,7 +2401,7 @@ impl usize {
/// assert_eq!(nan.classify(), FpCategory::Nan);
/// assert_eq!(sub.classify(), FpCategory::Subnormal);
/// ```
#[derive(Copy, Clone, PartialEq, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum FpCategory {
/// "Not a Number", often obtained by dividing by zero.
Expand Down Expand Up @@ -2744,11 +2744,11 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32)
/// on the primitive integer types, such as [`i8::from_str_radix()`].
///
/// [`i8::from_str_radix()`]: ../../std/primitive.i8.html#method.from_str_radix
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct ParseIntError { kind: IntErrorKind }

#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
enum IntErrorKind {
Empty,
InvalidDigit,
Expand Down
10 changes: 4 additions & 6 deletions src/libcore/option.rs
Expand Up @@ -296,16 +296,14 @@ impl<T> Option<T> {

/// Moves the value `v` out of the `Option<T>` if it is `Some(v)`.
///
/// # Panics
///
/// Panics if the self value equals `None`.
///
/// # Safety note
///
/// In general, because this function may panic, its use is discouraged.
/// Instead, prefer to use pattern matching and handle the `None`
/// case explicitly.
///
/// # Panics
///
/// Panics if the self value equals `None`.
///
/// # Examples
///
/// ```
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/str/mod.rs
Expand Up @@ -101,7 +101,7 @@ impl FromStr for bool {
}

/// An error returned when parsing a `bool` from a string fails.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct ParseBoolError { _priv: () }

Expand Down
13 changes: 12 additions & 1 deletion src/librustc_typeck/check/mod.rs
Expand Up @@ -3099,7 +3099,18 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
if let Some(field_name) = Self::suggest_field_name(variant,
&field.name,
skip_fields.collect()) {
err.span_label(field.name.span,&format!("did you mean `{}`?",field_name));
err.span_label(field.name.span,
&format!("field does not exist - did you mean `{}`?", field_name));
} else {
match ty.sty {
ty::TyAdt(adt, ..) if adt.is_enum() => {
err.span_label(field.name.span, &format!("`{}::{}` does not have this field",
ty, variant.name.as_str()));
}
_ => {
err.span_label(field.name.span, &format!("`{}` does not have this field", ty));
}
}
};
err.emit();
}
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/ffi/c_str.rs
Expand Up @@ -146,19 +146,19 @@ pub struct CStr {

/// An error returned from `CString::new` to indicate that a nul byte was found
/// in the vector provided.
#[derive(Clone, PartialEq, Debug)]
#[derive(Clone, PartialEq, Eq, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct NulError(usize, Vec<u8>);

/// An error returned from `CStr::from_bytes_with_nul` to indicate that a nul
/// byte was found too early in the slice provided or one wasn't found at all.
#[derive(Clone, PartialEq, Debug)]
#[derive(Clone, PartialEq, Eq, Debug)]
#[stable(feature = "cstr_from_bytes", since = "1.10.0")]
pub struct FromBytesWithNulError { _a: () }

/// An error returned from `CString::into_string` to indicate that a UTF-8 error
/// was encountered during the conversion.
#[derive(Clone, PartialEq, Debug)]
#[derive(Clone, PartialEq, Eq, Debug)]
#[stable(feature = "cstring_into", since = "1.7.0")]
pub struct IntoStringError {
inner: CString,
Expand Down
4 changes: 2 additions & 2 deletions src/libstd/io/buffered.rs
Expand Up @@ -216,8 +216,8 @@ impl<R: Seek> Seek for BufReader<R> {
///
/// Seeking always discards the internal buffer, even if the seek position
/// would otherwise fall within it. This guarantees that calling
/// `.unwrap()` immediately after a seek yields the underlying reader at
/// the same position.
/// `.into_inner()` immediately after a seek yields the underlying reader
/// at the same position.
///
/// See `std::io::Seek` for more details.
///
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/mod.rs
Expand Up @@ -38,7 +38,7 @@ mod parser;
///
/// [`shutdown`]: struct.TcpStream.html#method.shutdown
/// [`TcpStream`]: struct.TcpStream.html
#[derive(Copy, Clone, PartialEq, Debug)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
#[stable(feature = "rust1", since = "1.0.0")]
pub enum Shutdown {
/// Indicates that the reading portion of this stream/socket should be shut
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/parser.rs
Expand Up @@ -370,7 +370,7 @@ impl FromStr for SocketAddr {

/// An error returned when parsing an IP address or a socket address.
#[stable(feature = "rust1", since = "1.0.0")]
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct AddrParseError(());

#[stable(feature = "addr_parse_error_error", since = "1.4.0")]
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sync/mpsc/select.rs
Expand Up @@ -103,7 +103,7 @@ pub struct Handle<'rx, T:Send+'rx> {
struct Packets { cur: *mut Handle<'static, ()> }

#[doc(hidden)]
#[derive(PartialEq)]
#[derive(PartialEq, Eq)]
pub enum StartResult {
Installed,
Abort,
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/parse/attr.rs
Expand Up @@ -125,8 +125,8 @@ impl<'a> Parser<'a> {

self.expect(&token::OpenDelim(token::Bracket))?;
let meta_item = self.parse_meta_item()?;
let hi = self.last_span.hi;
self.expect(&token::CloseDelim(token::Bracket))?;
let hi = self.last_span.hi;

(mk_sp(lo, hi), meta_item, style)
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/E0559.rs
Expand Up @@ -15,5 +15,5 @@ enum Field {
fn main() {
let s = Field::Fool { joke: 0 };
//~^ ERROR E0559
//~| NOTE did you mean `x`?
//~| NOTE field does not exist - did you mean `x`?
}
Expand Up @@ -13,5 +13,7 @@ struct Simba {
}

fn main() {
let s = Simba { mother: 1, father: 0 }; //~ ERROR E0560
let s = Simba { mother: 1, father: 0 };
//~^ ERROR E0560
//~| NOTE `Simba` does not have this field
}
1 change: 1 addition & 0 deletions src/test/compile-fail/issue-19922.rs
Expand Up @@ -15,4 +15,5 @@ enum Homura {
fn main() {
let homura = Homura::Akemi { kaname: () };
//~^ ERROR variant `Homura::Akemi` has no field named `kaname`
//~| NOTE field does not exist - did you mean `madoka`?
}
8 changes: 6 additions & 2 deletions src/test/compile-fail/numeric-fields.rs
Expand Up @@ -13,8 +13,12 @@
struct S(u8, u16);

fn main() {
let s = S{0b1: 10, 0: 11}; //~ ERROR struct `S` has no field named `0b1`
let s = S{0b1: 10, 0: 11};
//~^ ERROR struct `S` has no field named `0b1`
//~| NOTE field does not exist - did you mean `1`?
match s {
S{0: a, 0x1: b, ..} => {} //~ ERROR does not have a field named `0x1`
S{0: a, 0x1: b, ..} => {}
//~^ ERROR does not have a field named `0x1`
//~| NOTE struct `S::{{constructor}}` does not have field `0x1`
}
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/struct-fields-hints-no-dupe.rs
Expand Up @@ -19,7 +19,7 @@ fn main() {
foo : 5,
bar : 42,
//~^ ERROR struct `A` has no field named `bar`
//~| NOTE did you mean `barr`?
//~| NOTE field does not exist - did you mean `barr`?
car : 9,
};
}
2 changes: 1 addition & 1 deletion src/test/compile-fail/struct-fields-hints.rs
Expand Up @@ -19,6 +19,6 @@ fn main() {
foo : 5,
bar : 42,
//~^ ERROR struct `A` has no field named `bar`
//~| NOTE did you mean `car`?
//~| NOTE field does not exist - did you mean `car`?
};
}
4 changes: 3 additions & 1 deletion src/test/compile-fail/struct-fields-too-many.rs
Expand Up @@ -15,6 +15,8 @@ struct BuildData {
fn main() {
let foo = BuildData {
foo: 0,
bar: 0 //~ ERROR struct `BuildData` has no field named `bar`
bar: 0
//~^ ERROR struct `BuildData` has no field named `bar`
//~| NOTE `BuildData` does not have this field
};
}
8 changes: 4 additions & 4 deletions src/test/compile-fail/suggest-private-fields.rs
Expand Up @@ -24,18 +24,18 @@ fn main () {
let k = B {
aa: 20,
//~^ ERROR struct `xc::B` has no field named `aa`
//~| NOTE did you mean `a`?
//~| NOTE field does not exist - did you mean `a`?
bb: 20,
//~^ ERROR struct `xc::B` has no field named `bb`
//~| NOTE did you mean `a`?
//~| NOTE field does not exist - did you mean `a`?
};
// local crate struct
let l = A {
aa: 20,
//~^ ERROR struct `A` has no field named `aa`
//~| NOTE did you mean `a`?
//~| NOTE field does not exist - did you mean `a`?
bb: 20,
//~^ ERROR struct `A` has no field named `bb`
//~| NOTE did you mean `b`?
//~| NOTE field does not exist - did you mean `b`?
};
}
2 changes: 2 additions & 0 deletions src/test/compile-fail/union/union-fields.rs
Expand Up @@ -21,6 +21,7 @@ fn main() {
let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field
let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field
//~^ ERROR union `U` has no field named `c`
//~| NOTE `U` does not have this field
let u = U { ..u }; //~ ERROR union expressions should have exactly one field
//~^ ERROR functional record update syntax requires a struct

Expand All @@ -29,6 +30,7 @@ fn main() {
let U { a, b } = u; //~ ERROR union patterns should have exactly one field
let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field
//~^ ERROR union `U` does not have a field named `c`
//~| NOTE union `U` does not have field `c`
let U { .. } = u; //~ ERROR union patterns should have exactly one field
//~^ ERROR `..` cannot be used in union patterns
let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/union/union-suggest-field.rs
Expand Up @@ -21,7 +21,7 @@ impl U {
fn main() {
let u = U { principle: 0 };
//~^ ERROR union `U` has no field named `principle`
//~| NOTE did you mean `principal`?
//~| NOTE field does not exist - did you mean `principal`?
let w = u.principial; //~ ERROR attempted access of field `principial` on type `U`
//~^ HELP did you mean `principal`?

Expand Down
14 changes: 14 additions & 0 deletions src/test/ui/span/issue-36530.rs
@@ -0,0 +1,14 @@
// Copyright 2014 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.

#[foo]
mod foo {
#![foo]
}
18 changes: 18 additions & 0 deletions src/test/ui/span/issue-36530.stderr
@@ -0,0 +1,18 @@
error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/issue-36530.rs:11:1
|
11 | #[foo]
| ^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/issue-36530.rs:13:5
|
13 | #![foo]
| ^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: aborting due to 2 previous errors

0 comments on commit 4c04e36

Please sign in to comment.