Skip to content

Commit 4c04e36

Browse files
authored
Auto merge of #36651 - jonathandturner:rollup, r=jonathandturner
Rollup of 7 pull requests - Successful merges: #36330, #36423, #36539, #36571, #36589, #36600, #36632 - Failed merges:
2 parents 458f411 + c1e3938 commit 4c04e36

28 files changed

+401
-199
lines changed

src/liballoc/rc.rs

+310-160
Large diffs are not rendered by default.

src/libcollections/slice.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ impl<T> [T] {
10371037
self.sort_by(|a, b| a.cmp(b))
10381038
}
10391039

1040-
/// Sorts the slice, in place, using `key` to extract a key by which to
1040+
/// Sorts the slice, in place, using `f` to extract a key by which to
10411041
/// order the sort by.
10421042
///
10431043
/// This sort is stable and `O(n log n)` worst-case but allocates

src/libcore/char.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,7 @@ pub fn decode_utf8<I: IntoIterator<Item = u8>>(i: I) -> DecodeUtf8<I::IntoIter>
800800

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

806806
#[unstable(feature = "decode_utf8", issue = "33906")]

src/libcore/fmt/rt/v1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct FormatSpec {
3131
}
3232

3333
/// Possible alignments that can be requested as part of a formatting directive.
34-
#[derive(Copy, Clone, PartialEq)]
34+
#[derive(Copy, Clone, PartialEq, Eq)]
3535
pub enum Alignment {
3636
/// Indication that contents should be left-aligned.
3737
Left,

src/libcore/num/dec2flt/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,13 @@ from_str_float_impl!(f64);
155155
/// [`FromStr`]: ../str/trait.FromStr.html
156156
/// [`f32`]: ../../std/primitive.f32.html
157157
/// [`f64`]: ../../std/primitive.f64.html
158-
#[derive(Debug, Clone, PartialEq)]
158+
#[derive(Debug, Clone, PartialEq, Eq)]
159159
#[stable(feature = "rust1", since = "1.0.0")]
160160
pub struct ParseFloatError {
161161
kind: FloatErrorKind
162162
}
163163

164-
#[derive(Debug, Clone, PartialEq)]
164+
#[derive(Debug, Clone, PartialEq, Eq)]
165165
enum FloatErrorKind {
166166
Empty,
167167
Invalid,

src/libcore/num/flt2dec/decoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ use num::dec2flt::rawfp::RawFloat;
2121
/// - Any number from `(mant - minus) * 2^exp` to `(mant + plus) * 2^exp` will
2222
/// round to the original value. The range is inclusive only when
2323
/// `inclusive` is true.
24-
#[derive(Copy, Clone, Debug, PartialEq)]
24+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
2525
pub struct Decoded {
2626
/// The scaled mantissa.
2727
pub mant: u64,
@@ -38,7 +38,7 @@ pub struct Decoded {
3838
}
3939

4040
/// Decoded unsigned value.
41-
#[derive(Copy, Clone, Debug, PartialEq)]
41+
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
4242
pub enum FullDecoded {
4343
/// Not-a-number.
4444
Nan,

src/libcore/num/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2401,7 +2401,7 @@ impl usize {
24012401
/// assert_eq!(nan.classify(), FpCategory::Nan);
24022402
/// assert_eq!(sub.classify(), FpCategory::Subnormal);
24032403
/// ```
2404-
#[derive(Copy, Clone, PartialEq, Debug)]
2404+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
24052405
#[stable(feature = "rust1", since = "1.0.0")]
24062406
pub enum FpCategory {
24072407
/// "Not a Number", often obtained by dividing by zero.
@@ -2744,11 +2744,11 @@ fn from_str_radix<T: FromStrRadixHelper>(src: &str, radix: u32)
27442744
/// on the primitive integer types, such as [`i8::from_str_radix()`].
27452745
///
27462746
/// [`i8::from_str_radix()`]: ../../std/primitive.i8.html#method.from_str_radix
2747-
#[derive(Debug, Clone, PartialEq)]
2747+
#[derive(Debug, Clone, PartialEq, Eq)]
27482748
#[stable(feature = "rust1", since = "1.0.0")]
27492749
pub struct ParseIntError { kind: IntErrorKind }
27502750

2751-
#[derive(Debug, Clone, PartialEq)]
2751+
#[derive(Debug, Clone, PartialEq, Eq)]
27522752
enum IntErrorKind {
27532753
Empty,
27542754
InvalidDigit,

src/libcore/option.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,14 @@ impl<T> Option<T> {
296296

297297
/// Moves the value `v` out of the `Option<T>` if it is `Some(v)`.
298298
///
299-
/// # Panics
300-
///
301-
/// Panics if the self value equals `None`.
302-
///
303-
/// # Safety note
304-
///
305299
/// In general, because this function may panic, its use is discouraged.
306300
/// Instead, prefer to use pattern matching and handle the `None`
307301
/// case explicitly.
308302
///
303+
/// # Panics
304+
///
305+
/// Panics if the self value equals `None`.
306+
///
309307
/// # Examples
310308
///
311309
/// ```

src/libcore/str/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ impl FromStr for bool {
101101
}
102102

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

src/librustc_typeck/check/mod.rs

+12-1
Original file line numberDiff line numberDiff line change
@@ -3099,7 +3099,18 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
30993099
if let Some(field_name) = Self::suggest_field_name(variant,
31003100
&field.name,
31013101
skip_fields.collect()) {
3102-
err.span_label(field.name.span,&format!("did you mean `{}`?",field_name));
3102+
err.span_label(field.name.span,
3103+
&format!("field does not exist - did you mean `{}`?", field_name));
3104+
} else {
3105+
match ty.sty {
3106+
ty::TyAdt(adt, ..) if adt.is_enum() => {
3107+
err.span_label(field.name.span, &format!("`{}::{}` does not have this field",
3108+
ty, variant.name.as_str()));
3109+
}
3110+
_ => {
3111+
err.span_label(field.name.span, &format!("`{}` does not have this field", ty));
3112+
}
3113+
}
31033114
};
31043115
err.emit();
31053116
}

src/libstd/ffi/c_str.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -146,19 +146,19 @@ pub struct CStr {
146146

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

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

159159
/// An error returned from `CString::into_string` to indicate that a UTF-8 error
160160
/// was encountered during the conversion.
161-
#[derive(Clone, PartialEq, Debug)]
161+
#[derive(Clone, PartialEq, Eq, Debug)]
162162
#[stable(feature = "cstring_into", since = "1.7.0")]
163163
pub struct IntoStringError {
164164
inner: CString,

src/libstd/io/buffered.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ impl<R: Seek> Seek for BufReader<R> {
216216
///
217217
/// Seeking always discards the internal buffer, even if the seek position
218218
/// would otherwise fall within it. This guarantees that calling
219-
/// `.unwrap()` immediately after a seek yields the underlying reader at
220-
/// the same position.
219+
/// `.into_inner()` immediately after a seek yields the underlying reader
220+
/// at the same position.
221221
///
222222
/// See `std::io::Seek` for more details.
223223
///

src/libstd/net/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ mod parser;
3838
///
3939
/// [`shutdown`]: struct.TcpStream.html#method.shutdown
4040
/// [`TcpStream`]: struct.TcpStream.html
41-
#[derive(Copy, Clone, PartialEq, Debug)]
41+
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
4242
#[stable(feature = "rust1", since = "1.0.0")]
4343
pub enum Shutdown {
4444
/// Indicates that the reading portion of this stream/socket should be shut

src/libstd/net/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl FromStr for SocketAddr {
370370

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

376376
#[stable(feature = "addr_parse_error_error", since = "1.4.0")]

src/libstd/sync/mpsc/select.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub struct Handle<'rx, T:Send+'rx> {
103103
struct Packets { cur: *mut Handle<'static, ()> }
104104

105105
#[doc(hidden)]
106-
#[derive(PartialEq)]
106+
#[derive(PartialEq, Eq)]
107107
pub enum StartResult {
108108
Installed,
109109
Abort,

src/libsyntax/parse/attr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ impl<'a> Parser<'a> {
125125

126126
self.expect(&token::OpenDelim(token::Bracket))?;
127127
let meta_item = self.parse_meta_item()?;
128-
let hi = self.last_span.hi;
129128
self.expect(&token::CloseDelim(token::Bracket))?;
129+
let hi = self.last_span.hi;
130130

131131
(mk_sp(lo, hi), meta_item, style)
132132
}

src/test/compile-fail/E0559.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ enum Field {
1515
fn main() {
1616
let s = Field::Fool { joke: 0 };
1717
//~^ ERROR E0559
18-
//~| NOTE did you mean `x`?
18+
//~| NOTE field does not exist - did you mean `x`?
1919
}

src/test/compile-fail/E560.rs renamed to src/test/compile-fail/E0560.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,7 @@ struct Simba {
1313
}
1414

1515
fn main() {
16-
let s = Simba { mother: 1, father: 0 }; //~ ERROR E0560
16+
let s = Simba { mother: 1, father: 0 };
17+
//~^ ERROR E0560
18+
//~| NOTE `Simba` does not have this field
1719
}

src/test/compile-fail/issue-19922.rs

+1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ enum Homura {
1515
fn main() {
1616
let homura = Homura::Akemi { kaname: () };
1717
//~^ ERROR variant `Homura::Akemi` has no field named `kaname`
18+
//~| NOTE field does not exist - did you mean `madoka`?
1819
}

src/test/compile-fail/numeric-fields.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,12 @@
1313
struct S(u8, u16);
1414

1515
fn main() {
16-
let s = S{0b1: 10, 0: 11}; //~ ERROR struct `S` has no field named `0b1`
16+
let s = S{0b1: 10, 0: 11};
17+
//~^ ERROR struct `S` has no field named `0b1`
18+
//~| NOTE field does not exist - did you mean `1`?
1719
match s {
18-
S{0: a, 0x1: b, ..} => {} //~ ERROR does not have a field named `0x1`
20+
S{0: a, 0x1: b, ..} => {}
21+
//~^ ERROR does not have a field named `0x1`
22+
//~| NOTE struct `S::{{constructor}}` does not have field `0x1`
1923
}
2024
}

src/test/compile-fail/struct-fields-hints-no-dupe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() {
1919
foo : 5,
2020
bar : 42,
2121
//~^ ERROR struct `A` has no field named `bar`
22-
//~| NOTE did you mean `barr`?
22+
//~| NOTE field does not exist - did you mean `barr`?
2323
car : 9,
2424
};
2525
}

src/test/compile-fail/struct-fields-hints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ fn main() {
1919
foo : 5,
2020
bar : 42,
2121
//~^ ERROR struct `A` has no field named `bar`
22-
//~| NOTE did you mean `car`?
22+
//~| NOTE field does not exist - did you mean `car`?
2323
};
2424
}

src/test/compile-fail/struct-fields-too-many.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ struct BuildData {
1515
fn main() {
1616
let foo = BuildData {
1717
foo: 0,
18-
bar: 0 //~ ERROR struct `BuildData` has no field named `bar`
18+
bar: 0
19+
//~^ ERROR struct `BuildData` has no field named `bar`
20+
//~| NOTE `BuildData` does not have this field
1921
};
2022
}

src/test/compile-fail/suggest-private-fields.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,18 @@ fn main () {
2424
let k = B {
2525
aa: 20,
2626
//~^ ERROR struct `xc::B` has no field named `aa`
27-
//~| NOTE did you mean `a`?
27+
//~| NOTE field does not exist - did you mean `a`?
2828
bb: 20,
2929
//~^ ERROR struct `xc::B` has no field named `bb`
30-
//~| NOTE did you mean `a`?
30+
//~| NOTE field does not exist - did you mean `a`?
3131
};
3232
// local crate struct
3333
let l = A {
3434
aa: 20,
3535
//~^ ERROR struct `A` has no field named `aa`
36-
//~| NOTE did you mean `a`?
36+
//~| NOTE field does not exist - did you mean `a`?
3737
bb: 20,
3838
//~^ ERROR struct `A` has no field named `bb`
39-
//~| NOTE did you mean `b`?
39+
//~| NOTE field does not exist - did you mean `b`?
4040
};
4141
}

src/test/compile-fail/union/union-fields.rs

+2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ fn main() {
2121
let u = U { a: 0, b: 1 }; //~ ERROR union expressions should have exactly one field
2222
let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field
2323
//~^ ERROR union `U` has no field named `c`
24+
//~| NOTE `U` does not have this field
2425
let u = U { ..u }; //~ ERROR union expressions should have exactly one field
2526
//~^ ERROR functional record update syntax requires a struct
2627

@@ -29,6 +30,7 @@ fn main() {
2930
let U { a, b } = u; //~ ERROR union patterns should have exactly one field
3031
let U { a, b, c } = u; //~ ERROR union patterns should have exactly one field
3132
//~^ ERROR union `U` does not have a field named `c`
33+
//~| NOTE union `U` does not have field `c`
3234
let U { .. } = u; //~ ERROR union patterns should have exactly one field
3335
//~^ ERROR `..` cannot be used in union patterns
3436
let U { a, .. } = u; //~ ERROR `..` cannot be used in union patterns

src/test/compile-fail/union/union-suggest-field.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl U {
2121
fn main() {
2222
let u = U { principle: 0 };
2323
//~^ ERROR union `U` has no field named `principle`
24-
//~| NOTE did you mean `principal`?
24+
//~| NOTE field does not exist - did you mean `principal`?
2525
let w = u.principial; //~ ERROR attempted access of field `principial` on type `U`
2626
//~^ HELP did you mean `principal`?
2727

src/test/ui/span/issue-36530.rs

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#[foo]
12+
mod foo {
13+
#![foo]
14+
}

src/test/ui/span/issue-36530.stderr

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
2+
--> $DIR/issue-36530.rs:11:1
3+
|
4+
11 | #[foo]
5+
| ^^^^^^
6+
|
7+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
8+
9+
error: The attribute `foo` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
10+
--> $DIR/issue-36530.rs:13:5
11+
|
12+
13 | #![foo]
13+
| ^^^^^^^
14+
|
15+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
16+
17+
error: aborting due to 2 previous errors
18+

0 commit comments

Comments
 (0)