diff options
| author | Michael Goulet <michael@errs.io> | 2025-02-13 03:07:18 +0000 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2025-02-14 00:27:17 -0800 |
| commit | f6406dfd4efceb6f713e503aecda587304135ed9 (patch) | |
| tree | a31b524ba2341d65c7985016a94db014d7459b52 | |
| parent | b480a9214a7037813d29bc04d9e9dbe92ce10cf3 (diff) | |
| download | rust-f6406dfd4efceb6f713e503aecda587304135ed9.tar.gz rust-f6406dfd4efceb6f713e503aecda587304135ed9.zip | |
Consider add-prefix replacements too
44 files changed, 222 insertions, 330 deletions
diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 4a186565a7b..855b9734cdc 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -236,9 +236,10 @@ impl SubstitutionPart { /// it with "abx" is, since the "c" character is lost. pub fn is_destructive_replacement(&self, sm: &SourceMap) -> bool { self.is_replacement(sm) - && !sm - .span_to_snippet(self.span) - .is_ok_and(|snippet| self.snippet.trim_start().starts_with(snippet.trim_start())) + && !sm.span_to_snippet(self.span).is_ok_and(|snippet| { + self.snippet.trim_start().starts_with(snippet.trim_start()) + || self.snippet.trim_end().ends_with(snippet.trim_end()) + }) } fn replaces_meaningful_content(&self, sm: &SourceMap) -> bool { diff --git a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr index f717343122e..87084e60237 100644 --- a/tests/ui/closures/2229_closure_analysis/issue-118144.stderr +++ b/tests/ui/closures/2229_closure_analysis/issue-118144.stderr @@ -8,9 +8,8 @@ LL | V(x) = func_arg; | help: consider dereferencing to access the inner value using the Deref trait | -LL - V(x) = func_arg; -LL + V(x) = &*func_arg; - | +LL | V(x) = &*func_arg; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/empty/empty-struct-braces-expr.stderr b/tests/ui/empty/empty-struct-braces-expr.stderr index 140b6e009b7..cdedb3f20aa 100644 --- a/tests/ui/empty/empty-struct-braces-expr.stderr +++ b/tests/ui/empty/empty-struct-braces-expr.stderr @@ -125,9 +125,8 @@ LL | let xe3 = XE::Empty3; | help: there is a variant with a similar name | -LL - let xe3 = XE::Empty3; -LL + let xe3 = XE::XEmpty3; - | +LL | let xe3 = XE::XEmpty3; + | ~~~~~~~ error[E0599]: no variant or associated item named `Empty3` found for enum `empty_struct::XE` in the current scope --> $DIR/empty-struct-braces-expr.rs:26:19 diff --git a/tests/ui/env-macro/error-recovery-issue-55897.stderr b/tests/ui/env-macro/error-recovery-issue-55897.stderr index cda9aa330d2..5a20bf8b168 100644 --- a/tests/ui/env-macro/error-recovery-issue-55897.stderr +++ b/tests/ui/env-macro/error-recovery-issue-55897.stderr @@ -30,9 +30,8 @@ LL | use env; | help: consider importing this module instead | -LL - use env; -LL + use std::env; - | +LL | use std::env; + | ~~~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/error-codes/E0027.stderr b/tests/ui/error-codes/E0027.stderr index 701e636dc58..4a102629ad5 100644 --- a/tests/ui/error-codes/E0027.stderr +++ b/tests/ui/error-codes/E0027.stderr @@ -6,19 +6,16 @@ LL | Dog { age: x } => {} | help: include the missing field in the pattern | -LL - Dog { age: x } => {} -LL + Dog { age: x, name } => {} - | +LL | Dog { age: x, name } => {} + | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Dog { age: x } => {} -LL + Dog { age: x, name: _ } => {} - | +LL | Dog { age: x, name: _ } => {} + | ~~~~~~~~~~~ help: or always ignore missing fields here | -LL - Dog { age: x } => {} -LL + Dog { age: x, .. } => {} - | +LL | Dog { age: x, .. } => {} + | ~~~~~~ error[E0027]: pattern does not mention field `age` --> $DIR/E0027.rs:15:9 diff --git a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr index 7271ca48877..a50e5f2f73d 100644 --- a/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr +++ b/tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr @@ -95,9 +95,8 @@ LL | extern "rust-call" fn call(self, args: ()) -> () {} found signature `extern "rust-call" fn(Foo, ()) -> ()` help: change the self-receiver type to match the trait | -LL - extern "rust-call" fn call(self, args: ()) -> () {} -LL + extern "rust-call" fn call(&self, args: ()) -> () {} - | +LL | extern "rust-call" fn call(&self, args: ()) -> () {} + | ~~~~~ error[E0183]: manual implementations of `FnOnce` are experimental --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:18:6 diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr index c9cfe769aeb..414eeee0fed 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2015.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | ~~~~~~~~ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr index c9cfe769aeb..414eeee0fed 100644 --- a/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr +++ b/tests/ui/imports/suggest-import-issue-120074.edition2021.stderr @@ -6,9 +6,8 @@ LL | println!("Hello, {}!", crate::bar::do_the_thing); | help: a similar path exists | -LL - println!("Hello, {}!", crate::bar::do_the_thing); -LL + println!("Hello, {}!", crate::foo::bar::do_the_thing); - | +LL | println!("Hello, {}!", crate::foo::bar::do_the_thing); + | ~~~~~~~~ help: consider importing this module | LL + use foo::bar; diff --git a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr index 713a19f6cb0..3c19b68cffb 100644 --- a/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr +++ b/tests/ui/issues/issue-57741-dereference-boxed-value/issue-57741.stderr @@ -10,9 +10,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:20:19 @@ -26,9 +25,8 @@ LL | T::A(a) | T::B(a) => a, found enum `T` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:9 @@ -42,9 +40,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error[E0308]: mismatched types --> $DIR/issue-57741.rs:27:22 @@ -58,9 +55,8 @@ LL | S::A { a } | S::B { b: a } => a, found enum `S` help: consider dereferencing the boxed value | -LL - let y = match x { -LL + let y = match *x { - | +LL | let y = match *x { + | ~~ error: aborting due to 4 previous errors diff --git a/tests/ui/let-else/let-else-deref-coercion.stderr b/tests/ui/let-else/let-else-deref-coercion.stderr index 07347af76e4..da8b1f4c48e 100644 --- a/tests/ui/let-else/let-else-deref-coercion.stderr +++ b/tests/ui/let-else/let-else-deref-coercion.stderr @@ -8,9 +8,8 @@ LL | let Bar::Present(z) = self else { | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar::Present(z) = self else { -LL + let Bar::Present(z) = &**self else { - | +LL | let Bar::Present(z) = &**self else { + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/let-else-deref-coercion.rs:68:13 @@ -22,9 +21,8 @@ LL | let Bar(z) = x; | help: consider dereferencing to access the inner value using the Deref trait | -LL - let Bar(z) = x; -LL + let Bar(z) = &**x; - | +LL | let Bar(z) = &**x; + | ~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/lexer/lex-bad-char-literals-1.stderr b/tests/ui/lexer/lex-bad-char-literals-1.stderr index 49683c10237..bf13df90be3 100644 --- a/tests/ui/lexer/lex-bad-char-literals-1.stderr +++ b/tests/ui/lexer/lex-bad-char-literals-1.stderr @@ -32,9 +32,8 @@ LL | "\●" = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - "\●" -LL + r"\●" - | +LL | r"\●" + | ~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/lifetimes/borrowck-let-suggestion.stderr b/tests/ui/lifetimes/borrowck-let-suggestion.stderr index e0adb164140..cca7f52957e 100644 --- a/tests/ui/lifetimes/borrowck-let-suggestion.stderr +++ b/tests/ui/lifetimes/borrowck-let-suggestion.stderr @@ -12,9 +12,8 @@ LL | x.use_mut(); = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider consuming the `Vec<i32>` when turning it into an `Iterator` | -LL - let mut x = vec![1].iter(); -LL + let mut x = vec![1].into_iter(); - | +LL | let mut x = vec![1].into_iter(); + | ~~~~~~~~~ help: consider using a `let` binding to create a longer lived value | LL ~ let binding = vec![1]; diff --git a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr index aeee69ae7af..1f528bdb28f 100644 --- a/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr +++ b/tests/ui/lint/lint-strict-provenance-lossy-casts.stderr @@ -25,9 +25,8 @@ LL | let addr_32bit = &x as *const u8 as u32; = help: if you can't comply with strict provenance and need to expose the pointer provenance you can use `.expose_provenance()` instead help: use `.addr()` to obtain the address of a pointer | -LL - let addr_32bit = &x as *const u8 as u32; -LL + let addr_32bit = (&x as *const u8).addr() as u32; - | +LL | let addr_32bit = (&x as *const u8).addr() as u32; + | + ~~~~~~~~~~~~~~~ error: under strict provenance it is considered bad style to cast pointer `*const u8` to integer `usize` --> $DIR/lint-strict-provenance-lossy-casts.rs:14:20 diff --git a/tests/ui/match/issue-56685.stderr b/tests/ui/match/issue-56685.stderr index 9655a380811..ccf357d4aa0 100644 --- a/tests/ui/match/issue-56685.stderr +++ b/tests/ui/match/issue-56685.stderr @@ -11,9 +11,8 @@ LL | #![deny(unused_variables)] | ^^^^^^^^^^^^^^^^ help: if this is intentional, prefix it with an underscore | -LL - E::A(x) | E::B(x) => {} -LL + E::A(_x) | E::B(_x) => {} - | +LL | E::A(_x) | E::B(_x) => {} + | ~~ ~~ error: unused variable: `x` --> $DIR/issue-56685.rs:25:14 @@ -23,9 +22,8 @@ LL | F::A(x, y) | F::B(x, y) => { y }, | help: if this is intentional, prefix it with an underscore | -LL - F::A(x, y) | F::B(x, y) => { y }, -LL + F::A(_x, y) | F::B(_x, y) => { y }, - | +LL | F::A(_x, y) | F::B(_x, y) => { y }, + | ~~ ~~ error: unused variable: `a` --> $DIR/issue-56685.rs:27:14 @@ -47,9 +45,8 @@ LL | let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - let _ = if let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | let _ = if let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ~~ ~~ error: unused variable: `x` --> $DIR/issue-56685.rs:39:20 @@ -59,9 +56,8 @@ LL | while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { | help: if this is intentional, prefix it with an underscore | -LL - while let F::A(x, y) | F::B(x, y) = F::A(1, 2) { -LL + while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { - | +LL | while let F::A(_x, y) | F::B(_x, y) = F::A(1, 2) { + | ~~ ~~ error: aborting due to 6 previous errors diff --git a/tests/ui/mismatched_types/issue-112036.stderr b/tests/ui/mismatched_types/issue-112036.stderr index 29559980cb4..bd446b3d78c 100644 --- a/tests/ui/mismatched_types/issue-112036.stderr +++ b/tests/ui/mismatched_types/issue-112036.stderr @@ -8,9 +8,8 @@ LL | fn drop(self) {} found signature `fn(Foo)` help: change the self-receiver type to match the trait | -LL - fn drop(self) {} -LL + fn drop(&mut self) {} - | +LL | fn drop(&mut self) {} + | ~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index 41891c5144b..b80363fe8f8 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -10,9 +10,8 @@ LL | check(m1::S); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(m1::S); -LL + check(m1::TS); - | +LL | check(m1::TS); + | ~~ help: consider importing one of these constants instead | LL + use m2::S; @@ -39,9 +38,8 @@ LL | pub struct TS(); = note: can't use a type alias as a constructor help: a tuple struct with a similar name exists | -LL - check(xm1::S); -LL + check(xm1::TS); - | +LL | check(xm1::TS); + | ~~ help: consider importing one of these constants instead | LL + use m2::S; @@ -66,9 +64,8 @@ LL | check(m7::V); = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(m7::V); -LL + check(m7::TV); - | +LL | check(m7::TV); + | ~~ help: consider importing one of these constants instead | LL + use m8::V; @@ -95,9 +92,8 @@ LL | TV(), = note: can't use a type alias as a constructor help: a tuple variant with a similar name exists | -LL - check(xm7::V); -LL + check(xm7::TV); - | +LL | check(xm7::TV); + | ~~ help: consider importing one of these constants instead | LL + use m8::V; diff --git a/tests/ui/object-pointer-types.stderr b/tests/ui/object-pointer-types.stderr index 7e3a13dd90b..7d915ebdab6 100644 --- a/tests/ui/object-pointer-types.stderr +++ b/tests/ui/object-pointer-types.stderr @@ -9,9 +9,8 @@ LL | x.owned(); | help: there is a method `to_owned` with a similar name | -LL - x.owned(); -LL + x.to_owned(); - | +LL | x.to_owned(); + | ~~~~~~~~ error[E0599]: no method named `owned` found for mutable reference `&mut dyn Foo` in the current scope --> $DIR/object-pointer-types.rs:17:7 diff --git a/tests/ui/parser/bad-char-literals.stderr b/tests/ui/parser/bad-char-literals.stderr index 3513055cb55..1b047aa4619 100644 --- a/tests/ui/parser/bad-char-literals.stderr +++ b/tests/ui/parser/bad-char-literals.stderr @@ -6,9 +6,8 @@ LL | '''; | help: escape the character | -LL - '''; -LL + '\''; - | +LL | '\''; + | ~~ error: character constant must be escaped: `\n` --> $DIR/bad-char-literals.rs:10:6 diff --git a/tests/ui/parser/bad-escape-suggest-raw-string.stderr b/tests/ui/parser/bad-escape-suggest-raw-string.stderr index 5afa1f4a7f8..6dd4ad512a8 100644 --- a/tests/ui/parser/bad-escape-suggest-raw-string.stderr +++ b/tests/ui/parser/bad-escape-suggest-raw-string.stderr @@ -7,9 +7,8 @@ LL | let bad = "ab\[c"; = help: for more information, visit <https://doc.rust-lang.org/reference/tokens.html#literals> help: if you meant to write a literal backslash (perhaps escaping in a regular expression), consider a raw string literal | -LL - let bad = "ab\[c"; -LL + let bad = r"ab\[c"; - | +LL | let bad = r"ab\[c"; + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/parser/byte-literals.stderr b/tests/ui/parser/byte-literals.stderr index fe3cfb23de8..9e1c2df3e56 100644 --- a/tests/ui/parser/byte-literals.stderr +++ b/tests/ui/parser/byte-literals.stderr @@ -39,9 +39,8 @@ LL | b'''; | help: escape the character | -LL - b'''; -LL + b'\''; - | +LL | b'\''; + | ~~ error: non-ASCII character in byte literal --> $DIR/byte-literals.rs:10:7 diff --git a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr index 767f63d6958..7fc2db0fa55 100644 --- a/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr +++ b/tests/ui/parser/issues/issue-65257-invalid-var-decl-recovery.stderr @@ -54,9 +54,8 @@ LL | mut n = 0; | help: missing keyword | -LL - mut n = 0; -LL + let mut n = 0; - | +LL | let mut n = 0; + | ~~~~~~~ error: invalid variable declaration --> $DIR/issue-65257-invalid-var-decl-recovery.rs:16:5 @@ -66,9 +65,8 @@ LL | mut var; | help: missing keyword | -LL - mut var; -LL + let mut var; - | +LL | let mut var; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/issue-65257-invalid-var-decl-recovery.rs:20:33 diff --git a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr index f6330e51e0d..b6e24faf5da 100644 --- a/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr +++ b/tests/ui/parser/issues/issue-87086-colon-path-sep.stderr @@ -47,9 +47,8 @@ LL | qux: Foo::Baz if true => {} | help: maybe write a path separator here | -LL - qux: Foo::Baz if true => {} -LL + qux::Foo::Baz if true => {} - | +LL | qux::Foo::Baz if true => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:40:15 @@ -74,9 +73,8 @@ LL | ref qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - ref qux: Foo::Baz => {} -LL + ref qux::Foo::Baz => {} - | +LL | ref qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:58:16 @@ -88,9 +86,8 @@ LL | mut qux: Foo::Baz => {} | help: maybe write a path separator here | -LL - mut qux: Foo::Baz => {} -LL + mut qux::Foo::Baz => {} - | +LL | mut qux::Foo::Baz => {} + | ~~ error: expected one of `@` or `|`, found `:` --> $DIR/issue-87086-colon-path-sep.rs:69:12 diff --git a/tests/ui/parser/type-ascription-in-pattern.stderr b/tests/ui/parser/type-ascription-in-pattern.stderr index d29c76baa7b..09190754993 100644 --- a/tests/ui/parser/type-ascription-in-pattern.stderr +++ b/tests/ui/parser/type-ascription-in-pattern.stderr @@ -8,9 +8,8 @@ LL | x: i32 => x, | help: maybe write a path separator here | -LL - x: i32 => x, -LL + x::i32 => x, - | +LL | x::i32 => x, + | ~~ error: expected one of `...`, `..=`, `..`, or `|`, found `:` --> $DIR/type-ascription-in-pattern.rs:12:11 @@ -38,9 +37,8 @@ LL | x: i32 => (), | help: maybe write a path separator here | -LL - x: i32 => (), -LL + x::i32 => (), - | +LL | x::i32 => (), + | ~~ error[E0308]: mismatched types --> $DIR/type-ascription-in-pattern.rs:3:19 diff --git a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr index 2f53ebe6f3f..158eac9a1bd 100644 --- a/tests/ui/pattern/usefulness/doc-hidden-fields.stderr +++ b/tests/ui/pattern/usefulness/doc-hidden-fields.stderr @@ -17,19 +17,16 @@ LL | let HiddenStruct { one } = HiddenStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two, .. } = HiddenStruct::default(); + | ~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, two: _, .. } = HiddenStruct::default(); + | ~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let HiddenStruct { one } = HiddenStruct::default(); -LL + let HiddenStruct { one, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, .. } = HiddenStruct::default(); + | ~~~~~~ error[E0027]: pattern does not mention field `two` --> $DIR/doc-hidden-fields.rs:21:9 @@ -39,19 +36,16 @@ LL | let HiddenStruct { one, hide } = HiddenStruct::default(); | help: include the missing field in the pattern | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two } = HiddenStruct::default(); + | ~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, two: _ } = HiddenStruct::default(); + | ~~~~~~~~~~ help: or always ignore missing fields here | -LL - let HiddenStruct { one, hide } = HiddenStruct::default(); -LL + let HiddenStruct { one, hide, .. } = HiddenStruct::default(); - | +LL | let HiddenStruct { one, hide, .. } = HiddenStruct::default(); + | ~~~~~~ error[E0027]: pattern does not mention field `im_hidden` --> $DIR/doc-hidden-fields.rs:24:9 @@ -61,19 +55,16 @@ LL | let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; | help: include the missing field in the pattern | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, im_hidden: _ } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let InCrate { a, b } = InCrate { a: 0, b: false, im_hidden: 0 }; -LL + let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; - | +LL | let InCrate { a, b, .. } = InCrate { a: 0, b: false, im_hidden: 0 }; + | ~~~~~~ error: aborting due to 4 previous errors diff --git a/tests/ui/pattern/usefulness/stable-gated-fields.stderr b/tests/ui/pattern/usefulness/stable-gated-fields.stderr index 7b44bc79acf..d6e9bac7c13 100644 --- a/tests/ui/pattern/usefulness/stable-gated-fields.stderr +++ b/tests/ui/pattern/usefulness/stable-gated-fields.stderr @@ -6,19 +6,16 @@ LL | let UnstableStruct { stable } = UnstableStruct::default(); | help: include the missing field in the pattern and ignore the inaccessible fields | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2, .. } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, stable2: _, .. } = UnstableStruct::default(); + | ~~~~~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let UnstableStruct { stable } = UnstableStruct::default(); -LL + let UnstableStruct { stable, .. } = UnstableStruct::default(); - | +LL | let UnstableStruct { stable, .. } = UnstableStruct::default(); + | ~~~~~~ error: pattern requires `..` due to inaccessible fields --> $DIR/stable-gated-fields.rs:11:9 diff --git a/tests/ui/privacy/suggest-box-new.stderr b/tests/ui/privacy/suggest-box-new.stderr index da8405fd0e8..80885a8f2f1 100644 --- a/tests/ui/privacy/suggest-box-new.stderr +++ b/tests/ui/privacy/suggest-box-new.stderr @@ -9,9 +9,8 @@ LL | let _ = std::collections::HashMap(); | help: you might have meant to use an associated function to build this type | -LL - let _ = std::collections::HashMap(); -LL + let _ = std::collections::HashMap::new(); - | +LL | let _ = std::collections::HashMap::new(); + | ~~~~~~~ LL - let _ = std::collections::HashMap(); LL + let _ = std::collections::HashMap::with_capacity(_); | @@ -23,9 +22,8 @@ LL + let _ = std::collections::HashMap::with_capacity_and_hasher(_, _); | help: consider using the `Default` trait | -LL - let _ = std::collections::HashMap(); -LL + let _ = <std::collections::HashMap as std::default::Default>::default(); - | +LL | let _ = <std::collections::HashMap as std::default::Default>::default(); + | + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/suggest-box-new.rs:8:19 diff --git a/tests/ui/pub/pub-restricted.stderr b/tests/ui/pub/pub-restricted.stderr index 35c48c6d769..fc177aa2033 100644 --- a/tests/ui/pub/pub-restricted.stderr +++ b/tests/ui/pub/pub-restricted.stderr @@ -10,9 +10,8 @@ LL | pub (a) fn afn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) fn afn() {} -LL + pub (in a) fn afn() {} - | +LL | pub (in a) fn afn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:4:6 @@ -26,9 +25,8 @@ LL | pub (b) fn bfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `b` with `in` | -LL - pub (b) fn bfn() {} -LL + pub (in b) fn bfn() {} - | +LL | pub (in b) fn bfn() {} + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:5:6 @@ -42,9 +40,8 @@ LL | pub (crate::a) fn cfn() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `crate::a` with `in` | -LL - pub (crate::a) fn cfn() {} -LL + pub (in crate::a) fn cfn() {} - | +LL | pub (in crate::a) fn cfn() {} + | ~~~~~~~~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:22:14 @@ -58,9 +55,8 @@ LL | pub (a) invalid: usize, `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `a` with `in` | -LL - pub (a) invalid: usize, -LL + pub (in a) invalid: usize, - | +LL | pub (in a) invalid: usize, + | ~~~~ error[E0704]: incorrect visibility restriction --> $DIR/pub-restricted.rs:31:6 @@ -74,9 +70,8 @@ LL | pub (xyz) fn xyz() {} `pub(in path::to::module)`: visible only on the specified path help: make this visible only to module `xyz` with `in` | -LL - pub (xyz) fn xyz() {} -LL + pub (in xyz) fn xyz() {} - | +LL | pub (in xyz) fn xyz() {} + | ~~~~~~ error[E0742]: visibilities can only be restricted to ancestor modules --> $DIR/pub-restricted.rs:23:17 diff --git a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr index f142f91064f..b3cc90ff1f5 100644 --- a/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr +++ b/tests/ui/resolve/const-with-typo-in-pattern-binding.stderr @@ -73,9 +73,8 @@ LL | _ => {} | help: you might have meant to pattern match against the value of constant `ARCH` instead of introducing a new catch-all binding | -LL - ARCH => {} -LL + std::env::consts::ARCH => {} - | +LL | std::env::consts::ARCH => {} + | ~~~~~~~~~~~~~~~~~~~~~~ error: aborting due to 5 previous errors diff --git a/tests/ui/resolve/resolve-inconsistent-names.stderr b/tests/ui/resolve/resolve-inconsistent-names.stderr index 3197e0b0894..d6240fb8f87 100644 --- a/tests/ui/resolve/resolve-inconsistent-names.stderr +++ b/tests/ui/resolve/resolve-inconsistent-names.stderr @@ -34,9 +34,8 @@ LL | (A, B) | (ref B, c) | (c, A) => () | help: if you meant to match on unit variant `E::A`, use the full path in the pattern | -LL - (A, B) | (ref B, c) | (c, A) => () -LL + (E::A, B) | (ref B, c) | (c, A) => () - | +LL | (E::A, B) | (ref B, c) | (c, A) => () + | ~~~~ error[E0408]: variable `B` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:19:31 @@ -65,9 +64,8 @@ LL | (CONST1, _) | (_, Const2) => () | help: if you meant to match on constant `m::Const2`, use the full path in the pattern | -LL - (CONST1, _) | (_, Const2) => () -LL + (CONST1, _) | (_, m::Const2) => () - | +LL | (CONST1, _) | (_, m::Const2) => () + | ~~~~~~~~~ error[E0408]: variable `CONST1` is not bound in all patterns --> $DIR/resolve-inconsistent-names.rs:31:23 diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr index d0244f39769..39b1ef1e078 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/struct.stderr @@ -58,9 +58,8 @@ LL | let NormalStruct { first_field, second_field } = ns; | help: add `..` at the end of the field list to ignore all other fields | -LL - let NormalStruct { first_field, second_field } = ns; -LL + let NormalStruct { first_field, second_field , .. } = ns; - | +LL | let NormalStruct { first_field, second_field , .. } = ns; + | ~~~~~~ error[E0423]: cannot initialize a tuple struct which contains private fields --> $DIR/struct.rs:20:14 @@ -76,9 +75,8 @@ LL | let TupleStruct { 0: first_field, 1: second_field } = ts; | help: add `..` at the end of the field list to ignore all other fields | -LL - let TupleStruct { 0: first_field, 1: second_field } = ts; -LL + let TupleStruct { 0: first_field, 1: second_field , .. } = ts; - | +LL | let TupleStruct { 0: first_field, 1: second_field , .. } = ts; + | ~~~~~~ error[E0638]: `..` required with struct marked as non-exhaustive --> $DIR/struct.rs:35:9 @@ -88,9 +86,8 @@ LL | let UnitStruct { } = us; | help: add `..` at the end of the field list to ignore all other fields | -LL - let UnitStruct { } = us; -LL + let UnitStruct { .. } = us; - | +LL | let UnitStruct { .. } = us; + | ~~~~ error: aborting due to 9 previous errors diff --git a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr index 4cabd5a8140..4083f57a9cd 100644 --- a/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr +++ b/tests/ui/rfcs/rfc-2008-non-exhaustive/variant.stderr @@ -82,9 +82,8 @@ LL | NonExhaustiveVariants::Struct { field } => "" | help: add `..` at the end of the field list to ignore all other fields | -LL - NonExhaustiveVariants::Struct { field } => "" -LL + NonExhaustiveVariants::Struct { field , .. } => "" - | +LL | NonExhaustiveVariants::Struct { field , .. } => "" + | ~~~~~~ error[E0638]: `..` required with variant marked as non-exhaustive --> $DIR/variant.rs:30:12 @@ -94,9 +93,8 @@ LL | if let NonExhaustiveVariants::Struct { field } = variant_struct { | help: add `..` at the end of the field list to ignore all other fields | -LL - if let NonExhaustiveVariants::Struct { field } = variant_struct { -LL + if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { - | +LL | if let NonExhaustiveVariants::Struct { field , .. } = variant_struct { + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr index 37a0f2bcaa8..d0c084f7bd5 100644 --- a/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr +++ b/tests/ui/rfcs/rfc-2126-extern-absolute-paths/not-allowed.stderr @@ -6,9 +6,8 @@ LL | use alloc; | help: consider importing this module instead | -LL - use alloc; -LL + use std::alloc; - | +LL | use std::alloc; + | ~~~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 077b4a6cf2f..8632bca6b10 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -34,9 +34,8 @@ LL + use crate::foo::Bar; | help: there is a method `foobar` with a similar name | -LL - x.bar(); -LL + x.foobar(); - | +LL | x.foobar(); + | ~~~~~~ error[E0599]: no method named `baz` found for type `u32` in the current scope --> $DIR/trait-import-suggestions.rs:29:7 diff --git a/tests/ui/structs/struct-pat-derived-error.stderr b/tests/ui/structs/struct-pat-derived-error.stderr index a086de08983..628a007e769 100644 --- a/tests/ui/structs/struct-pat-derived-error.stderr +++ b/tests/ui/structs/struct-pat-derived-error.stderr @@ -24,19 +24,16 @@ LL | let A { x, y } = self.d; | help: include the missing fields in the pattern | -LL - let A { x, y } = self.d; -LL + let A { x, y, b, c } = self.d; - | +LL | let A { x, y, b, c } = self.d; + | ~~~~~~~~ help: if you don't care about these missing fields, you can explicitly ignore them | -LL - let A { x, y } = self.d; -LL + let A { x, y, b: _, c: _ } = self.d; - | +LL | let A { x, y, b: _, c: _ } = self.d; + | ~~~~~~~~~~~~~~ help: or always ignore missing fields here | -LL - let A { x, y } = self.d; -LL + let A { x, y, .. } = self.d; - | +LL | let A { x, y, .. } = self.d; + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/struct-tuple-field-names.stderr b/tests/ui/structs/struct-tuple-field-names.stderr index 7692010aa54..ef3869dda53 100644 --- a/tests/ui/structs/struct-tuple-field-names.stderr +++ b/tests/ui/structs/struct-tuple-field-names.stderr @@ -30,19 +30,16 @@ LL | if let E::S { 0: a } = x { | help: include the missing field in the pattern | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, 1: _ } = x { - | +LL | if let E::S { 0: a, 1: _ } = x { + | ~~~~~~~~ help: or always ignore missing fields here | -LL - if let E::S { 0: a } = x { -LL + if let E::S { 0: a, .. } = x { - | +LL | if let E::S { 0: a, .. } = x { + | ~~~~~~ error: aborting due to 3 previous errors diff --git a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr index befc6a1b538..af530e2b759 100644 --- a/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr +++ b/tests/ui/structs/suggest-replacing-field-when-specifying-same-type.stderr @@ -15,19 +15,16 @@ LL | Foo::Bar { a, aa: 1, c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b } => (), - | +LL | Foo::Bar { a, aa: 1, c, b } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, b: _ } => (), - | +LL | Foo::Bar { a, aa: 1, c, b: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: 1, c } => (), -LL + Foo::Bar { a, aa: 1, c, .. } => (), - | +LL | Foo::Bar { a, aa: 1, c, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:13:20 @@ -46,19 +43,16 @@ LL | Foo::Baz { bb: 1.0 } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a } => (), - | +LL | Foo::Baz { bb: 1.0, a } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, a: _ } => (), - | +LL | Foo::Baz { bb: 1.0, a: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Baz { bb: 1.0 } => (), -LL + Foo::Baz { bb: 1.0, .. } => (), - | +LL | Foo::Baz { bb: 1.0, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Bar` does not have a field named `aa` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:20:23 @@ -74,19 +68,16 @@ LL | Foo::Bar { a, aa: "", c } => (), | help: include the missing field in the pattern | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b } => (), - | +LL | Foo::Bar { a, aa: "", c, b } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, b: _ } => (), - | +LL | Foo::Bar { a, aa: "", c, b: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Bar { a, aa: "", c } => (), -LL + Foo::Bar { a, aa: "", c, .. } => (), - | +LL | Foo::Bar { a, aa: "", c, .. } => (), + | ~~~~~~ error[E0026]: variant `Foo::Baz` does not have a field named `bb` --> $DIR/suggest-replacing-field-when-specifying-same-type.rs:23:20 @@ -102,19 +93,16 @@ LL | Foo::Baz { bb: "" } => (), | help: include the missing field in the pattern | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a } => (), - | +LL | Foo::Baz { bb: "", a } => (), + | ~~~~~ help: if you don't care about this missing field, you can explicitly ignore it | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", a: _ } => (), - | +LL | Foo::Baz { bb: "", a: _ } => (), + | ~~~~~~~~ help: or always ignore missing fields here | -LL - Foo::Baz { bb: "" } => (), -LL + Foo::Baz { bb: "", .. } => (), - | +LL | Foo::Baz { bb: "", .. } => (), + | ~~~~~~ error: aborting due to 8 previous errors diff --git a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr index 54c927b59d4..5af2c3fbd9b 100644 --- a/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr +++ b/tests/ui/suggestions/suggest-deref-in-match-issue-132784.stderr @@ -11,9 +11,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:9:9 @@ -28,9 +27,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match x { -LL + match *x { - | +LL | match *x { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:16:9 @@ -79,9 +77,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:28:9 @@ -96,9 +93,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y { -LL + match *y { - | +LL | match *y { + | ~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:36:9 @@ -147,9 +143,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | ~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:48:9 @@ -164,9 +159,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_const { -LL + match &**z_const { - | +LL | match &**z_const { + | ~~~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:57:9 @@ -181,9 +175,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:59:9 @@ -198,9 +191,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match z_mut { -LL + match &**z_mut { - | +LL | match &**z_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:68:9 @@ -215,9 +207,8 @@ LL | Some(_) => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:70:9 @@ -232,9 +223,8 @@ LL | None => {} found enum `Option<_>` help: consider dereferencing to access the inner value using the Deref trait | -LL - match y_mut { -LL + match &**y_mut { - | +LL | match &**y_mut { + | ~~~~~~~~ error[E0308]: mismatched types --> $DIR/suggest-deref-in-match-issue-132784.rs:79:9 diff --git a/tests/ui/suggestions/type-mismatch-byte-literal.stderr b/tests/ui/suggestions/type-mismatch-byte-literal.stderr index e96ead569d9..3d27149f0dc 100644 --- a/tests/ui/suggestions/type-mismatch-byte-literal.stderr +++ b/tests/ui/suggestions/type-mismatch-byte-literal.stderr @@ -8,9 +8,8 @@ LL | let _x: u8 = 'X'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _x: u8 = 'X'; -LL + let _x: u8 = b'X'; - | +LL | let _x: u8 = b'X'; + | ~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:11:9 @@ -27,9 +26,8 @@ LL | fn foo(_t: u8) {} | ^^^ ------ help: if you meant to write a byte literal, prefix with `b` | -LL - foo('#'); -LL + foo(b'#'); - | +LL | foo(b'#'); + | ~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:15:18 @@ -41,9 +39,8 @@ LL | let _a: u8 = '\x20'; | help: if you meant to write a byte literal, prefix with `b` | -LL - let _a: u8 = '\x20'; -LL + let _a: u8 = b'\x20'; - | +LL | let _a: u8 = b'\x20'; + | ~~~~~~~ error[E0308]: mismatched types --> $DIR/type-mismatch-byte-literal.rs:20:9 diff --git a/tests/ui/test-attrs/inaccessible-test-modules.stderr b/tests/ui/test-attrs/inaccessible-test-modules.stderr index 39f69b164fb..7635f579d66 100644 --- a/tests/ui/test-attrs/inaccessible-test-modules.stderr +++ b/tests/ui/test-attrs/inaccessible-test-modules.stderr @@ -12,9 +12,8 @@ LL | use test as y; | help: consider importing this module instead | -LL - use test as y; -LL + use test::test as y; - | +LL | use test::test as y; + | ~~~~~~~~~~~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr index 23974c5b4aa..7985b611a4f 100644 --- a/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr +++ b/tests/ui/traits/associated_type_bound/assoc_type_bound_with_struct.stderr @@ -14,9 +14,8 @@ LL + struct Foo<T> where T: Bar, T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - struct Foo<T> where T: Bar, <T as Bar>::Baz: String { -LL + struct Foo<T> where T: Bar, <T as Bar>::Baz: ToString { - | +LL | struct Foo<T> where T: Bar, <T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:9:54 @@ -34,9 +33,8 @@ LL + struct Qux<'a, T> where T: Bar, &'a T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: String { -LL + struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { - | +LL | struct Qux<'a, T> where T: Bar, <&'a T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:13:45 @@ -54,9 +52,8 @@ LL + fn foo<T: Bar>(_: T) where T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - fn foo<T: Bar>(_: T) where <T as Bar>::Baz: String { -LL + fn foo<T: Bar>(_: T) where <T as Bar>::Baz: ToString { - | +LL | fn foo<T: Bar>(_: T) where <T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0404]: expected trait, found struct `String` --> $DIR/assoc_type_bound_with_struct.rs:16:57 @@ -74,9 +71,8 @@ LL + fn qux<'a, T: Bar>(_: &'a T) where &'a T: Bar<Baz = String> { | help: a trait with a similar name exists | -LL - fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: String { -LL + fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { - | +LL | fn qux<'a, T: Bar>(_: &'a T) where <&'a T as Bar>::Baz: ToString { + | ~~~~~~~~ error[E0405]: cannot find trait `Unresolved` in this scope --> $DIR/assoc_type_bound_with_struct.rs:19:31 diff --git a/tests/ui/type/issue-100584.stderr b/tests/ui/type/issue-100584.stderr index 7cbab154066..e1db14d1f00 100644 --- a/tests/ui/type/issue-100584.stderr +++ b/tests/ui/type/issue-100584.stderr @@ -19,9 +19,8 @@ LL | let _ = format!("{xyza}"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo(xyza: &str) { -LL + fn foo(_xyza: &str) { - | +LL | fn foo(_xyza: &str) { + | ~~~~~ error: unused variable: `xyza` --> $DIR/issue-100584.rs:7:9 @@ -38,9 +37,8 @@ LL | let _ = format!("aaa{xyza}bbb"); | ++++++++ + help: if this is intentional, prefix it with an underscore | -LL - fn foo3(xyza: &str) { -LL + fn foo3(_xyza: &str) { - | +LL | fn foo3(_xyza: &str) { + | ~~~~~ error: aborting due to 2 previous errors diff --git a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr index aaf41ed6eba..19b0c1059c8 100644 --- a/tests/ui/type/pattern_types/pattern_type_mismatch.stderr +++ b/tests/ui/type/pattern_types/pattern_type_mismatch.stderr @@ -6,9 +6,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is b'a'..='a') = todo!(); + | ~~~~ error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:8:47 @@ -18,9 +17,8 @@ LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); | help: if you meant to write a byte literal, prefix with `b` | -LL - const BAD_NESTING4: pattern_type!(u8 is 'a'..='a') = todo!(); -LL + const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); - | +LL | const BAD_NESTING4: pattern_type!(u8 is 'a'..=b'a') = todo!(); + | ~~~~ error[E0308]: mismatched types --> $DIR/pattern_type_mismatch.rs:12:43 diff --git a/tests/ui/typeck/mismatched-map-under-self.stderr b/tests/ui/typeck/mismatched-map-under-self.stderr index fd6b3093ec9..59de00a58bb 100644 --- a/tests/ui/typeck/mismatched-map-under-self.stderr +++ b/tests/ui/typeck/mismatched-map-under-self.stderr @@ -13,9 +13,8 @@ LL | fn values(&self) -> Self::Values; found signature `fn(Option<_>)` help: change the self-receiver type to match the trait | -LL - fn values(self) -> Self::Values { -LL + fn values(&self) -> Self::Values { - | +LL | fn values(&self) -> Self::Values { + | ~~~~~ error[E0631]: type mismatch in function arguments --> $DIR/mismatched-map-under-self.rs:12:18 diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 0810f90306e..7ef2f6b1a29 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -6,9 +6,8 @@ LL | use Trait; | help: consider importing this trait instead | -LL - use Trait; -LL + use a::Trait; - | +LL | use a::Trait; + | ~~~~~~~~ error[E0405]: cannot find trait `Trait` in this scope --> $DIR/unresolved-candidates.rs:10:10 |
