From 2b8209a932c85b66a09271ae9d15bca9750e76e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Sep 2026 00:49:49 +0000 Subject: [PATCH 01/16] Use verbose suggestion for type literal with wrong syntax --- .../rustc_resolve/src/late/diagnostics.rs | 6 ++-- tests/ui/cross-crate/unit-struct.stderr | 8 +++-- ...emap-path-prefix-reverse.local-self.stderr | 8 +++-- ...p-path-prefix-reverse.remapped-self.stderr | 8 +++-- .../match-pattern-field-mismatch-2.stderr | 8 ++++- ...-on-tuple-and-struct-variants-63983.stderr | 7 +++- ...e-string-literal-syntax-error-64792.stderr | 7 +++- .../pattern/constructor-type-mismatch.stderr | 8 ++++- tests/ui/pattern/issue-106862.stderr | 35 ++++++++++++++++--- ...tch-tuple-variant-self-ctor.struct_.stderr | 6 +++- tests/ui/pattern/pat-tuple-underfield.stderr | 7 +++- .../struct-variant-as-tuple-variant.stderr | 7 +++- ...unit-variant-pattern-matching-29383.stderr | 16 +++++++-- .../ui/resolve/empty-struct-tuple-pat.stderr | 7 +++- tests/ui/resolve/empty-struct-unit-pat.stderr | 16 +++++++-- tests/ui/resolve/issue-6702.stderr | 7 +++- tests/ui/resolve/privacy-struct-ctor.stderr | 6 +++- ...ct-construct-with-call-issue-138931.stderr | 7 +++- tests/ui/suggestions/issue-61226.stderr | 6 +++- tests/ui/suggestions/issue-84700.stderr | 8 ++++- 20 files changed, 154 insertions(+), 34 deletions(-) diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 4a6846d09a8c4..be73c6126f95a 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -2442,7 +2442,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { &expression, applicability, ) { - err.span_suggestion( + err.span_suggestion_verbose( span, format!("use struct {descr} syntax instead"), expression, @@ -2637,7 +2637,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { self.r.def_span(def_id), format!("`{path_str}` defined here"), ); - err.span_suggestion( + err.span_suggestion_verbose( span, "use this syntax instead", path_str, @@ -2654,7 +2654,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { || "/* fields */".to_string(), |field_ids| vec!["_"; field_ids.len()].join(", "), ); - err.span_suggestion( + err.span_suggestion_verbose( span, "use the tuple variant pattern syntax instead", format!("{path_str}({fields})"), diff --git a/tests/ui/cross-crate/unit-struct.stderr b/tests/ui/cross-crate/unit-struct.stderr index f158602456cea..447b345cafb0b 100644 --- a/tests/ui/cross-crate/unit-struct.stderr +++ b/tests/ui/cross-crate/unit-struct.stderr @@ -2,9 +2,7 @@ error[E0423]: cannot find value `StructWithFields` in crate `xcrate_unit_struct` --> $DIR/unit-struct.rs:9:33 | LL | let _ = xcrate_unit_struct::StructWithFields; - | --------------------^^^^^^^^^^^^^^^^ - | | - | help: use struct literal syntax instead: `xcrate_unit_struct::StructWithFields { foo: val }` + | ^^^^^^^^^^^^^^^^ | ::: $DIR/auxiliary/xcrate_unit_struct.rs:20:1 | @@ -12,6 +10,10 @@ LL | pub struct StructWithFields { | --------------------------- `xcrate_unit_struct::StructWithFields` defined here | = note: a struct named `xcrate_unit_struct::StructWithFields` exists in another namespace +help: use struct literal syntax instead + | +LL | let _ = xcrate_unit_struct::StructWithFields { foo: val }; + | ++++++++++++ error[E0423]: cannot find value `StructWithPrivFields` in crate `xcrate_unit_struct` --> $DIR/unit-struct.rs:11:33 diff --git a/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr b/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr index 047916bb7cace..eabf17c25c902 100644 --- a/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr +++ b/tests/ui/errors/remap-path-prefix-reverse.local-self.stderr @@ -2,9 +2,7 @@ error[E0423]: cannot find value `SomeStruct` in crate `remapped_dep` --> $DIR/remap-path-prefix-reverse.rs:15:27 | LL | let _ = remapped_dep::SomeStruct; - | --------------^^^^^^^^^^ - | | - | help: use struct literal syntax instead: `remapped_dep::SomeStruct {}` + | ^^^^^^^^^^ | ::: remapped-aux/remapped_dep.rs:4:1 | @@ -12,6 +10,10 @@ LL | pub struct SomeStruct {} // This line should be show as part of the error. | --------------------- `remapped_dep::SomeStruct` defined here | = note: a struct named `remapped_dep::SomeStruct` exists in another namespace +help: use struct literal syntax instead + | +LL | let _ = remapped_dep::SomeStruct {}; + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr b/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr index 047916bb7cace..eabf17c25c902 100644 --- a/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr +++ b/tests/ui/errors/remap-path-prefix-reverse.remapped-self.stderr @@ -2,9 +2,7 @@ error[E0423]: cannot find value `SomeStruct` in crate `remapped_dep` --> $DIR/remap-path-prefix-reverse.rs:15:27 | LL | let _ = remapped_dep::SomeStruct; - | --------------^^^^^^^^^^ - | | - | help: use struct literal syntax instead: `remapped_dep::SomeStruct {}` + | ^^^^^^^^^^ | ::: remapped-aux/remapped_dep.rs:4:1 | @@ -12,6 +10,10 @@ LL | pub struct SomeStruct {} // This line should be show as part of the error. | --------------------- `remapped_dep::SomeStruct` defined here | = note: a struct named `remapped_dep::SomeStruct` exists in another namespace +help: use struct literal syntax instead + | +LL | let _ = remapped_dep::SomeStruct {}; + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/match/match-pattern-field-mismatch-2.stderr b/tests/ui/match/match-pattern-field-mismatch-2.stderr index 12b143dd29b91..a4785d1f6b961 100644 --- a/tests/ui/match/match-pattern-field-mismatch-2.stderr +++ b/tests/ui/match/match-pattern-field-mismatch-2.stderr @@ -5,7 +5,13 @@ LL | NoColor, | ------- `Color::NoColor` defined here ... LL | Color::NoColor(_) => { } - | ^^^^^^^^^^^^^^^^^ help: use this syntax instead: `Color::NoColor` + | ^^^^^^^^^^^^^^^^^ + | +help: use this syntax instead + | +LL - Color::NoColor(_) => { } +LL + Color::NoColor => { } + | error: aborting due to 1 previous error diff --git a/tests/ui/match/unit-pattern-error-on-tuple-and-struct-variants-63983.stderr b/tests/ui/match/unit-pattern-error-on-tuple-and-struct-variants-63983.stderr index 1ee103c18c2f3..ec375d288befe 100644 --- a/tests/ui/match/unit-pattern-error-on-tuple-and-struct-variants-63983.stderr +++ b/tests/ui/match/unit-pattern-error-on-tuple-and-struct-variants-63983.stderr @@ -5,7 +5,12 @@ LL | HasTupleField(i32), | ------------------ `MyEnum::HasTupleField` defined here ... LL | MyEnum::HasTupleField => "", - | ^^^^^^^^^^^^^^^^^^^^^ help: use the tuple variant pattern syntax instead: `MyEnum::HasTupleField(_)` + | ^^^^^^^^^^^^^^^^^^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | MyEnum::HasTupleField(_) => "", + | +++ error[E0533]: expected unit struct, unit variant or constant, found struct variant `MyEnum::HasStructField` --> $DIR/unit-pattern-error-on-tuple-and-struct-variants-63983.rs:11:9 diff --git a/tests/ui/parser/unicode-string-literal-syntax-error-64792.stderr b/tests/ui/parser/unicode-string-literal-syntax-error-64792.stderr index bdb2e412f0211..3ccca2e8a46e1 100644 --- a/tests/ui/parser/unicode-string-literal-syntax-error-64792.stderr +++ b/tests/ui/parser/unicode-string-literal-syntax-error-64792.stderr @@ -5,9 +5,14 @@ LL | struct X {} | ----------- `X` defined here LL | LL | const Y: X = X("ö"); - | ^^^^^^ help: use struct literal syntax instead: `X {}` + | ^^^^^^ | = note: a struct named `X` exists in another namespace +help: use struct literal syntax instead + | +LL - const Y: X = X("ö"); +LL + const Y: X = X {}; + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/constructor-type-mismatch.stderr b/tests/ui/pattern/constructor-type-mismatch.stderr index a776a5405e70e..049d2d848ffc1 100644 --- a/tests/ui/pattern/constructor-type-mismatch.stderr +++ b/tests/ui/pattern/constructor-type-mismatch.stderr @@ -29,7 +29,13 @@ LL | struct S; | --------- `S` defined here ... LL | S(()) => {} - | ^^^^^ help: use this syntax instead: `S` + | ^^^^^ + | +help: use this syntax instead + | +LL - S(()) => {} +LL + S => {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/pattern/issue-106862.stderr b/tests/ui/pattern/issue-106862.stderr index fc613f3d39156..d075f6252c915 100644 --- a/tests/ui/pattern/issue-106862.stderr +++ b/tests/ui/pattern/issue-106862.stderr @@ -5,9 +5,14 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(a, b) => println!("{} {}", a, b), - | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: b }` + | ^^^^^^^^^^ | = note: a variant named `FooB` exists in another namespace +help: use struct pattern syntax instead + | +LL - FooB(a, b) => println!("{} {}", a, b), +LL + FooB { x: a, y: b } => println!("{} {}", a, b), + | error[E0532]: cannot find tuple struct or tuple variant `FooB` in this scope --> $DIR/issue-106862.rs:22:9 @@ -16,9 +21,14 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(x, y) => println!("{} {}", x, y), - | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + | ^^^^^^^^^^ | = note: a variant named `FooB` exists in another namespace +help: use struct pattern syntax instead + | +LL - FooB(x, y) => println!("{} {}", x, y), +LL + FooB { x, y } => println!("{} {}", x, y), + | error[E0532]: cannot find tuple struct or tuple variant `FooA` in this scope --> $DIR/issue-106862.rs:28:9 @@ -27,9 +37,14 @@ LL | FooA { opt_x: Option, y: i32 }, | ----------------------------------- `FooA` defined here ... LL | FooA(Some(x), y) => println!("{} {}", x, y), - | ^^^^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooA { opt_x: Some(x), y }` + | ^^^^^^^^^^^^^^^^ | = note: a variant named `FooA` exists in another namespace +help: use struct pattern syntax instead + | +LL - FooA(Some(x), y) => println!("{} {}", x, y), +LL + FooA { opt_x: Some(x), y } => println!("{} {}", x, y), + | error[E0532]: cannot find tuple struct or tuple variant `FooB` in this scope --> $DIR/issue-106862.rs:34:9 @@ -38,9 +53,14 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(a, _, _) => println!("{}", a), - | ^^^^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: _ }` + | ^^^^^^^^^^^^^ | = note: a variant named `FooB` exists in another namespace +help: use struct pattern syntax instead + | +LL - FooB(a, _, _) => println!("{}", a), +LL + FooB { x: a, y: _ } => println!("{}", a), + | error[E0532]: cannot find tuple struct or tuple variant `FooB` in this scope --> $DIR/issue-106862.rs:40:9 @@ -49,9 +69,14 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB() => (), - | ^^^^^^ help: use struct pattern syntax instead: `FooB { x, y }` + | ^^^^^^ | = note: a variant named `FooB` exists in another namespace +help: use struct pattern syntax instead + | +LL - FooB() => (), +LL + FooB { x, y } => (), + | error: aborting due to 5 previous errors diff --git a/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr b/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr index 0627e2b202f63..6a7560c3d5a75 100644 --- a/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr +++ b/tests/ui/pattern/no-match-tuple-variant-self-ctor.struct_.stderr @@ -5,9 +5,13 @@ LL | struct S {} | ----------- `S` defined here ... LL | let Self = S; - | ^ help: use struct literal syntax instead: `S {}` + | ^ | = note: a struct named `S` exists in another namespace +help: use struct literal syntax instead + | +LL | let Self = S {}; + | ++ error[E0533]: expected unit struct, found self constructor `Self` --> $DIR/no-match-tuple-variant-self-ctor.rs:30:17 diff --git a/tests/ui/pattern/pat-tuple-underfield.stderr b/tests/ui/pattern/pat-tuple-underfield.stderr index c8620fe85c3c4..2b86479b59cad 100644 --- a/tests/ui/pattern/pat-tuple-underfield.stderr +++ b/tests/ui/pattern/pat-tuple-underfield.stderr @@ -5,7 +5,12 @@ LL | S(i32, f32), | ----------- `E::S` defined here ... LL | E::S => {} - | ^^^^ help: use the tuple variant pattern syntax instead: `E::S(_, _)` + | ^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | E::S(_, _) => {} + | ++++++ error[E0023]: this pattern has 1 field, but the corresponding tuple struct has 2 fields --> $DIR/pat-tuple-underfield.rs:9:11 diff --git a/tests/ui/pattern/struct-variant-as-tuple-variant.stderr b/tests/ui/pattern/struct-variant-as-tuple-variant.stderr index 821ca297802a3..88d3641d0e81e 100644 --- a/tests/ui/pattern/struct-variant-as-tuple-variant.stderr +++ b/tests/ui/pattern/struct-variant-as-tuple-variant.stderr @@ -5,9 +5,14 @@ LL | FooB { x: i32, y: i32 } | ----------------------- `FooB` defined here ... LL | FooB(a, b) => println!("{} {}", a, b), - | ^^^^^^^^^^ help: use struct pattern syntax instead: `FooB { x: a, y: b }` + | ^^^^^^^^^^ | = note: a variant named `FooB` exists in another namespace +help: use struct pattern syntax instead + | +LL - FooB(a, b) => println!("{} {}", a, b), +LL + FooB { x: a, y: b } => println!("{} {}", a, b), + | error: aborting due to 1 previous error diff --git a/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr b/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr index e30837568a5fe..e14677aea59cc 100644 --- a/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr +++ b/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr @@ -5,7 +5,13 @@ LL | A, | - `E::A` defined here ... LL | Some(E::A(..)) => {} - | ^^^^^^^^ help: use this syntax instead: `E::A` + | ^^^^^^^^ + | +help: use this syntax instead + | +LL - Some(E::A(..)) => {} +LL + Some(E::A) => {} + | error[E0532]: expected tuple struct or tuple variant, found unit variant `E::B` --> $DIR/unit-variant-pattern-matching-29383.rs:12:14 @@ -14,7 +20,13 @@ LL | B, | - `E::B` defined here ... LL | Some(E::B(..)) => {} - | ^^^^^^^^ help: use this syntax instead: `E::B` + | ^^^^^^^^ + | +help: use this syntax instead + | +LL - Some(E::B(..)) => {} +LL + Some(E::B) => {} + | error: aborting due to 2 previous errors diff --git a/tests/ui/resolve/empty-struct-tuple-pat.stderr b/tests/ui/resolve/empty-struct-tuple-pat.stderr index 381a579b24bfb..2200fd0f64d70 100644 --- a/tests/ui/resolve/empty-struct-tuple-pat.stderr +++ b/tests/ui/resolve/empty-struct-tuple-pat.stderr @@ -29,7 +29,12 @@ LL | Empty4() | -------- `E::Empty4` defined here ... LL | E::Empty4 => () - | ^^^^^^^^^ help: use the tuple variant pattern syntax instead: `E::Empty4()` + | ^^^^^^^^^ + | +help: use the tuple variant pattern syntax instead + | +LL | E::Empty4() => () + | ++ error[E0532]: expected unit struct, unit variant or constant, found tuple variant `XE::XEmpty5` --> $DIR/empty-struct-tuple-pat.rs:33:9 diff --git a/tests/ui/resolve/empty-struct-unit-pat.stderr b/tests/ui/resolve/empty-struct-unit-pat.stderr index 6998baba5c8f8..276e240ee25bf 100644 --- a/tests/ui/resolve/empty-struct-unit-pat.stderr +++ b/tests/ui/resolve/empty-struct-unit-pat.stderr @@ -109,7 +109,13 @@ LL | Empty4 | ------ `E::Empty4` defined here ... LL | E::Empty4() => () - | ^^^^^^^^^^^ help: use this syntax instead: `E::Empty4` + | ^^^^^^^^^^^ + | +help: use this syntax instead + | +LL - E::Empty4() => () +LL + E::Empty4 => () + | error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` --> $DIR/empty-struct-unit-pat.rs:41:9 @@ -145,7 +151,13 @@ LL | Empty4 | ------ `E::Empty4` defined here ... LL | E::Empty4(..) => () - | ^^^^^^^^^^^^^ help: use this syntax instead: `E::Empty4` + | ^^^^^^^^^^^^^ + | +help: use this syntax instead + | +LL - E::Empty4(..) => () +LL + E::Empty4 => () + | error[E0532]: expected tuple struct or tuple variant, found unit variant `XE::XEmpty4` --> $DIR/empty-struct-unit-pat.rs:50:9 diff --git a/tests/ui/resolve/issue-6702.stderr b/tests/ui/resolve/issue-6702.stderr index dd1f2c5d7f819..865c07812e56c 100644 --- a/tests/ui/resolve/issue-6702.stderr +++ b/tests/ui/resolve/issue-6702.stderr @@ -7,9 +7,14 @@ LL | | } | |_- `Monster` defined here ... LL | let _m = Monster(); - | ^^^^^^^^^ help: use struct literal syntax instead: `Monster { damage: val }` + | ^^^^^^^^^ | = note: a struct named `Monster` exists in another namespace +help: use struct literal syntax instead + | +LL - let _m = Monster(); +LL + let _m = Monster { damage: val }; + | error: aborting due to 1 previous error diff --git a/tests/ui/resolve/privacy-struct-ctor.stderr b/tests/ui/resolve/privacy-struct-ctor.stderr index e948c6fdae9eb..6f8843a24b5de 100644 --- a/tests/ui/resolve/privacy-struct-ctor.stderr +++ b/tests/ui/resolve/privacy-struct-ctor.stderr @@ -33,9 +33,13 @@ LL | | } | |_____- `S2` defined here ... LL | S2; - | ^^ help: use struct literal syntax instead: `S2 { s: val }` + | ^^ | = note: a struct named `S2` exists in another namespace +help: use struct literal syntax instead + | +LL | S2 { s: val }; + | ++++++++++ error[E0423]: cannot find value `S` in crate `xcrate` --> $DIR/privacy-struct-ctor.rs:44:13 diff --git a/tests/ui/structs/struct-construct-with-call-issue-138931.stderr b/tests/ui/structs/struct-construct-with-call-issue-138931.stderr index 9248eebbae3ae..83266161c5206 100644 --- a/tests/ui/structs/struct-construct-with-call-issue-138931.stderr +++ b/tests/ui/structs/struct-construct-with-call-issue-138931.stderr @@ -53,9 +53,14 @@ LL | | } | |_- `PersonWithAge` defined here ... LL | let person = PersonWithAge("Name3".to_owned()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use struct literal syntax instead: `PersonWithAge { name: val, age: val, height: val }` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: a struct named `PersonWithAge` exists in another namespace +help: use struct literal syntax instead + | +LL - let person = PersonWithAge("Name3".to_owned()); +LL + let person = PersonWithAge { name: val, age: val, height: val }; + | error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/issue-61226.stderr b/tests/ui/suggestions/issue-61226.stderr index cf21435cc3cbc..ba8ca5c315018 100644 --- a/tests/ui/suggestions/issue-61226.stderr +++ b/tests/ui/suggestions/issue-61226.stderr @@ -5,9 +5,13 @@ LL | struct X {} | ----------- `X` defined here LL | fn main() { LL | let _ = vec![X]; //… - | ^ help: use struct literal syntax instead: `X {}` + | ^ | = note: a struct named `X` exists in another namespace +help: use struct literal syntax instead + | +LL | let _ = vec![X {}]; //… + | ++ error: aborting due to 1 previous error diff --git a/tests/ui/suggestions/issue-84700.stderr b/tests/ui/suggestions/issue-84700.stderr index 4c6edecd59a3d..1aa1cfcb84c66 100644 --- a/tests/ui/suggestions/issue-84700.stderr +++ b/tests/ui/suggestions/issue-84700.stderr @@ -5,7 +5,13 @@ LL | Cow, | --- `FarmAnimal::Cow` defined here ... LL | FarmAnimal::Cow(_) => "moo".to_string(), - | ^^^^^^^^^^^^^^^^^^ help: use this syntax instead: `FarmAnimal::Cow` + | ^^^^^^^^^^^^^^^^^^ + | +help: use this syntax instead + | +LL - FarmAnimal::Cow(_) => "moo".to_string(), +LL + FarmAnimal::Cow => "moo".to_string(), + | error[E0164]: expected tuple struct or tuple variant, found struct variant `FarmAnimal::Chicken` --> $DIR/issue-84700.rs:17:9 From c6bab65a12a7ee21d6d581de2bb77b693628e2da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Sep 2026 00:51:30 +0000 Subject: [PATCH 02/16] Use verbose suggestion for method written as function ``` error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:9:9 | LL | bar(&&self, 102); | ^^^ | help: try calling `bar` as a method | LL - bar(&&self, 102); LL + self.bar(102); | ``` --- .../rustc_resolve/src/late/diagnostics.rs | 2 +- tests/ui/self/suggest-self-2.stderr | 30 +++++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index be73c6126f95a..2522db2fd7632 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1217,7 +1217,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { err.note("constructor is not visible here due to private fields"); } } else { - err.span_suggestion( + err.span_suggestion_verbose( call_span, format!("try calling `{ident}` as a method"), format!("self.{path_str}({args_snippet})"), diff --git a/tests/ui/self/suggest-self-2.stderr b/tests/ui/self/suggest-self-2.stderr index 4bd025ea07630..90d2e5b7aa7f3 100644 --- a/tests/ui/self/suggest-self-2.stderr +++ b/tests/ui/self/suggest-self-2.stderr @@ -2,25 +2,37 @@ error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:5:9 | LL | bar(self); - | ^^^------ - | | - | help: try calling `bar` as a method: `self.bar()` + | ^^^ + | +help: try calling `bar` as a method + | +LL - bar(self); +LL + self.bar(); + | error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:9:9 | LL | bar(&&self, 102); - | ^^^------------- - | | - | help: try calling `bar` as a method: `self.bar(102)` + | ^^^ + | +help: try calling `bar` as a method + | +LL - bar(&&self, 102); +LL + self.bar(102); + | error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:13:9 | LL | bar(&mut self, 102, &"str"); - | ^^^------------------------ - | | - | help: try calling `bar` as a method: `self.bar(102, &"str")` + | ^^^ + | +help: try calling `bar` as a method + | +LL - bar(&mut self, 102, &"str"); +LL + self.bar(102, &"str"); + | error[E0425]: cannot find function `bar` in this scope --> $DIR/suggest-self-2.rs:17:9 From 2ed25fb57f5f2478cf35cbf13ad5be0c8aa82d78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Sep 2026 03:19:50 +0000 Subject: [PATCH 03/16] Tweak wording for unit struct literal suggestion --- compiler/rustc_resolve/src/late/diagnostics.rs | 2 +- .../match/match-pattern-field-mismatch-2.stderr | 2 +- .../ui/pattern/constructor-type-mismatch.stderr | 2 +- .../pattern/pat-tuple-field-count-cross.stderr | 8 ++++---- tests/ui/pattern/pat-tuple-overfield.stderr | 12 ++++++------ tests/ui/pattern/pattern-error-continue.stderr | 2 +- .../unit-variant-pattern-matching-29383.stderr | 4 ++-- tests/ui/resolve/empty-struct-unit-pat.stderr | 16 ++++++++-------- tests/ui/suggestions/issue-84700.stderr | 2 +- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 2522db2fd7632..f9dae2aa21917 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -2639,7 +2639,7 @@ impl<'ast, 'ra, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> { ); err.span_suggestion_verbose( span, - "use this syntax instead", + "use the unit struct syntax instead", path_str, Applicability::MaybeIncorrect, ); diff --git a/tests/ui/match/match-pattern-field-mismatch-2.stderr b/tests/ui/match/match-pattern-field-mismatch-2.stderr index a4785d1f6b961..4403487dea250 100644 --- a/tests/ui/match/match-pattern-field-mismatch-2.stderr +++ b/tests/ui/match/match-pattern-field-mismatch-2.stderr @@ -7,7 +7,7 @@ LL | NoColor, LL | Color::NoColor(_) => { } | ^^^^^^^^^^^^^^^^^ | -help: use this syntax instead +help: use the unit struct syntax instead | LL - Color::NoColor(_) => { } LL + Color::NoColor => { } diff --git a/tests/ui/pattern/constructor-type-mismatch.stderr b/tests/ui/pattern/constructor-type-mismatch.stderr index 049d2d848ffc1..516e0d58531f1 100644 --- a/tests/ui/pattern/constructor-type-mismatch.stderr +++ b/tests/ui/pattern/constructor-type-mismatch.stderr @@ -31,7 +31,7 @@ LL | struct S; LL | S(()) => {} | ^^^^^ | -help: use this syntax instead +help: use the unit struct syntax instead | LL - S(()) => {} LL + S => {} diff --git a/tests/ui/pattern/pat-tuple-field-count-cross.stderr b/tests/ui/pattern/pat-tuple-field-count-cross.stderr index 68095b0e7e755..59f0c87616e17 100644 --- a/tests/ui/pattern/pat-tuple-field-count-cross.stderr +++ b/tests/ui/pattern/pat-tuple-field-count-cross.stderr @@ -26,7 +26,7 @@ note: similarly named tuple struct `Z1` defined here | LL | pub struct Z1(); | ^^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - Z0() => {} LL + Z0 => {} @@ -53,7 +53,7 @@ note: similarly named tuple struct `Z1` defined here | LL | pub struct Z1(); | ^^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - Z0(x) => {} LL + Z0 => {} @@ -80,7 +80,7 @@ note: similarly named tuple variant `Z1` defined here | LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | ^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - E1::Z0() => {} LL + E1::Z0 => {} @@ -107,7 +107,7 @@ note: similarly named tuple variant `Z1` defined here | LL | pub enum E1 { Z0, Z1(), S(u8, u8, u8) } | ^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - E1::Z0(x) => {} LL + E1::Z0 => {} diff --git a/tests/ui/pattern/pat-tuple-overfield.stderr b/tests/ui/pattern/pat-tuple-overfield.stderr index 151eee506d801..ad478a308367f 100644 --- a/tests/ui/pattern/pat-tuple-overfield.stderr +++ b/tests/ui/pattern/pat-tuple-overfield.stderr @@ -24,7 +24,7 @@ note: similarly named tuple struct `Z1` defined here | LL | struct Z1(); | ^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - Z0() => {} LL + Z0 => {} @@ -49,7 +49,7 @@ note: similarly named tuple struct `Z1` defined here | LL | struct Z1(); | ^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - Z0(_) => {} LL + Z0 => {} @@ -74,7 +74,7 @@ note: similarly named tuple struct `Z1` defined here | LL | struct Z1(); | ^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - Z0(_, _) => {} LL + Z0 => {} @@ -99,7 +99,7 @@ note: similarly named tuple variant `Z1` defined here | LL | Z1(), | ^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - E1::Z0() => {} LL + E1::Z0 => {} @@ -124,7 +124,7 @@ note: similarly named tuple variant `Z1` defined here | LL | Z1(), | ^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - E1::Z0(_) => {} LL + E1::Z0 => {} @@ -149,7 +149,7 @@ note: similarly named tuple variant `Z1` defined here | LL | Z1(), | ^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - E1::Z0(_, _) => {} LL + E1::Z0 => {} diff --git a/tests/ui/pattern/pattern-error-continue.stderr b/tests/ui/pattern/pattern-error-continue.stderr index e903064ce38c7..6d08f6fa8ef6b 100644 --- a/tests/ui/pattern/pattern-error-continue.stderr +++ b/tests/ui/pattern/pattern-error-continue.stderr @@ -12,7 +12,7 @@ note: similarly named tuple variant `B` defined here | LL | B(isize, isize), | ^^^^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - A::D(_) => (), LL + A::D => (), diff --git a/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr b/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr index e14677aea59cc..ae2329cca0fc1 100644 --- a/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr +++ b/tests/ui/pattern/unit-variant-pattern-matching-29383.stderr @@ -7,7 +7,7 @@ LL | A, LL | Some(E::A(..)) => {} | ^^^^^^^^ | -help: use this syntax instead +help: use the unit struct syntax instead | LL - Some(E::A(..)) => {} LL + Some(E::A) => {} @@ -22,7 +22,7 @@ LL | B, LL | Some(E::B(..)) => {} | ^^^^^^^^ | -help: use this syntax instead +help: use the unit struct syntax instead | LL - Some(E::B(..)) => {} LL + Some(E::B) => {} diff --git a/tests/ui/resolve/empty-struct-unit-pat.stderr b/tests/ui/resolve/empty-struct-unit-pat.stderr index 276e240ee25bf..673694b0f0d76 100644 --- a/tests/ui/resolve/empty-struct-unit-pat.stderr +++ b/tests/ui/resolve/empty-struct-unit-pat.stderr @@ -12,7 +12,7 @@ note: similarly named tuple struct `XEmpty6` defined here | LL | pub struct XEmpty6(); | ^^^^^^^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - Empty2() => () LL + Empty2 => () @@ -39,7 +39,7 @@ note: similarly named tuple struct `XEmpty6` defined here | LL | pub struct XEmpty6(); | ^^^^^^^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - XEmpty2() => () LL + XEmpty2 => () @@ -64,7 +64,7 @@ note: similarly named tuple struct `XEmpty6` defined here | LL | pub struct XEmpty6(); | ^^^^^^^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - Empty2(..) => () LL + Empty2 => () @@ -91,7 +91,7 @@ note: similarly named tuple struct `XEmpty6` defined here | LL | pub struct XEmpty6(); | ^^^^^^^^^^^^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - XEmpty2(..) => () LL + XEmpty2 => () @@ -111,7 +111,7 @@ LL | Empty4 LL | E::Empty4() => () | ^^^^^^^^^^^ | -help: use this syntax instead +help: use the unit struct syntax instead | LL - E::Empty4() => () LL + E::Empty4 => () @@ -133,7 +133,7 @@ note: similarly named tuple variant `XEmpty5` defined here | LL | XEmpty5(), | ^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - XE::XEmpty4() => (), LL + XE::XEmpty4 => (), @@ -153,7 +153,7 @@ LL | Empty4 LL | E::Empty4(..) => () | ^^^^^^^^^^^^^ | -help: use this syntax instead +help: use the unit struct syntax instead | LL - E::Empty4(..) => () LL + E::Empty4 => () @@ -175,7 +175,7 @@ note: similarly named tuple variant `XEmpty5` defined here | LL | XEmpty5(), | ^^^^^^^ -help: use this syntax instead +help: use the unit struct syntax instead | LL - XE::XEmpty4(..) => (), LL + XE::XEmpty4 => (), diff --git a/tests/ui/suggestions/issue-84700.stderr b/tests/ui/suggestions/issue-84700.stderr index 1aa1cfcb84c66..fc1c10da0dd43 100644 --- a/tests/ui/suggestions/issue-84700.stderr +++ b/tests/ui/suggestions/issue-84700.stderr @@ -7,7 +7,7 @@ LL | Cow, LL | FarmAnimal::Cow(_) => "moo".to_string(), | ^^^^^^^^^^^^^^^^^^ | -help: use this syntax instead +help: use the unit struct syntax instead | LL - FarmAnimal::Cow(_) => "moo".to_string(), LL + FarmAnimal::Cow => "moo".to_string(), From 2f0913429abd06db218dd0d6d6d2ec93f93d368e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Sun, 20 Sep 2026 03:45:24 +0000 Subject: [PATCH 04/16] When pointing at variant definition in E0559, display enum def line too --- compiler/rustc_hir_typeck/src/expr.rs | 1 + .../enum-variant-field-error-80607.stderr | 1 + .../suggestions/incorrect-variant-literal.svg | 818 +++++++++--------- .../nested-non-tuple-tuple-struct.stderr | 4 + 4 files changed, 421 insertions(+), 403 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index a8898acf3a415..dd106c159f9b6 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -2606,6 +2606,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { match variant.ctor { Some((CtorKind::Fn, def_id)) => match ty.kind() { ty::Adt(adt, ..) if adt.is_enum() => { + err.span_context(self.tcx.def_span(adt.did()).shrink_to_lo()); err.span_label( variant_ident_span, format!( diff --git a/tests/ui/enum/enum-variant-field-error-80607.stderr b/tests/ui/enum/enum-variant-field-error-80607.stderr index 8d088ef04bbbf..4d6fb0dea5376 100644 --- a/tests/ui/enum/enum-variant-field-error-80607.stderr +++ b/tests/ui/enum/enum-variant-field-error-80607.stderr @@ -1,6 +1,7 @@ error[E0559]: variant `Enum::V1` has no field named `x` --> $DIR/enum-variant-field-error-80607.rs:8:16 | +LL | pub enum Enum { LL | V1(i32), | -- `Enum::V1` defined here ... diff --git a/tests/ui/suggestions/incorrect-variant-literal.svg b/tests/ui/suggestions/incorrect-variant-literal.svg index 54eaee2a2e906..6dee6eaf9b1c4 100644 --- a/tests/ui/suggestions/incorrect-variant-literal.svg +++ b/tests/ui/suggestions/incorrect-variant-literal.svg @@ -1,4 +1,4 @@ - + ) -> PResult<'a, ()> { while !self.check(exp!(CloseParen)) { self.parse_pat_no_top_alt(None, None)?; if !self.eat(exp!(Comma)) { return Ok(()); } + comma_spans.push(self.prev_token.span); } Ok(()) } diff --git a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr index 286d602139665..1254e02b5406b 100644 --- a/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr +++ b/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr @@ -35,7 +35,7 @@ LL | (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true help: ...or a vertical bar to match on alternatives | LL - Nucleotide::Adenine, Nucleotide::Cytosine, _ => true -LL + Nucleotide::Adenine | Nucleotide::Cytosine, _ => true +LL + Nucleotide::Adenine | Nucleotide::Cytosine | _ => true | error: unexpected `,` in pattern diff --git a/tests/ui/suggestions/multiple-pattern-commas.fixed b/tests/ui/suggestions/multiple-pattern-commas.fixed new file mode 100644 index 0000000000000..32ac6132d6c43 --- /dev/null +++ b/tests/ui/suggestions/multiple-pattern-commas.fixed @@ -0,0 +1,15 @@ +//@ run-rustfix +// Replace every top-level comma with `|`, preserving commas inside tuple patterns. + +fn matches_pair(pair: (u8, u8)) -> bool { + match pair { + ((0, 1) | (2, 3) | (4, 5)) => true, + //~^ ERROR unexpected `,` in pattern + _ => false, + } +} + +fn main() { + assert!(matches_pair((0, 1))); + assert!(!matches_pair((0, 5))); +} diff --git a/tests/ui/suggestions/multiple-pattern-commas.rs b/tests/ui/suggestions/multiple-pattern-commas.rs index f36ff931fd78c..f3e0b1490a619 100644 --- a/tests/ui/suggestions/multiple-pattern-commas.rs +++ b/tests/ui/suggestions/multiple-pattern-commas.rs @@ -1,4 +1,4 @@ - +//@ run-rustfix // Replace every top-level comma with `|`, preserving commas inside tuple patterns. fn matches_pair(pair: (u8, u8)) -> bool { diff --git a/tests/ui/suggestions/multiple-pattern-commas.stderr b/tests/ui/suggestions/multiple-pattern-commas.stderr index 5d2c46a3c1f64..72d232610fc53 100644 --- a/tests/ui/suggestions/multiple-pattern-commas.stderr +++ b/tests/ui/suggestions/multiple-pattern-commas.stderr @@ -11,7 +11,7 @@ LL | ((0, 1), (2, 3), (4, 5)) => true, help: ...or a vertical bar to match on alternatives | LL - (0, 1), (2, 3), (4, 5) => true, -LL + (0, 1) | (2, 3), (4, 5) => true, +LL + (0, 1) | (2, 3) | (4, 5) => true, | error: aborting due to 1 previous error From 83bdaf915a705017aa273da224008291a04f67a2 Mon Sep 17 00:00:00 2001 From: Yukang Date: Fri, 25 Sep 2026 18:43:31 +0800 Subject: [PATCH 08/16] Don't lint unused_qualifications when the unqualified path is ambiguous --- compiler/rustc_resolve/src/late.rs | 7 ++++++ .../wildcard-imports-issue-163310.rs | 25 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/ui/lint/unused-qualifications/wildcard-imports-issue-163310.rs diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index e1787eadf5fb9..a4d00e5241a34 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -5634,6 +5634,13 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> { let ns = if i + 1 == path.len() { ns } else { TypeNS }; let res = self.r.partial_res_map.get(&seg.id?)?.full_res()?; let binding = self.resolve_ident_in_lexical_scope(seg.ident, ns, None, None)?; + // Do not suggest removing the qualification if the unqualified path would be + // ambiguous, e.g. when several glob imports bring the same name into scope. + if let LateDecl::Decl(binding) = binding + && binding.descent_to_ambiguity().is_some() + { + return None; + } (res == binding.res()).then_some((seg, binding)) }); diff --git a/tests/ui/lint/unused-qualifications/wildcard-imports-issue-163310.rs b/tests/ui/lint/unused-qualifications/wildcard-imports-issue-163310.rs new file mode 100644 index 0000000000000..544dfee6d9238 --- /dev/null +++ b/tests/ui/lint/unused-qualifications/wildcard-imports-issue-163310.rs @@ -0,0 +1,25 @@ +//! Regression test for https://github.com/rust-lang/rust/issues/163310. +//! `unused_qualifications` must not suggest removing a qualification when the +//! unqualified path would be ambiguous because of multiple glob imports. + +//@ check-pass + +#![deny(unused_qualifications)] +#![allow(dead_code)] + +pub type T = String; + +mod mod_a { + pub type T = bool; + pub const C: i32 = 42; +} + +mod mod_b { + use crate::mod_a::*; + use crate::*; + + type T2 = mod_a::T; + const C2: i32 = C; +} + +fn main() {} From 5b3e42a5627c162b00f70a07d131242f588ef299 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Tue, 15 Sep 2026 09:50:40 -0700 Subject: [PATCH 09/16] Make the suggestion message of `unused_must_use` scarier. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The old message, “help: use `let _ = ...` to ignore the resulting value” (or its variation with `let _unused` for `needs_drop` values), contains no indication that this is something that you might not want to do, and in fact can be read as saying that one *should* do this. The new message, “if you wish to disregard this recommendation, use `let _ = ...` to ignore the value”, is intended to make it clear that this is a choice. --- compiler/rustc_lint/src/diagnostics.rs | 12 +++--- .../ui/attributes/attr-order-must-use.stderr | 2 +- .../cfg-attr-multi-true.stderr | 2 +- .../decorate-can-emit-warnings.stderr | 2 +- .../decorate-ice/decorate-force-warn.stderr | 2 +- tests/ui/lint/fn_must_use.stderr | 16 +++---- tests/ui/lint/unused-borrows.stderr | 12 +++--- .../unused/issue-103320-must-use-ops.stderr | 10 ++--- tests/ui/lint/unused/issue-85913.stderr | 2 +- .../lint-unsed-in-macro-issue-151269.stderr | 2 +- .../ui/lint/unused/must-use-block-expr.stderr | 8 ++-- .../lint/unused/must-use-box-from-raw.stderr | 2 +- .../must-use-lock-guard-issue-162843.stderr | 10 ++--- tests/ui/lint/unused/must-use-macros.stderr | 6 +-- tests/ui/lint/unused/must-use-ops.stderr | 42 +++++++++---------- .../must_use-result-unit-uninhabited.stderr | 12 +++--- tests/ui/lint/unused/must_use-unit.stderr | 4 +- tests/ui/lint/unused/unused-async.stderr | 6 +-- tests/ui/lint/unused/unused-result.stderr | 8 ++-- .../unused/unused_attributes-must_use.stderr | 14 +++---- .../ui/macros/must-use-in-macro-55516.stderr | 2 +- 21 files changed, 88 insertions(+), 88 deletions(-) diff --git a/compiler/rustc_lint/src/diagnostics.rs b/compiler/rustc_lint/src/diagnostics.rs index 3887211465b32..3ed2c3bb1b6c8 100644 --- a/compiler/rustc_lint/src/diagnostics.rs +++ b/compiler/rustc_lint/src/diagnostics.rs @@ -2613,7 +2613,7 @@ pub(crate) struct UnusedOp<'a> { #[derive(Subdiagnostic)] pub(crate) enum UnusedOpSuggestion { #[suggestion( - "use `let _ = ...` to ignore the resulting value", + "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value", style = "verbose", code = "let _ = ", applicability = "maybe-incorrect" @@ -2623,7 +2623,7 @@ pub(crate) enum UnusedOpSuggestion { span: Span, }, #[multipart_suggestion( - "use `let _ = ...` to ignore the resulting value", + "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value", style = "verbose", applicability = "maybe-incorrect" )] @@ -2687,7 +2687,7 @@ pub(crate) struct UnusedDef<'a, 'b> { #[derive(Subdiagnostic)] pub(crate) enum UnusedDefSuggestion { #[suggestion( - "use `let _ = ...` to ignore the resulting value", + "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value", style = "verbose", code = "let _ = ", applicability = "maybe-incorrect" @@ -2697,7 +2697,7 @@ pub(crate) enum UnusedDefSuggestion { span: Span, }, #[multipart_suggestion( - "use `let _ = ...` to ignore the resulting value", + "if you wish to disregard this recommendation, use `let _ = ...` to ignore the value", style = "verbose", applicability = "maybe-incorrect" )] @@ -2708,7 +2708,7 @@ pub(crate) enum UnusedDefSuggestion { after_span: Span, }, #[suggestion( - "use `let _unused = ...` to ignore the resulting value without dropping it immediately", + "if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately", style = "verbose", code = "let _unused = ", applicability = "maybe-incorrect" @@ -2718,7 +2718,7 @@ pub(crate) enum UnusedDefSuggestion { span: Span, }, #[multipart_suggestion( - "use `let _unused = ...` to ignore the resulting value without dropping it immediately", + "if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately", style = "verbose", applicability = "maybe-incorrect" )] diff --git a/tests/ui/attributes/attr-order-must-use.stderr b/tests/ui/attributes/attr-order-must-use.stderr index 18b5811623017..79c040cebe9c3 100644 --- a/tests/ui/attributes/attr-order-must-use.stderr +++ b/tests/ui/attributes/attr-order-must-use.stderr @@ -25,7 +25,7 @@ LL | must_use(); | = note: AAA = note: `#[deny(unused_must_use)]` implied by `#[deny(unused)]` -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = must_use(); | +++++++ diff --git a/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr b/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr index 123ce71727f67..40067e99bd8b7 100644 --- a/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr +++ b/tests/ui/conditional-compilation/cfg-attr-multi-true.stderr @@ -35,7 +35,7 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = MustUseDeprecated::new(); | +++++++ diff --git a/tests/ui/lint/decorate-ice/decorate-can-emit-warnings.stderr b/tests/ui/lint/decorate-ice/decorate-can-emit-warnings.stderr index fde81de6136ed..7991079a90e04 100644 --- a/tests/ui/lint/decorate-ice/decorate-can-emit-warnings.stderr +++ b/tests/ui/lint/decorate-ice/decorate-can-emit-warnings.stderr @@ -5,7 +5,7 @@ LL | f(); | ^^^ | = note: requested on the command line with `-D unused-must-use` -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = f(); | +++++++ diff --git a/tests/ui/lint/decorate-ice/decorate-force-warn.stderr b/tests/ui/lint/decorate-ice/decorate-force-warn.stderr index 5e6b74d414b27..7376064d8a29e 100644 --- a/tests/ui/lint/decorate-ice/decorate-force-warn.stderr +++ b/tests/ui/lint/decorate-ice/decorate-force-warn.stderr @@ -5,7 +5,7 @@ LL | f(); | ^^^ | = note: requested on the command line with `--force-warn unused-must-use` -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = f(); | +++++++ diff --git a/tests/ui/lint/fn_must_use.stderr b/tests/ui/lint/fn_must_use.stderr index 1277a6283c645..c2e330725c821 100644 --- a/tests/ui/lint/fn_must_use.stderr +++ b/tests/ui/lint/fn_must_use.stderr @@ -20,7 +20,7 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = need_to_use_this_value(); | +++++++ @@ -31,7 +31,7 @@ warning: unused return value of `MyStruct::need_to_use_this_method_value` that m LL | m.need_to_use_this_method_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = m.need_to_use_this_method_value(); | +++++++ @@ -43,7 +43,7 @@ LL | m.is_even(); // trait method! | ^^^^^^^^^^^ | = note: no side effects -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = m.is_even(); // trait method! | +++++++ @@ -54,7 +54,7 @@ warning: unused return value of `MyStruct::need_to_use_this_associated_function_ LL | MyStruct::need_to_use_this_associated_function_value(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = MyStruct::need_to_use_this_associated_function_value(); | +++++++ @@ -65,7 +65,7 @@ warning: unused return value of `std::cmp::PartialEq::eq` that must be used LL | 2.eq(&3); | ^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 2.eq(&3); | +++++++ @@ -76,7 +76,7 @@ warning: unused return value of `std::cmp::PartialEq::eq` that must be used LL | m.eq(&n); | ^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = m.eq(&n); | +++++++ @@ -87,7 +87,7 @@ warning: unused comparison that must be used LL | 2 == 3; | ^^^^^^ the comparison produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 2 == 3; | +++++++ @@ -98,7 +98,7 @@ warning: unused comparison that must be used LL | m == n; | ^^^^^^ the comparison produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = m == n; | +++++++ diff --git a/tests/ui/lint/unused-borrows.stderr b/tests/ui/lint/unused-borrows.stderr index d8dd2b5fddf94..7157ac555405a 100644 --- a/tests/ui/lint/unused-borrows.stderr +++ b/tests/ui/lint/unused-borrows.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = &42; | +++++++ @@ -20,7 +20,7 @@ error: unused borrow that must be used LL | &mut foo(42); | ^^^^^^^^^^^^ the borrow produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = &mut foo(42); | +++++++ @@ -31,7 +31,7 @@ error: unused borrow that must be used LL | &&42; | ^^^^ the borrow produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = &&42; | +++++++ @@ -42,7 +42,7 @@ error: unused borrow that must be used LL | &&mut 42; | ^^^^^^^^ the borrow produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = &&mut 42; | +++++++ @@ -53,7 +53,7 @@ error: unused borrow that must be used LL | &mut &42; | ^^^^^^^^ the borrow produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = &mut &42; | +++++++ @@ -64,7 +64,7 @@ error: unused borrow that must be used LL | && foo(42); | ^^^^^^^^^^ the borrow produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = && foo(42); | +++++++ diff --git a/tests/ui/lint/unused/issue-103320-must-use-ops.stderr b/tests/ui/lint/unused/issue-103320-must-use-ops.stderr index 0f32757ed20fd..eae3639f48d66 100644 --- a/tests/ui/lint/unused/issue-103320-must-use-ops.stderr +++ b/tests/ui/lint/unused/issue-103320-must-use-ops.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = x.add(4); | +++++++ @@ -22,7 +22,7 @@ LL | x.sub(4); | ^^^^^^^^ | = note: this returns the result of the operation, without modifying the original -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = x.sub(4); | +++++++ @@ -34,7 +34,7 @@ LL | x.mul(4); | ^^^^^^^^ | = note: this returns the result of the operation, without modifying the original -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = x.mul(4); | +++++++ @@ -46,7 +46,7 @@ LL | x.div(4); | ^^^^^^^^ | = note: this returns the result of the operation, without modifying the original -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = x.div(4); | +++++++ @@ -58,7 +58,7 @@ LL | x.rem(4); | ^^^^^^^^ | = note: this returns the result of the operation, without modifying the original -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = x.rem(4); | +++++++ diff --git a/tests/ui/lint/unused/issue-85913.stderr b/tests/ui/lint/unused/issue-85913.stderr index b69ac3d97fd25..84f1d31aa7469 100644 --- a/tests/ui/lint/unused/issue-85913.stderr +++ b/tests/ui/lint/unused/issue-85913.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = function() && return 1; | +++++++ diff --git a/tests/ui/lint/unused/lint-unsed-in-macro-issue-151269.stderr b/tests/ui/lint/unused/lint-unsed-in-macro-issue-151269.stderr index 12cedf58974b7..dada2909d5bec 100644 --- a/tests/ui/lint/unused/lint-unsed-in-macro-issue-151269.stderr +++ b/tests/ui/lint/unused/lint-unsed-in-macro-issue-151269.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = error(); | +++++++ diff --git a/tests/ui/lint/unused/must-use-block-expr.stderr b/tests/ui/lint/unused/must-use-block-expr.stderr index d821beb1d92e7..f432ce5337180 100644 --- a/tests/ui/lint/unused/must-use-block-expr.stderr +++ b/tests/ui/lint/unused/must-use-block-expr.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo(); | +++++++ @@ -20,7 +20,7 @@ warning: unused return value of `foo` that must be used LL | foo() | ^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo(); | +++++++ + @@ -31,7 +31,7 @@ warning: unused arithmetic operation that must be used LL | 1 + 2; | ^^^^^ the arithmetic operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 1 + 2; | +++++++ @@ -42,7 +42,7 @@ warning: unused arithmetic operation that must be used LL | 1 + 2 | ^^^^^ the arithmetic operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 1 + 2; | +++++++ + diff --git a/tests/ui/lint/unused/must-use-box-from-raw.stderr b/tests/ui/lint/unused/must-use-box-from-raw.stderr index 7eab99e97cd82..0a1d3dba598fd 100644 --- a/tests/ui/lint/unused/must-use-box-from-raw.stderr +++ b/tests/ui/lint/unused/must-use-box-from-raw.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _unused = ...` to ignore the resulting value without dropping it immediately +help: if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately | LL | let _unused = Box::from_raw(ptr); | +++++++++++++ diff --git a/tests/ui/lint/unused/must-use-lock-guard-issue-162843.stderr b/tests/ui/lint/unused/must-use-lock-guard-issue-162843.stderr index 8fa5c693f2561..ff5a6413db10e 100644 --- a/tests/ui/lint/unused/must-use-lock-guard-issue-162843.stderr +++ b/tests/ui/lint/unused/must-use-lock-guard-issue-162843.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _unused = ...` to ignore the resulting value without dropping it immediately +help: if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately | LL | let _unused = mutex.lock().unwrap(); | +++++++++++++ @@ -21,7 +21,7 @@ error: unused return value of `guard` that must be used LL | guard(); | ^^^^^^^ | -help: use `let _unused = ...` to ignore the resulting value without dropping it immediately +help: if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately | LL | let _unused = guard(); | +++++++++++++ @@ -32,7 +32,7 @@ error: unused return value of `value` that must be used LL | value(); | ^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = value(); | +++++++ @@ -43,7 +43,7 @@ error: unused return value of `vec_values` that must be used LL | vec_values(); | ^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = vec_values(); | +++++++ @@ -54,7 +54,7 @@ error: unused return value of `box_value` that must be used LL | box_value(); | ^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = box_value(); | +++++++ diff --git a/tests/ui/lint/unused/must-use-macros.stderr b/tests/ui/lint/unused/must-use-macros.stderr index c5e9de20595b1..52251068901ff 100644 --- a/tests/ui/lint/unused/must-use-macros.stderr +++ b/tests/ui/lint/unused/must-use-macros.stderr @@ -14,7 +14,7 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = cmp!(a, b); | +++++++ @@ -30,7 +30,7 @@ LL | $a == $b LL | cmp!(1, 1); | ---------- in this macro invocation | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = cmp!(1, 1); | +++++++ @@ -41,7 +41,7 @@ warning: unused return value of `std::cmp::PartialEq::eq` that must be used LL | cmp!(1, 1); | ^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = cmp!(1, 1); | +++++++ diff --git a/tests/ui/lint/unused/must-use-ops.stderr b/tests/ui/lint/unused/must-use-ops.stderr index 41594f47a1398..14cdeabec4614 100644 --- a/tests/ui/lint/unused/must-use-ops.stderr +++ b/tests/ui/lint/unused/must-use-ops.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![warn(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val == 1; | +++++++ @@ -20,7 +20,7 @@ warning: unused comparison that must be used LL | val < 1; | ^^^^^^^ the comparison produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val < 1; | +++++++ @@ -31,7 +31,7 @@ warning: unused comparison that must be used LL | val <= 1; | ^^^^^^^^ the comparison produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val <= 1; | +++++++ @@ -42,7 +42,7 @@ warning: unused comparison that must be used LL | val != 1; | ^^^^^^^^ the comparison produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val != 1; | +++++++ @@ -53,7 +53,7 @@ warning: unused comparison that must be used LL | val >= 1; | ^^^^^^^^ the comparison produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val >= 1; | +++++++ @@ -64,7 +64,7 @@ warning: unused comparison that must be used LL | val > 1; | ^^^^^^^ the comparison produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val > 1; | +++++++ @@ -75,7 +75,7 @@ warning: unused arithmetic operation that must be used LL | val + 2; | ^^^^^^^ the arithmetic operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val + 2; | +++++++ @@ -86,7 +86,7 @@ warning: unused arithmetic operation that must be used LL | val - 2; | ^^^^^^^ the arithmetic operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val - 2; | +++++++ @@ -97,7 +97,7 @@ warning: unused arithmetic operation that must be used LL | val / 2; | ^^^^^^^ the arithmetic operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val / 2; | +++++++ @@ -108,7 +108,7 @@ warning: unused arithmetic operation that must be used LL | val * 2; | ^^^^^^^ the arithmetic operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val * 2; | +++++++ @@ -119,7 +119,7 @@ warning: unused arithmetic operation that must be used LL | val % 2; | ^^^^^^^ the arithmetic operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = val % 2; | +++++++ @@ -130,7 +130,7 @@ warning: unused logical operation that must be used LL | true && true; | ^^^^^^^^^^^^ the logical operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = true && true; | +++++++ @@ -141,7 +141,7 @@ warning: unused logical operation that must be used LL | false || true; | ^^^^^^^^^^^^^ the logical operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = false || true; | +++++++ @@ -152,7 +152,7 @@ warning: unused bitwise operation that must be used LL | 5 ^ val; | ^^^^^^^ the bitwise operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 5 ^ val; | +++++++ @@ -163,7 +163,7 @@ warning: unused bitwise operation that must be used LL | 5 & val; | ^^^^^^^ the bitwise operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 5 & val; | +++++++ @@ -174,7 +174,7 @@ warning: unused bitwise operation that must be used LL | 5 | val; | ^^^^^^^ the bitwise operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 5 | val; | +++++++ @@ -185,7 +185,7 @@ warning: unused bitwise operation that must be used LL | 5 << val; | ^^^^^^^^ the bitwise operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 5 << val; | +++++++ @@ -196,7 +196,7 @@ warning: unused bitwise operation that must be used LL | 5 >> val; | ^^^^^^^^ the bitwise operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = 5 >> val; | +++++++ @@ -207,7 +207,7 @@ warning: unused unary operation that must be used LL | !val; | ^^^^ the unary operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = !val; | +++++++ @@ -218,7 +218,7 @@ warning: unused unary operation that must be used LL | -val; | ^^^^ the unary operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = -val; | +++++++ @@ -229,7 +229,7 @@ warning: unused unary operation that must be used LL | *val_pointer; | ^^^^^^^^^^^^ the unary operation produces a value | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = *val_pointer; | +++++++ diff --git a/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr b/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr index 13c51a588fb03..75c08baededf8 100644 --- a/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr +++ b/tests/ui/lint/unused/must_use-result-unit-uninhabited.stderr @@ -10,7 +10,7 @@ note: the lint level is defined here | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = result_unit_unit(); | +++++++ @@ -28,7 +28,7 @@ LL | result_unit_myuninhabited_nonexhaustive(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = result_unit_myuninhabited_nonexhaustive(); | +++++++ @@ -40,7 +40,7 @@ LL | result_unit_assoctype(S2); | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = result_unit_assoctype(S2); | +++++++ @@ -52,7 +52,7 @@ LL | S2.method_use_assoc_type(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = S2.method_use_assoc_type(); | +++++++ @@ -63,7 +63,7 @@ error: unused `ControlFlow` that must be used LL | controlflow_unit(); | ^^^^^^^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = controlflow_unit(); | +++++++ @@ -75,7 +75,7 @@ LL | self.generate(); | ^^^^^^^^^^^^^^^ | = note: this `Result` may be an `Err` variant, which should be handled -help: use `let _unused = ...` to ignore the resulting value without dropping it immediately +help: if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately | LL | let _unused = self.generate(); | +++++++++++++ diff --git a/tests/ui/lint/unused/must_use-unit.stderr b/tests/ui/lint/unused/must_use-unit.stderr index b6e365a468173..c5328c1f3d3b4 100644 --- a/tests/ui/lint/unused/must_use-unit.stderr +++ b/tests/ui/lint/unused/must_use-unit.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo(); | +++++++ @@ -20,7 +20,7 @@ error: unused return value of `bar` that must be used LL | bar(); | ^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = bar(); | +++++++ diff --git a/tests/ui/lint/unused/unused-async.stderr b/tests/ui/lint/unused/unused-async.stderr index 43bc73d2758c1..08c949072012c 100644 --- a/tests/ui/lint/unused/unused-async.stderr +++ b/tests/ui/lint/unused/unused-async.stderr @@ -17,7 +17,7 @@ error: unused return value of `foo` that must be used LL | foo(); | ^^^^^ | -help: use `let _unused = ...` to ignore the resulting value without dropping it immediately +help: if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately | LL | let _unused = foo(); | +++++++++++++ @@ -28,7 +28,7 @@ error: unused output of future returned by `foo` that must be used LL | foo().await; | ^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo().await; | +++++++ @@ -47,7 +47,7 @@ error: unused return value of `bar` that must be used LL | bar(); | ^^^^^ | -help: use `let _unused = ...` to ignore the resulting value without dropping it immediately +help: if you wish to disregard this recommendation, use `let _unused = ...` to ignore the resulting value without dropping it immediately | LL | let _unused = bar(); | +++++++++++++ diff --git a/tests/ui/lint/unused/unused-result.stderr b/tests/ui/lint/unused/unused-result.stderr index b584733ba1cb4..8d369f3ad556e 100644 --- a/tests/ui/lint/unused/unused-result.stderr +++ b/tests/ui/lint/unused/unused-result.stderr @@ -9,7 +9,7 @@ note: the lint level is defined here | LL | #![deny(unused_results, unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo::(); | +++++++ @@ -21,7 +21,7 @@ LL | foo::(); | ^^^^^^^^^^^^^^^^^^^ | = note: some message -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo::(); | +++++++ @@ -44,7 +44,7 @@ error: unused `MustUse` that must be used LL | foo::(); | ^^^^^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo::(); | +++++++ @@ -56,7 +56,7 @@ LL | foo::(); | ^^^^^^^^^^^^^^^^^^^ | = note: some message -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo::(); | +++++++ diff --git a/tests/ui/lint/unused/unused_attributes-must_use.stderr b/tests/ui/lint/unused/unused_attributes-must_use.stderr index 18340f963801e..0730408d6e658 100644 --- a/tests/ui/lint/unused/unused_attributes-must_use.stderr +++ b/tests/ui/lint/unused/unused_attributes-must_use.stderr @@ -213,7 +213,7 @@ note: the lint level is defined here | LL | #![deny(unused_attributes, unused_must_use)] | ^^^^^^^^^^^^^^^ -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = X; | +++++++ @@ -224,7 +224,7 @@ error: unused `Y` that must be used LL | Y::Z; | ^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = Y::Z; | +++++++ @@ -235,7 +235,7 @@ error: unused `U` that must be used LL | U { unit: () }; | ^^^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = U { unit: () }; | +++++++ @@ -246,7 +246,7 @@ error: unused return value of `U::method` that must be used LL | U::method(); | ^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = U::method(); | +++++++ @@ -257,7 +257,7 @@ error: unused return value of `foo` that must be used LL | foo(); | ^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foo(); | +++++++ @@ -268,7 +268,7 @@ error: unused return value of `foreign_foo` that must be used LL | foreign_foo(); | ^^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = foreign_foo(); | +++++++ @@ -279,7 +279,7 @@ error: unused return value of `Use::get_four` that must be used LL | ().get_four(); | ^^^^^^^^^^^^^ | -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = ().get_four(); | +++++++ diff --git a/tests/ui/macros/must-use-in-macro-55516.stderr b/tests/ui/macros/must-use-in-macro-55516.stderr index b93d40d7e5a81..90d3c62e0d915 100644 --- a/tests/ui/macros/must-use-in-macro-55516.stderr +++ b/tests/ui/macros/must-use-in-macro-55516.stderr @@ -7,7 +7,7 @@ LL | write!(&mut example, "{}", 42); = note: this `Result` may be an `Err` variant, which should be handled = note: `-W unused-must-use` implied by `-W unused` = help: to override `-W unused` add `#[allow(unused_must_use)]` -help: use `let _ = ...` to ignore the resulting value +help: if you wish to disregard this recommendation, use `let _ = ...` to ignore the value | LL | let _ = write!(&mut example, "{}", 42); | +++++++ From d7cc26c7d63423d11ae69eb0ffed7c97157385cb Mon Sep 17 00:00:00 2001 From: Lucas Sunsi Abreu Date: Sun, 1 Nov 2026 09:49:30 -0300 Subject: [PATCH 10/16] Improve unused_mut spans to avoid overlap --- compiler/rustc_borrowck/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index d09f4a0a6d09f..a6e11d65fb577 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -2756,6 +2756,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, '_, 'tcx> { } let mut_span = tcx.sess.source_map().span_until_non_whitespace(span); + let span = span.trim_start(mut_span).unwrap_or(span); tcx.emit_node_span_lint(UNUSED_MUT, lint_root, span, VarNeedNotMut { span: mut_span }) } From 576e16144ba41aba970d139e94c692a6cb6a227d Mon Sep 17 00:00:00 2001 From: Lucas Sunsi Abreu Date: Sun, 1 Nov 2026 13:27:16 -0300 Subject: [PATCH 11/16] Bless test changes for update --- ...ultibyte-rendered-ansi-issue-157148.stderr | 4 +- .../expect_nested_lint_levels.stderr | 2 +- ...force_warn_expected_lints_fulfilled.stderr | 2 +- tests/ui/lint/suggestions.fixed | 5 +- tests/ui/lint/suggestions.rs | 6 +-- tests/ui/lint/suggestions.stderr | 21 ++++---- ...0-unused-variable-in-struct-pattern.stderr | 4 +- .../lint/unused/lint-unused-mut-self.stderr | 4 +- .../unused/lint-unused-mut-variables.stderr | 54 +++++++++---------- .../unused-mut-warning-captured-var.stderr | 2 +- tests/ui/nll/capture-mut-ref.stderr | 2 +- tests/ui/nll/issue-61424.stderr | 2 +- tests/ui/nll/unused-mut-issue-50343.stderr | 2 +- ...ssue-73592-borrow_mut-through-deref.stderr | 4 +- 14 files changed, 55 insertions(+), 59 deletions(-) diff --git a/tests/ui/json/multibyte-rendered-ansi-issue-157148.stderr b/tests/ui/json/multibyte-rendered-ansi-issue-157148.stderr index 268702281d88d..6b46389d84dfd 100644 --- a/tests/ui/json/multibyte-rendered-ansi-issue-157148.stderr +++ b/tests/ui/json/multibyte-rendered-ansi-issue-157148.stderr @@ -1,5 +1,5 @@ -{"$message_type":"diagnostic","message":"variable does not need to be mutable","code":{"code":"unused_mut","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/multibyte-rendered-ansi-issue-157148.rs","byte_start":365,"byte_end":370,"line_start":12,"line_end":12,"column_start":9,"column_end":14,"is_primary":true,"text":[{"text":" let mut x = 0; // 这是一段中文注释,用于在被下划线标注的行中加入多字节字符","highlight_start":9,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/multibyte-rendered-ansi-issue-157148.rs","byte_start":331,"byte_end":341,"line_start":9,"line_end":9,"column_start":9,"column_end":19,"is_primary":true,"text":[{"text":"#![warn(unused_mut)]","highlight_start":9,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove this `mut`","code":null,"level":"help","spans":[{"file_name":"$DIR/multibyte-rendered-ansi-issue-157148.rs","byte_start":365,"byte_end":369,"line_start":12,"line_end":12,"column_start":9,"column_end":13,"is_primary":true,"text":[{"text":" let mut x = 0; // 这是一段中文注释,用于在被下划线标注的行中加入多字节字符","highlight_start":9,"highlight_end":13}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"[ANSI]warning[ANSI]: variable does not need to be mutable[ANSI] - [ANSI]--> [ANSI]$DIR/multibyte-rendered-ansi-issue-157148.rs:12:9 +{"$message_type":"diagnostic","message":"variable does not need to be mutable","code":{"code":"unused_mut","explanation":null},"level":"warning","spans":[{"file_name":"$DIR/multibyte-rendered-ansi-issue-157148.rs","byte_start":369,"byte_end":370,"line_start":12,"line_end":12,"column_start":13,"column_end":14,"is_primary":true,"text":[{"text":" let mut x = 0; // 这是一段中文注释,用于在被下划线标注的行中加入多字节字符","highlight_start":13,"highlight_end":14}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"the lint level is defined here","code":null,"level":"note","spans":[{"file_name":"$DIR/multibyte-rendered-ansi-issue-157148.rs","byte_start":331,"byte_end":341,"line_start":9,"line_end":9,"column_start":9,"column_end":19,"is_primary":true,"text":[{"text":"#![warn(unused_mut)]","highlight_start":9,"highlight_end":19}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[],"rendered":null},{"message":"remove this `mut`","code":null,"level":"help","spans":[{"file_name":"$DIR/multibyte-rendered-ansi-issue-157148.rs","byte_start":365,"byte_end":369,"line_start":12,"line_end":12,"column_start":9,"column_end":13,"is_primary":true,"text":[{"text":" let mut x = 0; // 这是一段中文注释,用于在被下划线标注的行中加入多字节字符","highlight_start":9,"highlight_end":13}],"label":null,"suggested_replacement":"","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"[ANSI]warning[ANSI]: variable does not need to be mutable[ANSI] + [ANSI]--> [ANSI]$DIR/multibyte-rendered-ansi-issue-157148.rs:12:13 [ANSI]|[ANSI] [ANSI]LL[ANSI] [ANSI]|[ANSI] let mut x = 0; // 这是一段中文注释,用于在被下划线标注的行中加入多字节字符 [ANSI]|[ANSI] [ANSI]----[ANSI]^[ANSI] diff --git a/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr b/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr index 02710d9f2af20..23d5c598d4eeb 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/expect_nested_lint_levels.stderr @@ -1,5 +1,5 @@ warning: variable does not need to be mutable - --> $DIR/expect_nested_lint_levels.rs:35:13 + --> $DIR/expect_nested_lint_levels.rs:35:17 | LL | let mut v = 0; | ----^ diff --git a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr index 60ab04f1498c0..9797e8e3d1069 100644 --- a/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr +++ b/tests/ui/lint/rfc-2383-lint-reason/force_warn_expected_lints_fulfilled.stderr @@ -15,7 +15,7 @@ LL | let x = 2; = note: requested on the command line with `--force-warn unused-variables` warning: variable does not need to be mutable - --> $DIR/force_warn_expected_lints_fulfilled.rs:28:9 + --> $DIR/force_warn_expected_lints_fulfilled.rs:28:13 | LL | let mut what_does_the_fox_say = "*ding* *deng* *dung*"; | ----^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/lint/suggestions.fixed b/tests/ui/lint/suggestions.fixed index 6fd991e60d4c4..d1b4dd208598b 100644 --- a/tests/ui/lint/suggestions.fixed +++ b/tests/ui/lint/suggestions.fixed @@ -50,9 +50,8 @@ fn main() { //~| WARN unnecessary parentheses //~| HELP remove these parentheses // the line after `mut` has a `\t` at the beginning, this is on purpose - let b = 1; - //~^^ WARN does not need to be mutable - //~| HELP remove this `mut` + let //~ HELP remove this `mut` + b = 1; //~| WARN does not need to be mutable let d = Equinox { warp_factor: 9.975 }; match d { #[allow(unused_variables)] // for rustfix diff --git a/tests/ui/lint/suggestions.rs b/tests/ui/lint/suggestions.rs index c2d422828649a..f8a27ed371502 100644 --- a/tests/ui/lint/suggestions.rs +++ b/tests/ui/lint/suggestions.rs @@ -51,10 +51,8 @@ fn main() { //~| WARN unnecessary parentheses //~| HELP remove these parentheses // the line after `mut` has a `\t` at the beginning, this is on purpose - let mut - b = 1; - //~^^ WARN does not need to be mutable - //~| HELP remove this `mut` + let mut //~ HELP remove this `mut` + b = 1; //~| WARN does not need to be mutable let d = Equinox { warp_factor: 9.975 }; match d { #[allow(unused_variables)] // for rustfix diff --git a/tests/ui/lint/suggestions.stderr b/tests/ui/lint/suggestions.stderr index 68bf80e89e1bd..56895147caa36 100644 --- a/tests/ui/lint/suggestions.stderr +++ b/tests/ui/lint/suggestions.stderr @@ -24,7 +24,7 @@ LL + let mut registry_no = format!("NX-{}", 74205); | warning: variable does not need to be mutable - --> $DIR/suggestions.rs:48:13 + --> $DIR/suggestions.rs:48:17 | LL | let mut registry_no = (format!("NX-{}", 74205)); | ----^^^^^^^^^^^ @@ -38,15 +38,14 @@ LL | #![warn(unused_mut, unused_parens)] // UI tests pass `-A unused`—see Issu | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/suggestions.rs:54:13 - | -LL | let mut - | _____________^ - | |_____________| -LL | || b = 1; - | ||____________-^ - | |_____________| - | help: remove this `mut` + --> $DIR/suggestions.rs:54:17 + | +LL | let mut + | _____________----^ + | | | + | | help: remove this `mut` +LL | | b = 1; + | |_____________^ error: const items should never be `#[no_mangle]` --> $DIR/suggestions.rs:6:14 @@ -68,7 +67,7 @@ LL | pub fn defiant(_t: T) {} | ^^^^^^^^^^^^^^^^^^^^^^^^ warning: the `warp_factor:` in this pattern is redundant - --> $DIR/suggestions.rs:61:23 + --> $DIR/suggestions.rs:59:23 | LL | Equinox { warp_factor: warp_factor } => {} | ^^^^^^^^^^^^^^^^^^^^^^^^ help: use shorthand field pattern: `warp_factor` diff --git a/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr b/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr index ff4632dc8eabc..ca6958c1a5751 100644 --- a/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr +++ b/tests/ui/lint/unused/issue-47390-unused-variable-in-struct-pattern.stderr @@ -1,5 +1,5 @@ warning: variable does not need to be mutable - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:31:9 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:31:13 | LL | let mut mut_unused_var = 1; | ----^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | #![warn(unused)] // UI tests pass `-A unused` (#43896) = note: `#[warn(unused_mut)]` implied by `#[warn(unused)]` warning: variable does not need to be mutable - --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:10 + --> $DIR/issue-47390-unused-variable-in-struct-pattern.rs:35:14 | LL | let (mut var, unused_var) = (1, 2); | ----^^^ diff --git a/tests/ui/lint/unused/lint-unused-mut-self.stderr b/tests/ui/lint/unused/lint-unused-mut-self.stderr index 01a524bd323c4..4b5f5be3f97cf 100644 --- a/tests/ui/lint/unused/lint-unused-mut-self.stderr +++ b/tests/ui/lint/unused/lint-unused-mut-self.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/lint-unused-mut-self.rs:10:12 + --> $DIR/lint-unused-mut-self.rs:10:16 | LL | fn foo(mut self) {} | ----^^^^ @@ -13,7 +13,7 @@ LL | #![deny(unused_mut)] | ^^^^^^^^^^ error: variable does not need to be mutable - --> $DIR/lint-unused-mut-self.rs:11:12 + --> $DIR/lint-unused-mut-self.rs:11:16 | LL | fn bar(mut self: Box) {} | ----^^^^ diff --git a/tests/ui/lint/unused/lint-unused-mut-variables.stderr b/tests/ui/lint/unused/lint-unused-mut-variables.stderr index a16b6a378e935..b281442a4d01a 100644 --- a/tests/ui/lint/unused/lint-unused-mut-variables.stderr +++ b/tests/ui/lint/unused/lint-unused-mut-variables.stderr @@ -1,5 +1,5 @@ warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:8:5 + --> $DIR/lint-unused-mut-variables.rs:8:9 | LL | mut a: i32, | ----^ @@ -13,7 +13,7 @@ LL | #![warn(unused_mut)] | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:22:9 + --> $DIR/lint-unused-mut-variables.rs:22:13 | LL | mut a: i32, | ----^ @@ -21,7 +21,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:13:5 + --> $DIR/lint-unused-mut-variables.rs:13:9 | LL | mut a: i32, | ----^ @@ -29,7 +29,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:28:9 + --> $DIR/lint-unused-mut-variables.rs:28:13 | LL | mut a: i32, | ----^ @@ -37,7 +37,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:38:9 + --> $DIR/lint-unused-mut-variables.rs:38:13 | LL | mut a: i32, | ----^ @@ -45,7 +45,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:47:9 + --> $DIR/lint-unused-mut-variables.rs:47:13 | LL | mut a: i32, | ----^ @@ -53,7 +53,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:56:9 + --> $DIR/lint-unused-mut-variables.rs:56:13 | LL | mut a: i32, | ----^ @@ -61,7 +61,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:61:9 + --> $DIR/lint-unused-mut-variables.rs:61:13 | LL | mut a: i32, | ----^ @@ -69,7 +69,7 @@ LL | mut a: i32, | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:106:14 + --> $DIR/lint-unused-mut-variables.rs:106:18 | LL | let x = |mut y: isize| 10; | ----^ @@ -77,7 +77,7 @@ LL | let x = |mut y: isize| 10; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:68:9 + --> $DIR/lint-unused-mut-variables.rs:68:13 | LL | let mut a = 3; | ----^ @@ -85,7 +85,7 @@ LL | let mut a = 3; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:70:9 + --> $DIR/lint-unused-mut-variables.rs:70:13 | LL | let mut a = 2; | ----^ @@ -93,7 +93,7 @@ LL | let mut a = 2; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:72:9 + --> $DIR/lint-unused-mut-variables.rs:72:13 | LL | let mut b = 3; | ----^ @@ -101,7 +101,7 @@ LL | let mut b = 3; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:74:9 + --> $DIR/lint-unused-mut-variables.rs:74:13 | LL | let mut a = vec![3]; | ----^ @@ -109,7 +109,7 @@ LL | let mut a = vec![3]; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:76:10 + --> $DIR/lint-unused-mut-variables.rs:76:14 | LL | let (mut a, b) = (1, 2); | ----^ @@ -117,7 +117,7 @@ LL | let (mut a, b) = (1, 2); | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:78:9 + --> $DIR/lint-unused-mut-variables.rs:78:13 | LL | let mut a; | ----^ @@ -125,7 +125,7 @@ LL | let mut a; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:82:9 + --> $DIR/lint-unused-mut-variables.rs:82:13 | LL | let mut b; | ----^ @@ -133,7 +133,7 @@ LL | let mut b; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:91:9 + --> $DIR/lint-unused-mut-variables.rs:91:13 | LL | mut x => {} | ----^ @@ -141,7 +141,7 @@ LL | mut x => {} | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:98:10 + --> $DIR/lint-unused-mut-variables.rs:98:14 | LL | (mut x, 1) | | ----^ @@ -149,7 +149,7 @@ LL | (mut x, 1) | | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:111:9 + --> $DIR/lint-unused-mut-variables.rs:111:13 | LL | let mut a = &mut 5; | ----^ @@ -157,7 +157,7 @@ LL | let mut a = &mut 5; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:116:9 + --> $DIR/lint-unused-mut-variables.rs:116:13 | LL | let mut b = (&mut a,); | ----^ @@ -165,7 +165,7 @@ LL | let mut b = (&mut a,); | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:119:9 + --> $DIR/lint-unused-mut-variables.rs:119:13 | LL | let mut x = &mut 1; | ----^ @@ -173,7 +173,7 @@ LL | let mut x = &mut 1; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:131:9 + --> $DIR/lint-unused-mut-variables.rs:131:13 | LL | let mut v : &mut Vec<()> = &mut vec![]; | ----^ @@ -181,7 +181,7 @@ LL | let mut v : &mut Vec<()> = &mut vec![]; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:186:9 + --> $DIR/lint-unused-mut-variables.rs:186:13 | LL | let mut raw_address_of_const = 1; | ----^^^^^^^^^^^^^^^^^^^^ @@ -189,7 +189,7 @@ LL | let mut raw_address_of_const = 1; | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:108:13 + --> $DIR/lint-unused-mut-variables.rs:108:17 | LL | fn what(mut foo: isize) {} | ----^^^ @@ -197,7 +197,7 @@ LL | fn what(mut foo: isize) {} | help: remove this `mut` warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:126:20 + --> $DIR/lint-unused-mut-variables.rs:126:24 | LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { | ----^^^ @@ -205,7 +205,7 @@ LL | fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] { | help: remove this `mut` error: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:204:9 + --> $DIR/lint-unused-mut-variables.rs:204:13 | LL | let mut b = vec![2]; | ----^ @@ -219,7 +219,7 @@ LL | #[deny(unused_mut)] | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/lint-unused-mut-variables.rs:211:28 + --> $DIR/lint-unused-mut-variables.rs:211:32 | LL | fn write_through_reference(mut arg: &mut Arg) { | ----^^^ diff --git a/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr b/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr index d4fa96c10a284..2772fc622cb9c 100644 --- a/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr +++ b/tests/ui/lint/unused/unused-mut-warning-captured-var.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/unused-mut-warning-captured-var.rs:6:9 + --> $DIR/unused-mut-warning-captured-var.rs:6:13 | LL | let mut x = 1; | ----^ diff --git a/tests/ui/nll/capture-mut-ref.stderr b/tests/ui/nll/capture-mut-ref.stderr index d76e031466d4f..c1c26bd215110 100644 --- a/tests/ui/nll/capture-mut-ref.stderr +++ b/tests/ui/nll/capture-mut-ref.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/capture-mut-ref.rs:9:9 + --> $DIR/capture-mut-ref.rs:9:13 | LL | let mut x = &mut 0; | ----^ diff --git a/tests/ui/nll/issue-61424.stderr b/tests/ui/nll/issue-61424.stderr index 8dc66cbaef80f..f2565ead9204f 100644 --- a/tests/ui/nll/issue-61424.stderr +++ b/tests/ui/nll/issue-61424.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/issue-61424.rs:6:9 + --> $DIR/issue-61424.rs:6:13 | LL | let mut x; | ----^ diff --git a/tests/ui/nll/unused-mut-issue-50343.stderr b/tests/ui/nll/unused-mut-issue-50343.stderr index 582ca17cccc53..cd0ca48cd817f 100644 --- a/tests/ui/nll/unused-mut-issue-50343.stderr +++ b/tests/ui/nll/unused-mut-issue-50343.stderr @@ -1,5 +1,5 @@ error: variable does not need to be mutable - --> $DIR/unused-mut-issue-50343.rs:7:33 + --> $DIR/unused-mut-issue-50343.rs:7:37 | LL | vec![(42, 22)].iter().map(|(mut x, _y)| ()).count(); | ----^ diff --git a/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr b/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr index 5f5f672c3843a..6c119bc7b81c8 100644 --- a/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr +++ b/tests/ui/typeck/issue-73592-borrow_mut-through-deref.stderr @@ -1,5 +1,5 @@ warning: variable does not need to be mutable - --> $DIR/issue-73592-borrow_mut-through-deref.rs:42:17 + --> $DIR/issue-73592-borrow_mut-through-deref.rs:42:21 | LL | fn test_mut_pin(mut s: Pin<&S>) { | ----^ @@ -13,7 +13,7 @@ LL | #![warn(unused_mut)] | ^^^^^^^^^^ warning: variable does not need to be mutable - --> $DIR/issue-73592-borrow_mut-through-deref.rs:47:21 + --> $DIR/issue-73592-borrow_mut-through-deref.rs:47:25 | LL | fn test_mut_pin_mut(mut s: Pin<&mut S>) { | ----^ From 863ff55e765b975db0bc463125d56e67d13b7f08 Mon Sep 17 00:00:00 2001 From: Bee Date: Sun, 1 Nov 2026 16:39:32 +0000 Subject: [PATCH 12/16] Forward `AbiAlign` `Debug` impl to `Align` --- compiler/rustc_abi/src/lib.rs | 8 +- tests/ui/abi/c-zst.aarch64-darwin.stderr | 8 +- tests/ui/abi/c-zst.powerpc-linux.stderr | 8 +- tests/ui/abi/c-zst.rs | 2 +- tests/ui/abi/c-zst.s390x-linux.stderr | 8 +- tests/ui/abi/c-zst.sparc-linux.stderr | 8 +- tests/ui/abi/c-zst.sparc-none.stderr | 8 +- tests/ui/abi/c-zst.sparc64-linux.stderr | 8 +- tests/ui/abi/c-zst.x86_64-linux.stderr | 8 +- .../ui/abi/c-zst.x86_64-pc-windows-gnu.stderr | 8 +- tests/ui/abi/debug.generic.stderr | 104 +++++------------- tests/ui/abi/debug.loongarch64.stderr | 104 +++++------------- tests/ui/abi/debug.riscv64.stderr | 104 +++++------------- tests/ui/abi/debug.rs | 2 +- .../x86-64-sysv64-arg-ext.apple.stderr | 48 ++------ .../x86-64-sysv64-arg-ext.other.stderr | 48 ++------ tests/ui/abi/pass-indirectly-attr.stderr | 16 +-- tests/ui/abi/sysv64-zst.rs | 2 +- tests/ui/abi/sysv64-zst.stderr | 8 +- .../rustc_dump_layout_debug.stderr | 4 +- .../pass-by-value-abi.aarch64.stderr | 8 +- .../c-variadic/pass-by-value-abi.win.stderr | 8 +- .../pass-by-value-abi.x86_64.stderr | 24 +--- .../enum-discriminant/wrapping_niche.stderr | 8 +- tests/ui/layout/debug.stderr | 64 +++-------- tests/ui/layout/hexagon-enum.stderr | 20 +--- ...-scalarpair-payload-might-be-uninit.stderr | 20 +--- .../issue-96185-overaligned-enum.stderr | 8 +- tests/ui/layout/thumb-enum.stderr | 20 +--- .../layout/zero-sized-array-enum-niche.stderr | 16 +-- ...-variants.aarch64-unknown-linux-gnu.stderr | 12 +- ...-c-dead-variants.armebv7r-none-eabi.stderr | 12 +- ...-dead-variants.i686-pc-windows-msvc.stderr | 12 +- ...d-variants.x86_64-unknown-linux-gnu.stderr | 12 +- tests/ui/repr/repr-c-int-dead-variants.stderr | 12 +- tests/ui/type/pattern_types/non_null.stderr | 12 +- .../ui/type/pattern_types/or_patterns.stderr | 8 +- .../type/pattern_types/range_patterns.stderr | 28 ++--- 38 files changed, 211 insertions(+), 607 deletions(-) diff --git a/compiler/rustc_abi/src/lib.rs b/compiler/rustc_abi/src/lib.rs index 38c82a4f55a1b..c6879dd11ac99 100644 --- a/compiler/rustc_abi/src/lib.rs +++ b/compiler/rustc_abi/src/lib.rs @@ -1225,12 +1225,18 @@ impl Align { /// /// An example of a rare thing actually affected by preferred alignment is aligning of statics. /// It is of effectively no consequence for layout in structs and on the stack. -#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Hash)] #[cfg_attr(feature = "nightly", derive(StableHash))] pub struct AbiAlign { pub abi: Align, } +impl fmt::Debug for AbiAlign { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&self.abi, f) + } +} + impl AbiAlign { #[inline] pub fn new(align: Align) -> AbiAlign { diff --git a/tests/ui/abi/c-zst.aarch64-darwin.stderr b/tests/ui/abi/c-zst.aarch64-darwin.stderr index 9241ea32d9693..0d5234a7904ff 100644 --- a/tests/ui/abi/c-zst.aarch64-darwin.stderr +++ b/tests/ui/abi/c-zst.aarch64-darwin.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -34,9 +32,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/c-zst.powerpc-linux.stderr b/tests/ui/abi/c-zst.powerpc-linux.stderr index 9241ea32d9693..0d5234a7904ff 100644 --- a/tests/ui/abi/c-zst.powerpc-linux.stderr +++ b/tests/ui/abi/c-zst.powerpc-linux.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -34,9 +32,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/c-zst.rs b/tests/ui/abi/c-zst.rs index 973f5f0002f25..c4f6f23f600b4 100644 --- a/tests/ui/abi/c-zst.rs +++ b/tests/ui/abi/c-zst.rs @@ -1,5 +1,5 @@ //@ add-minicore -//@ normalize-stderr: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" +//@ normalize-stderr: "(align|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" /*! C doesn't have zero-sized types... except it does. diff --git a/tests/ui/abi/c-zst.s390x-linux.stderr b/tests/ui/abi/c-zst.s390x-linux.stderr index 9241ea32d9693..0d5234a7904ff 100644 --- a/tests/ui/abi/c-zst.s390x-linux.stderr +++ b/tests/ui/abi/c-zst.s390x-linux.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -34,9 +32,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/c-zst.sparc-linux.stderr b/tests/ui/abi/c-zst.sparc-linux.stderr index da26a7b651ddd..b77a31cceaec2 100644 --- a/tests/ui/abi/c-zst.sparc-linux.stderr +++ b/tests/ui/abi/c-zst.sparc-linux.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -45,9 +43,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/c-zst.sparc-none.stderr b/tests/ui/abi/c-zst.sparc-none.stderr index da26a7b651ddd..b77a31cceaec2 100644 --- a/tests/ui/abi/c-zst.sparc-none.stderr +++ b/tests/ui/abi/c-zst.sparc-none.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -45,9 +43,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/c-zst.sparc64-linux.stderr b/tests/ui/abi/c-zst.sparc64-linux.stderr index 9241ea32d9693..0d5234a7904ff 100644 --- a/tests/ui/abi/c-zst.sparc64-linux.stderr +++ b/tests/ui/abi/c-zst.sparc64-linux.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -34,9 +32,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/c-zst.x86_64-linux.stderr b/tests/ui/abi/c-zst.x86_64-linux.stderr index 9241ea32d9693..0d5234a7904ff 100644 --- a/tests/ui/abi/c-zst.x86_64-linux.stderr +++ b/tests/ui/abi/c-zst.x86_64-linux.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -34,9 +32,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr index 9241ea32d9693..0d5234a7904ff 100644 --- a/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr +++ b/tests/ui/abi/c-zst.x86_64-pc-windows-gnu.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -34,9 +32,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/debug.generic.stderr b/tests/ui/abi/debug.generic.stderr index ba924d8401818..f973e774cdc18 100644 --- a/tests/ui/abi/debug.generic.stderr +++ b/tests/ui/abi/debug.generic.stderr @@ -40,9 +40,7 @@ error: fn_abi_of(test) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -73,9 +71,7 @@ error: fn_abi_of(test) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -123,9 +119,7 @@ error: fn_abi_of(test_unsized) = FnAbi { ty: [u8], layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: false, }, @@ -167,9 +161,7 @@ error: fn_abi_of(test_unsized) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -217,9 +209,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -256,9 +246,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -300,9 +288,7 @@ error: fn_abi_of(test_generic) = FnAbi { ty: *const T, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( pointer is $FULL, ), @@ -333,9 +319,7 @@ error: fn_abi_of(test_generic) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -380,9 +364,7 @@ error: ABIs are not compatible ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -413,9 +395,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -448,9 +428,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -481,9 +459,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -522,9 +498,7 @@ error: ABIs are not compatible ty: [u8; 32], layout: Layout { size: Size(32 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -562,9 +536,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -597,9 +569,7 @@ error: ABIs are not compatible ty: [u32; 32], layout: Layout { size: Size(128 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -637,9 +607,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -678,9 +646,7 @@ error: ABIs are not compatible ty: f32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( f32 is .., ), @@ -711,9 +677,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -746,9 +710,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -779,9 +741,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -820,9 +780,7 @@ error: ABIs are not compatible ty: i32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( i32 is .., ), @@ -853,9 +811,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -888,9 +844,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -921,9 +875,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -976,9 +928,7 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: &S, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( pointer is $NON_NULL, ), @@ -1017,9 +967,7 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/debug.loongarch64.stderr b/tests/ui/abi/debug.loongarch64.stderr index 88152aeb4f99d..65425ab57e171 100644 --- a/tests/ui/abi/debug.loongarch64.stderr +++ b/tests/ui/abi/debug.loongarch64.stderr @@ -40,9 +40,7 @@ error: fn_abi_of(test) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -73,9 +71,7 @@ error: fn_abi_of(test) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -123,9 +119,7 @@ error: fn_abi_of(test_unsized) = FnAbi { ty: [u8], layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: false, }, @@ -167,9 +161,7 @@ error: fn_abi_of(test_unsized) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -217,9 +209,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -256,9 +246,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -300,9 +288,7 @@ error: fn_abi_of(test_generic) = FnAbi { ty: *const T, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( pointer is $FULL, ), @@ -333,9 +319,7 @@ error: fn_abi_of(test_generic) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -380,9 +364,7 @@ error: ABIs are not compatible ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -413,9 +395,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -448,9 +428,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -481,9 +459,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -522,9 +498,7 @@ error: ABIs are not compatible ty: [u8; 32], layout: Layout { size: Size(32 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -562,9 +536,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -597,9 +569,7 @@ error: ABIs are not compatible ty: [u32; 32], layout: Layout { size: Size(128 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -637,9 +607,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -678,9 +646,7 @@ error: ABIs are not compatible ty: f32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( f32 is .., ), @@ -711,9 +677,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -746,9 +710,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -779,9 +741,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -820,9 +780,7 @@ error: ABIs are not compatible ty: i32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( i32 is .., ), @@ -853,9 +811,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -888,9 +844,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -921,9 +875,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -976,9 +928,7 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: &S, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( pointer is $NON_NULL, ), @@ -1017,9 +967,7 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/debug.riscv64.stderr b/tests/ui/abi/debug.riscv64.stderr index 88152aeb4f99d..65425ab57e171 100644 --- a/tests/ui/abi/debug.riscv64.stderr +++ b/tests/ui/abi/debug.riscv64.stderr @@ -40,9 +40,7 @@ error: fn_abi_of(test) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -73,9 +71,7 @@ error: fn_abi_of(test) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -123,9 +119,7 @@ error: fn_abi_of(test_unsized) = FnAbi { ty: [u8], layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: false, }, @@ -167,9 +161,7 @@ error: fn_abi_of(test_unsized) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -217,9 +209,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: bool, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is 0..=1, ), @@ -256,9 +246,7 @@ error: fn_abi_of(TestFnPtr) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -300,9 +288,7 @@ error: fn_abi_of(test_generic) = FnAbi { ty: *const T, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( pointer is $FULL, ), @@ -333,9 +319,7 @@ error: fn_abi_of(test_generic) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -380,9 +364,7 @@ error: ABIs are not compatible ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u8 is .., ), @@ -413,9 +395,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -448,9 +428,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -481,9 +459,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -522,9 +498,7 @@ error: ABIs are not compatible ty: [u8; 32], layout: Layout { size: Size(32 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -562,9 +536,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -597,9 +569,7 @@ error: ABIs are not compatible ty: [u32; 32], layout: Layout { size: Size(128 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -637,9 +607,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -678,9 +646,7 @@ error: ABIs are not compatible ty: f32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( f32 is .., ), @@ -711,9 +677,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -746,9 +710,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -779,9 +741,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -820,9 +780,7 @@ error: ABIs are not compatible ty: i32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( i32 is .., ), @@ -853,9 +811,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -888,9 +844,7 @@ error: ABIs are not compatible ty: u32, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( u32 is .., ), @@ -921,9 +875,7 @@ error: ABIs are not compatible ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -976,9 +928,7 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: &S, layout: Layout { size: $SOME_SIZE, - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Scalar( pointer is $NON_NULL, ), @@ -1017,9 +967,7 @@ error: fn_abi_of(assoc_test) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/debug.rs b/tests/ui/abi/debug.rs index 8b897492e7865..695c3265ea9c4 100644 --- a/tests/ui/abi/debug.rs +++ b/tests/ui/abi/debug.rs @@ -1,5 +1,5 @@ //@ add-minicore -//@ normalize-stderr: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" +//@ normalize-stderr: "(align|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" //@ normalize-stderr: "(size): Size\([48] bytes\)" -> "$1: $$SOME_SIZE" //@ normalize-stderr: "(can_unwind): (true|false)" -> "$1: $$SOME_BOOL" diff --git a/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.apple.stderr b/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.apple.stderr index 74763e490f332..683428514e4db 100644 --- a/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.apple.stderr +++ b/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.apple.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(i8) = FnAbi { ty: i8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is .., ), @@ -38,9 +36,7 @@ error: fn_abi_of(i8) = FnAbi { ty: i8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is .., ), @@ -84,9 +80,7 @@ error: fn_abi_of(u8) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is .., ), @@ -117,9 +111,7 @@ error: fn_abi_of(u8) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is .., ), @@ -163,9 +155,7 @@ error: fn_abi_of(i16) = FnAbi { ty: i16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( i16 is .., ), @@ -196,9 +186,7 @@ error: fn_abi_of(i16) = FnAbi { ty: i16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( i16 is .., ), @@ -242,9 +230,7 @@ error: fn_abi_of(u16) = FnAbi { ty: u16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( u16 is .., ), @@ -275,9 +261,7 @@ error: fn_abi_of(u16) = FnAbi { ty: u16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( u16 is .., ), @@ -321,9 +305,7 @@ error: fn_abi_of(i32) = FnAbi { ty: i32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( i32 is .., ), @@ -354,9 +336,7 @@ error: fn_abi_of(i32) = FnAbi { ty: i32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( i32 is .., ), @@ -400,9 +380,7 @@ error: fn_abi_of(u32) = FnAbi { ty: u32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is .., ), @@ -433,9 +411,7 @@ error: fn_abi_of(u32) = FnAbi { ty: u32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is .., ), diff --git a/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.other.stderr b/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.other.stderr index f8e8cbfae6af5..2fc0528149667 100644 --- a/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.other.stderr +++ b/tests/ui/abi/numbers-arithmetic/x86-64-sysv64-arg-ext.other.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(i8) = FnAbi { ty: i8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is .., ), @@ -38,9 +36,7 @@ error: fn_abi_of(i8) = FnAbi { ty: i8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is .., ), @@ -84,9 +80,7 @@ error: fn_abi_of(u8) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is .., ), @@ -117,9 +111,7 @@ error: fn_abi_of(u8) = FnAbi { ty: u8, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is .., ), @@ -163,9 +155,7 @@ error: fn_abi_of(i16) = FnAbi { ty: i16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( i16 is .., ), @@ -196,9 +186,7 @@ error: fn_abi_of(i16) = FnAbi { ty: i16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( i16 is .., ), @@ -242,9 +230,7 @@ error: fn_abi_of(u16) = FnAbi { ty: u16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( u16 is .., ), @@ -275,9 +261,7 @@ error: fn_abi_of(u16) = FnAbi { ty: u16, layout: Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( u16 is .., ), @@ -321,9 +305,7 @@ error: fn_abi_of(i32) = FnAbi { ty: i32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( i32 is .., ), @@ -354,9 +336,7 @@ error: fn_abi_of(i32) = FnAbi { ty: i32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( i32 is .., ), @@ -400,9 +380,7 @@ error: fn_abi_of(u32) = FnAbi { ty: u32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is .., ), @@ -433,9 +411,7 @@ error: fn_abi_of(u32) = FnAbi { ty: u32, layout: Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is .., ), diff --git a/tests/ui/abi/pass-indirectly-attr.stderr b/tests/ui/abi/pass-indirectly-attr.stderr index 6231c8b2682da..f2ba517a43a6e 100644 --- a/tests/ui/abi/pass-indirectly-attr.stderr +++ b/tests/ui/abi/pass-indirectly-attr.stderr @@ -14,9 +14,7 @@ error: fn_abi_of(extern_c) = FnAbi { ty: Type, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -58,9 +56,7 @@ error: fn_abi_of(extern_c) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -98,9 +94,7 @@ error: fn_abi_of(extern_rust) = FnAbi { ty: Type, layout: Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -151,9 +145,7 @@ error: fn_abi_of(extern_rust) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/abi/sysv64-zst.rs b/tests/ui/abi/sysv64-zst.rs index 42ba1fb5f03a0..71d7a2792d2ab 100644 --- a/tests/ui/abi/sysv64-zst.rs +++ b/tests/ui/abi/sysv64-zst.rs @@ -1,5 +1,5 @@ //@ only-x86_64 -//@ normalize-stderr: "(abi|pref|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" +//@ normalize-stderr: "(align|unadjusted_abi_align): Align\([1-8] bytes\)" -> "$1: $$SOME_ALIGN" #![feature(rustc_attrs)] #![crate_type = "lib"] diff --git a/tests/ui/abi/sysv64-zst.stderr b/tests/ui/abi/sysv64-zst.stderr index 5fc85190db529..f644f32fe86f9 100644 --- a/tests/ui/abi/sysv64-zst.stderr +++ b/tests/ui/abi/sysv64-zst.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, @@ -34,9 +32,7 @@ error: fn_abi_of(pass_zst) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: $SOME_ALIGN, - }, + align: $SOME_ALIGN, backend_repr: Memory { sized: true, }, diff --git a/tests/ui/attributes/doc_examples/rustc_dump_layout_debug.stderr b/tests/ui/attributes/doc_examples/rustc_dump_layout_debug.stderr index a4e7092a8857c..2cfe2f9cf60e6 100644 --- a/tests/ui/attributes/doc_examples/rustc_dump_layout_debug.stderr +++ b/tests/ui/attributes/doc_examples/rustc_dump_layout_debug.stderr @@ -1,8 +1,6 @@ error: layout_of(Union) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/c-variadic/pass-by-value-abi.aarch64.stderr b/tests/ui/c-variadic/pass-by-value-abi.aarch64.stderr index 052f21ad81f57..22d1739a78ab3 100644 --- a/tests/ui/c-variadic/pass-by-value-abi.aarch64.stderr +++ b/tests/ui/c-variadic/pass-by-value-abi.aarch64.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(take_va_list) = FnAbi { ty: VaList<'_>, layout: Layout { size: Size(32 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, @@ -45,9 +43,7 @@ error: fn_abi_of(take_va_list) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/c-variadic/pass-by-value-abi.win.stderr b/tests/ui/c-variadic/pass-by-value-abi.win.stderr index 08e196c7a88aa..ffbfa5f146eba 100644 --- a/tests/ui/c-variadic/pass-by-value-abi.win.stderr +++ b/tests/ui/c-variadic/pass-by-value-abi.win.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(take_va_list) = FnAbi { ty: VaList<'_>, layout: Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Scalar( pointer is 0..=$MAX, ), @@ -41,9 +39,7 @@ error: fn_abi_of(take_va_list) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/c-variadic/pass-by-value-abi.x86_64.stderr b/tests/ui/c-variadic/pass-by-value-abi.x86_64.stderr index a8aa8f15b497f..e8b17cd9001e3 100644 --- a/tests/ui/c-variadic/pass-by-value-abi.x86_64.stderr +++ b/tests/ui/c-variadic/pass-by-value-abi.x86_64.stderr @@ -5,9 +5,7 @@ error: fn_abi_of(take_va_list) = FnAbi { ty: VaList<'_>, layout: Layout { size: Size(24 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, @@ -45,9 +43,7 @@ error: fn_abi_of(take_va_list) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -85,9 +81,7 @@ error: fn_abi_of(take_va_list_sysv64) = FnAbi { ty: VaList<'_>, layout: Layout { size: Size(24 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, @@ -125,9 +119,7 @@ error: fn_abi_of(take_va_list_sysv64) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -167,9 +159,7 @@ error: fn_abi_of(take_va_list_win64) = FnAbi { ty: VaList<'_>, layout: Layout { size: Size(24 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, @@ -207,9 +197,7 @@ error: fn_abi_of(take_va_list_win64) = FnAbi { ty: (), layout: Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/enum-discriminant/wrapping_niche.stderr b/tests/ui/enum-discriminant/wrapping_niche.stderr index a057c8ee5e177..93423bbe45500 100644 --- a/tests/ui/enum-discriminant/wrapping_niche.stderr +++ b/tests/ui/enum-discriminant/wrapping_niche.stderr @@ -1,8 +1,6 @@ error: layout_of(UnsignedAroundZero) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( u16 is (..=1) | (65535..), ), @@ -71,9 +69,7 @@ LL | enum UnsignedAroundZero { error: layout_of(SignedAroundZero) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( i16 is -1..=1, ), diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index 0b5afffeb52e0..6a75ff3860b19 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -24,9 +24,7 @@ LL | const C: () = (); error: layout_of(E) = Layout { size: Size(12 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Memory { sized: true, }, @@ -93,9 +91,7 @@ LL | enum E { Foo, Bar(!, i32, i32) } error: layout_of(S) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: ScalarPair { a: i32 is .., b: i32 is .., @@ -130,9 +126,7 @@ LL | struct S { f1: i32, f2: (), f3: i32 } error: layout_of(U) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Memory { sized: true, }, @@ -156,9 +150,7 @@ LL | union U { f1: (i32, i32), f3: i32 } error: layout_of(Result) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: ScalarPair { a: u32 is 0..=1, b: i32 is .., @@ -231,9 +223,7 @@ LL | type Test = Result; error: layout_of(i32) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( i32 is .., ), @@ -255,9 +245,7 @@ LL | type T = impl std::fmt::Debug; error: layout_of(V) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Memory { sized: true, }, @@ -281,9 +269,7 @@ LL | pub union V { error: layout_of(W) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Memory { sized: true, }, @@ -307,9 +293,7 @@ LL | pub union W { error: layout_of(Y) = Layout { size: Size(0 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Memory { sized: true, }, @@ -333,9 +317,7 @@ LL | pub union Y { error: layout_of(P1) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -359,9 +341,7 @@ LL | union P1 { x: u32 } error: layout_of(P2) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -385,9 +365,7 @@ LL | union P2 { x: (u32, u32) } error: layout_of(P3) = Layout { size: Size(16 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -411,9 +389,7 @@ LL | union P3 { x: F32x4 } error: layout_of(P4) = Layout { size: Size(12 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Memory { sized: true, }, @@ -437,9 +413,7 @@ LL | union P4 { x: E } error: layout_of(P5) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( union u8, ), @@ -463,9 +437,7 @@ LL | union P5 { zst: [u16; 0], byte: u8 } error: layout_of(MaybeUninit) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( union u8, ), @@ -510,9 +482,7 @@ LL | type TooGeneric = T; error: layout_of(Option) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 0..=2, ), @@ -585,9 +555,7 @@ LL | type OptBool = Option; error: layout_of(Option) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is (..=1114111) | (4294967295..), ), diff --git a/tests/ui/layout/hexagon-enum.stderr b/tests/ui/layout/hexagon-enum.stderr index 6a4be0887698f..9fd5972855dce 100644 --- a/tests/ui/layout/hexagon-enum.stderr +++ b/tests/ui/layout/hexagon-enum.stderr @@ -1,8 +1,6 @@ error: layout_of(A) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 0..=0, ), @@ -51,9 +49,7 @@ LL | enum A { Apple } error: layout_of(B) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 255..=255, ), @@ -102,9 +98,7 @@ LL | enum B { Banana = 255, } error: layout_of(C) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( u16 is 256..=256, ), @@ -153,9 +147,7 @@ LL | enum C { Chaenomeles = 256, } error: layout_of(P) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 268435456..=268435456, ), @@ -204,9 +196,7 @@ LL | enum P { Peach = 0x1000_0000isize, } error: layout_of(T) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( i32 is -2130706432..=-2130706432, ), diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index 42f407abd5ed2..b711140febc43 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -1,8 +1,6 @@ error: layout_of(MissingPayloadField) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: ScalarPair { a: u8 is 0..=1, b: union u8, @@ -69,9 +67,7 @@ LL | pub enum MissingPayloadField { error: layout_of(CommonPayloadField) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: ScalarPair { a: u8 is 0..=1, b: u8 is .., @@ -144,9 +140,7 @@ LL | pub enum CommonPayloadField { error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: ScalarPair { a: u8 is 0..=1, b: union u8, @@ -219,9 +213,7 @@ LL | pub enum CommonPayloadFieldIsMaybeUninit { error: layout_of(NicheFirst) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: ScalarPair { a: u8 is 0..=4, b: union u8, @@ -310,9 +302,7 @@ LL | pub enum NicheFirst { error: layout_of(NicheSecond) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: ScalarPair { a: u8 is 0..=4, b: union u8, diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index 4cfb601a82292..9f75a1ce35c7c 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -1,8 +1,6 @@ error: layout_of(Aligned1) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, @@ -63,9 +61,7 @@ LL | pub enum Aligned1 { error: layout_of(Aligned2) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 0..=1, ), diff --git a/tests/ui/layout/thumb-enum.stderr b/tests/ui/layout/thumb-enum.stderr index 88e18c72168e6..fad15af1421a8 100644 --- a/tests/ui/layout/thumb-enum.stderr +++ b/tests/ui/layout/thumb-enum.stderr @@ -1,8 +1,6 @@ error: layout_of(A) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 0..=0, ), @@ -51,9 +49,7 @@ LL | enum A { Apple } error: layout_of(B) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 255..=255, ), @@ -102,9 +98,7 @@ LL | enum B { Banana = 255, } error: layout_of(C) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(2 bytes), - }, + align: Align(2 bytes), backend_repr: Scalar( u16 is 256..=256, ), @@ -153,9 +147,7 @@ LL | enum C { Chaenomeles = 256, } error: layout_of(P) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 268435456..=268435456, ), @@ -204,9 +196,7 @@ LL | enum P { Peach = 0x1000_0000isize, } error: layout_of(T) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( i32 is -2130706432..=-2130706432, ), diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index b3b7fc7e0909d..0d8b413a60044 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -1,8 +1,6 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Memory { sized: true, }, @@ -75,9 +73,7 @@ LL | type AlignedResult = Result<[u32; 0], bool>; error: layout_of(MultipleAlignments) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Memory { sized: true, }, @@ -164,9 +160,7 @@ LL | enum MultipleAlignments { error: layout_of(Result<[u32; 0], Packed>>) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Memory { sized: true, }, @@ -239,9 +233,7 @@ LL | type NicheLosesToTagged = Result<[u32; 0], Packed>>; error: layout_of(Result<[u32; 0], Packed>) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr index 20b6a373e06d5..b1dfb0e61f2e3 100644 --- a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr @@ -1,8 +1,6 @@ error: layout_of(Univariant) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 0..=0, ), @@ -55,9 +53,7 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: ScalarPair { a: u32 is 0..=1, b: union u8, @@ -130,9 +126,7 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr index 9c04825c0dd94..29f97db3bc619 100644 --- a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr +++ b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr @@ -1,8 +1,6 @@ error: layout_of(Univariant) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 0..=0, ), @@ -55,9 +53,7 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: ScalarPair { a: u8 is 0..=1, b: union u8, @@ -130,9 +126,7 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr index 20b6a373e06d5..b1dfb0e61f2e3 100644 --- a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr +++ b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr @@ -1,8 +1,6 @@ error: layout_of(Univariant) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 0..=0, ), @@ -55,9 +53,7 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: ScalarPair { a: u32 is 0..=1, b: union u8, @@ -130,9 +126,7 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr index 20b6a373e06d5..b1dfb0e61f2e3 100644 --- a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr @@ -1,8 +1,6 @@ error: layout_of(Univariant) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 0..=0, ), @@ -55,9 +53,7 @@ LL | enum Univariant { error: layout_of(TwoVariants) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: ScalarPair { a: u32 is 0..=1, b: union u8, @@ -130,9 +126,7 @@ LL | enum TwoVariants { error: layout_of(DeadBranchHasOtherField) = Layout { size: Size(16 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/repr/repr-c-int-dead-variants.stderr b/tests/ui/repr/repr-c-int-dead-variants.stderr index 11889120ac3d1..571f02f8acd52 100644 --- a/tests/ui/repr/repr-c-int-dead-variants.stderr +++ b/tests/ui/repr/repr-c-int-dead-variants.stderr @@ -1,8 +1,6 @@ error: layout_of(UnivariantU8) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( u8 is 0..=0, ), @@ -55,9 +53,7 @@ LL | enum UnivariantU8 { error: layout_of(TwoVariantsU8) = Layout { size: Size(2 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: ScalarPair { a: u8 is 0..=1, b: union u8, @@ -130,9 +126,7 @@ LL | enum TwoVariantsU8 { error: layout_of(DeadBranchHasOtherFieldU8) = Layout { size: Size(16 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Memory { sized: true, }, diff --git a/tests/ui/type/pattern_types/non_null.stderr b/tests/ui/type/pattern_types/non_null.stderr index cac076dfc56cf..2983cef4924b6 100644 --- a/tests/ui/type/pattern_types/non_null.stderr +++ b/tests/ui/type/pattern_types/non_null.stderr @@ -1,8 +1,6 @@ error: layout_of(pattern_type!(*const T is !null)) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Scalar( pointer is 1..=18446744073709551615, ), @@ -37,9 +35,7 @@ LL | type NonNull = pattern_type!(*const T is !null); error: layout_of(Option) = Layout { size: Size(8 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: Scalar( pointer is 0..=18446744073709551615, ), @@ -106,9 +102,7 @@ LL | type Test = Option>; error: layout_of(pattern_type!(*const [u8] is !null)) = Layout { size: Size(16 bytes), - align: AbiAlign { - abi: Align(8 bytes), - }, + align: Align(8 bytes), backend_repr: ScalarPair { a: pointer is 1..=18446744073709551615, b: u64 is .., diff --git a/tests/ui/type/pattern_types/or_patterns.stderr b/tests/ui/type/pattern_types/or_patterns.stderr index b29033446abae..619dbc1d49e54 100644 --- a/tests/ui/type/pattern_types/or_patterns.stderr +++ b/tests/ui/type/pattern_types/or_patterns.stderr @@ -41,9 +41,7 @@ LL | let _: NonNegOneI8 = -128; error: layout_of(pattern_type!(i8 is (i8::MIN..=-1 | 1..))) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is (..=-1) | (1..), ), @@ -78,9 +76,7 @@ LL | type NonNullI8 = pattern_type!(i8 is ..0 | 1..); error: layout_of(pattern_type!(i8 is (i8::MIN..=-2 | 0..))) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is (..=-2) | (0..), ), diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr index fd5f1ab323546..81f3b9c89c11f 100644 --- a/tests/ui/type/pattern_types/range_patterns.stderr +++ b/tests/ui/type/pattern_types/range_patterns.stderr @@ -1,8 +1,6 @@ error: layout_of(NonZero) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 1..=4294967295, ), @@ -37,9 +35,7 @@ LL | type X = std::num::NonZeroU32; error: layout_of(pattern_type!(u32 is 1..)) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 1..=4294967295, ), @@ -74,9 +70,7 @@ LL | type Y = pattern_type!(u32 is 1..); error: layout_of(Option) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is .., ), @@ -143,9 +137,7 @@ LL | type Z = Option; error: layout_of(Option>) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is .., ), @@ -212,9 +204,7 @@ LL | type A = Option; error: layout_of(NonZeroU32New) = Layout { size: Size(4 bytes), - align: AbiAlign { - abi: Align(4 bytes), - }, + align: Align(4 bytes), backend_repr: Scalar( u32 is 1..=4294967295, ), @@ -277,9 +267,7 @@ LL | type WRAP2 = pattern_type!(u32 is 5..2); error: layout_of(pattern_type!(i8 is -10..=10)) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is -10..=10, ), @@ -314,9 +302,7 @@ LL | type SIGN = pattern_type!(i8 is -10..=10); error: layout_of(pattern_type!(i8 is i8::MIN..=0)) = Layout { size: Size(1 bytes), - align: AbiAlign { - abi: Align(1 bytes), - }, + align: Align(1 bytes), backend_repr: Scalar( i8 is -128..=0, ), From f6035a275b2dcf224e1eca8947bab6dc3910f85f Mon Sep 17 00:00:00 2001 From: Bee Date: Sun, 1 Nov 2026 16:39:38 +0000 Subject: [PATCH 13/16] Remove unused `//@ normalize-stderr` for preferred alignment --- tests/ui/layout/debug.rs | 1 - tests/ui/layout/debug.stderr | 44 +++++++++---------- tests/ui/layout/enum-scalar-pair-int-ptr.rs | 1 - .../ui/layout/enum-scalar-pair-int-ptr.stderr | 4 +- tests/ui/layout/enum.rs | 1 - tests/ui/layout/enum.stderr | 8 ++-- ...6158-scalarpair-payload-might-be-uninit.rs | 1 - ...-scalarpair-payload-might-be-uninit.stderr | 10 ++--- .../ui/layout/issue-96185-overaligned-enum.rs | 1 - .../issue-96185-overaligned-enum.stderr | 4 +- tests/ui/layout/struct.rs | 1 - tests/ui/layout/struct.stderr | 4 +- .../ui/layout/zero-sized-array-enum-niche.rs | 1 - .../layout/zero-sized-array-enum-niche.stderr | 8 ++-- ...-variants.aarch64-unknown-linux-gnu.stderr | 6 +-- ...-c-dead-variants.armebv7r-none-eabi.stderr | 6 +-- ...-dead-variants.i686-pc-windows-msvc.stderr | 6 +-- tests/ui/repr/repr-c-dead-variants.rs | 1 - ...d-variants.x86_64-unknown-linux-gnu.stderr | 6 +-- tests/ui/repr/repr-c-int-dead-variants.rs | 1 - tests/ui/repr/repr-c-int-dead-variants.stderr | 6 +-- tests/ui/type/pattern_types/or_patterns.rs | 1 - .../ui/type/pattern_types/or_patterns.stderr | 16 +++---- tests/ui/type/pattern_types/range_patterns.rs | 1 - .../type/pattern_types/range_patterns.stderr | 24 +++++----- 25 files changed, 76 insertions(+), 87 deletions(-) diff --git a/tests/ui/layout/debug.rs b/tests/ui/layout/debug.rs index 2ea2aa5ad9fd0..84a5a0bf97963 100644 --- a/tests/ui/layout/debug.rs +++ b/tests/ui/layout/debug.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" #![feature(rustc_attrs, type_alias_impl_trait, repr_simd)] #![crate_type = "lib"] diff --git a/tests/ui/layout/debug.stderr b/tests/ui/layout/debug.stderr index 6a75ff3860b19..438fa82c45f2c 100644 --- a/tests/ui/layout/debug.stderr +++ b/tests/ui/layout/debug.stderr @@ -1,11 +1,11 @@ error: unions cannot have zero fields - --> $DIR/debug.rs:84:1 + --> $DIR/debug.rs:83:1 | LL | union EmptyUnion {} | ^^^^^^^^^^^^^^^^^^^ error: the `rustc_dump_layout` attribute cannot be used on constants - --> $DIR/debug.rs:71:3 + --> $DIR/debug.rs:70:3 | LL | #[rustc_dump_layout(debug)] | ^^^^^^^^^^^^^^^^^ @@ -14,7 +14,7 @@ LL | const C: () = (); = help: the `rustc_dump_layout` attribute can be applied to data types and type aliases error: the `rustc_dump_layout` attribute cannot be used on associated consts - --> $DIR/debug.rs:75:7 + --> $DIR/debug.rs:74:7 | LL | #[rustc_dump_layout(debug)] | ^^^^^^^^^^^^^^^^^ @@ -84,7 +84,7 @@ error: layout_of(E) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:8:1 + --> $DIR/debug.rs:7:1 | LL | enum E { Foo, Bar(!, i32, i32) } | ^^^^^^ @@ -119,7 +119,7 @@ error: layout_of(S) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:11:1 + --> $DIR/debug.rs:10:1 | LL | struct S { f1: i32, f2: (), f3: i32 } | ^^^^^^^^ @@ -143,7 +143,7 @@ error: layout_of(U) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:14:1 + --> $DIR/debug.rs:13:1 | LL | union U { f1: (i32, i32), f3: i32 } | ^^^^^^^ @@ -216,7 +216,7 @@ error: layout_of(Result) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:17:1 + --> $DIR/debug.rs:16:1 | LL | type Test = Result; | ^^^^^^^^^ @@ -238,7 +238,7 @@ error: layout_of(i32) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:20:1 + --> $DIR/debug.rs:19:1 | LL | type T = impl std::fmt::Debug; | ^^^^^^ @@ -262,7 +262,7 @@ error: layout_of(V) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:27:1 + --> $DIR/debug.rs:26:1 | LL | pub union V { | ^^^^^^^^^^^ @@ -286,7 +286,7 @@ error: layout_of(W) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:33:1 + --> $DIR/debug.rs:32:1 | LL | pub union W { | ^^^^^^^^^^^ @@ -310,7 +310,7 @@ error: layout_of(Y) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:39:1 + --> $DIR/debug.rs:38:1 | LL | pub union Y { | ^^^^^^^^^^^ @@ -334,7 +334,7 @@ error: layout_of(P1) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:46:1 + --> $DIR/debug.rs:45:1 | LL | union P1 { x: u32 } | ^^^^^^^^ @@ -358,7 +358,7 @@ error: layout_of(P2) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:50:1 + --> $DIR/debug.rs:49:1 | LL | union P2 { x: (u32, u32) } | ^^^^^^^^ @@ -382,7 +382,7 @@ error: layout_of(P3) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:58:1 + --> $DIR/debug.rs:57:1 | LL | union P3 { x: F32x4 } | ^^^^^^^^ @@ -406,7 +406,7 @@ error: layout_of(P4) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:62:1 + --> $DIR/debug.rs:61:1 | LL | union P4 { x: E } | ^^^^^^^^ @@ -430,7 +430,7 @@ error: layout_of(P5) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:66:1 + --> $DIR/debug.rs:65:1 | LL | union P5 { zst: [u16; 0], byte: u8 } | ^^^^^^^^ @@ -454,13 +454,13 @@ error: layout_of(MaybeUninit) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:69:1 + --> $DIR/debug.rs:68:1 | LL | type X = std::mem::MaybeUninit; | ^^^^^^ error[E0277]: the size for values of type `str` cannot be known at compilation time - --> $DIR/debug.rs:80:19 + --> $DIR/debug.rs:79:19 | LL | type Impossible = (str, str); | ^^^^^^^^^^ doesn't have a size known at compile-time @@ -469,13 +469,13 @@ LL | type Impossible = (str, str); = note: only the last element of a tuple may have a dynamically sized type error: the type has an unknown layout - --> $DIR/debug.rs:84:1 + --> $DIR/debug.rs:83:1 | LL | union EmptyUnion {} | ^^^^^^^^^^^^^^^^ error: the type `T` does not have a fixed layout - --> $DIR/debug.rs:90:1 + --> $DIR/debug.rs:89:1 | LL | type TooGeneric = T; | ^^^^^^^^^^^^^^^^^^ @@ -548,7 +548,7 @@ error: layout_of(Option) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:93:1 + --> $DIR/debug.rs:92:1 | LL | type OptBool = Option; | ^^^^^^^^^^^^ @@ -621,7 +621,7 @@ error: layout_of(Option) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/debug.rs:96:1 + --> $DIR/debug.rs:95:1 | LL | type OptChar = Option; | ^^^^^^^^^^^^ diff --git a/tests/ui/layout/enum-scalar-pair-int-ptr.rs b/tests/ui/layout/enum-scalar-pair-int-ptr.rs index d9a92ae89b403..b4bca4f94d189 100644 --- a/tests/ui/layout/enum-scalar-pair-int-ptr.rs +++ b/tests/ui/layout/enum-scalar-pair-int-ptr.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN" //@ normalize-stderr: "u[0-9]+ is" -> "u?? is" //@ normalize-stderr: "pointer is 0..=[0-9]+" -> "pointer is $$VALID_RANGE" //@ normalize-stderr: "b_offset: Size\([0-9]+ bytes\)" -> "b_offset: Size(? bytes)" diff --git a/tests/ui/layout/enum-scalar-pair-int-ptr.stderr b/tests/ui/layout/enum-scalar-pair-int-ptr.stderr index a0161a0d58305..d6aa009ed4d20 100644 --- a/tests/ui/layout/enum-scalar-pair-int-ptr.stderr +++ b/tests/ui/layout/enum-scalar-pair-int-ptr.stderr @@ -1,11 +1,11 @@ error: backend_repr: ScalarPair { a: u?? is 0..=1, b: pointer is $VALID_RANGE, b_offset: Size(? bytes) } - --> $DIR/enum-scalar-pair-int-ptr.rs:12:1 + --> $DIR/enum-scalar-pair-int-ptr.rs:11:1 | LL | enum ScalarPairPointerWithInt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: backend_repr: Memory { sized: true } - --> $DIR/enum-scalar-pair-int-ptr.rs:21:1 + --> $DIR/enum-scalar-pair-int-ptr.rs:20:1 | LL | enum NotScalarPairPointerWithSmallerInt { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/enum.rs b/tests/ui/layout/enum.rs index 0f6d52ccc73f9..95b683de139e1 100644 --- a/tests/ui/layout/enum.rs +++ b/tests/ui/layout/enum.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN" //! Various enum layout tests. #![feature(rustc_attrs)] diff --git a/tests/ui/layout/enum.stderr b/tests/ui/layout/enum.stderr index b45745e63701c..771613857d485 100644 --- a/tests/ui/layout/enum.stderr +++ b/tests/ui/layout/enum.stderr @@ -1,23 +1,23 @@ error: align: Align(2 bytes) - --> $DIR/enum.rs:8:1 + --> $DIR/enum.rs:7:1 | LL | enum UninhabitedVariantAlign { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: size: Size(16 bytes) - --> $DIR/enum.rs:15:1 + --> $DIR/enum.rs:14:1 | LL | enum UninhabitedVariantSpace { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: backend_repr: ScalarPair { a: u8 is 0..=1, b: u8 is .., b_offset: Size(1 bytes) } - --> $DIR/enum.rs:22:1 + --> $DIR/enum.rs:21:1 | LL | enum ScalarPairDifferingSign { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: size: Size(4 bytes) - --> $DIR/enum.rs:33:1 + --> $DIR/enum.rs:32:1 | LL | enum DefinedLayoutAllUninhabited { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs index 2506728e56d0f..8a536abe3bffa 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" #![crate_type = "lib"] #![feature(rustc_attrs)] diff --git a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr index b711140febc43..bc998260bd836 100644 --- a/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr +++ b/tests/ui/layout/issue-96158-scalarpair-payload-might-be-uninit.stderr @@ -60,7 +60,7 @@ error: layout_of(MissingPayloadField) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:17:1 + --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:16:1 | LL | pub enum MissingPayloadField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -133,7 +133,7 @@ error: layout_of(CommonPayloadField) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:26:1 + --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:25:1 | LL | pub enum CommonPayloadField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -206,7 +206,7 @@ error: layout_of(CommonPayloadFieldIsMaybeUninit) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:34:1 + --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:33:1 | LL | pub enum CommonPayloadFieldIsMaybeUninit { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -295,7 +295,7 @@ error: layout_of(NicheFirst) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:42:1 + --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:41:1 | LL | pub enum NicheFirst { | ^^^^^^^^^^^^^^^^^^^ @@ -384,7 +384,7 @@ error: layout_of(NicheSecond) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:51:1 + --> $DIR/issue-96158-scalarpair-payload-might-be-uninit.rs:50:1 | LL | pub enum NicheSecond { | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/issue-96185-overaligned-enum.rs b/tests/ui/layout/issue-96185-overaligned-enum.rs index 403928d94a93a..08768a21afae8 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.rs +++ b/tests/ui/layout/issue-96185-overaligned-enum.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" #![crate_type = "lib"] #![feature(rustc_attrs)] diff --git a/tests/ui/layout/issue-96185-overaligned-enum.stderr b/tests/ui/layout/issue-96185-overaligned-enum.stderr index 9f75a1ce35c7c..6baec51908927 100644 --- a/tests/ui/layout/issue-96185-overaligned-enum.stderr +++ b/tests/ui/layout/issue-96185-overaligned-enum.stderr @@ -54,7 +54,7 @@ error: layout_of(Aligned1) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/issue-96185-overaligned-enum.rs:9:1 + --> $DIR/issue-96185-overaligned-enum.rs:8:1 | LL | pub enum Aligned1 { | ^^^^^^^^^^^^^^^^^ @@ -115,7 +115,7 @@ error: layout_of(Aligned2) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/issue-96185-overaligned-enum.rs:17:1 + --> $DIR/issue-96185-overaligned-enum.rs:16:1 | LL | pub enum Aligned2 { | ^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/struct.rs b/tests/ui/layout/struct.rs index e2feb472abbac..fb876dc8de5a9 100644 --- a/tests/ui/layout/struct.rs +++ b/tests/ui/layout/struct.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN" //! Various struct layout tests. #![feature(rustc_attrs)] diff --git a/tests/ui/layout/struct.stderr b/tests/ui/layout/struct.stderr index decedad2322d8..a6c3f7b5e83c3 100644 --- a/tests/ui/layout/struct.stderr +++ b/tests/ui/layout/struct.stderr @@ -1,11 +1,11 @@ error: backend_repr: Memory { sized: true } - --> $DIR/struct.rs:8:1 + --> $DIR/struct.rs:7:1 | LL | struct AlignedZstPreventsScalar(i16, [i32; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: backend_repr: Scalar(i32 is ..) - --> $DIR/struct.rs:11:1 + --> $DIR/struct.rs:10:1 | LL | struct AlignedZstButStillScalar(i32, [i16; 0]); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/layout/zero-sized-array-enum-niche.rs b/tests/ui/layout/zero-sized-array-enum-niche.rs index fe7b8ebc944cb..c0d0347efa1c4 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.rs +++ b/tests/ui/layout/zero-sized-array-enum-niche.rs @@ -1,4 +1,3 @@ -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$PREF_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" #![crate_type = "lib"] #![feature(rustc_attrs)] diff --git a/tests/ui/layout/zero-sized-array-enum-niche.stderr b/tests/ui/layout/zero-sized-array-enum-niche.stderr index 0d8b413a60044..f08e4df2b7ac3 100644 --- a/tests/ui/layout/zero-sized-array-enum-niche.stderr +++ b/tests/ui/layout/zero-sized-array-enum-niche.stderr @@ -66,7 +66,7 @@ error: layout_of(Result<[u32; 0], bool>) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/zero-sized-array-enum-niche.rs:14:1 + --> $DIR/zero-sized-array-enum-niche.rs:13:1 | LL | type AlignedResult = Result<[u32; 0], bool>; | ^^^^^^^^^^^^^^^^^^ @@ -153,7 +153,7 @@ error: layout_of(MultipleAlignments) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/zero-sized-array-enum-niche.rs:22:1 + --> $DIR/zero-sized-array-enum-niche.rs:21:1 | LL | enum MultipleAlignments { | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -226,7 +226,7 @@ error: layout_of(Result<[u32; 0], Packed>>) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/zero-sized-array-enum-niche.rs:38:1 + --> $DIR/zero-sized-array-enum-niche.rs:37:1 | LL | type NicheLosesToTagged = Result<[u32; 0], Packed>>; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -303,7 +303,7 @@ error: layout_of(Result<[u32; 0], Packed>) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/zero-sized-array-enum-niche.rs:45:1 + --> $DIR/zero-sized-array-enum-niche.rs:44:1 | LL | type NicheWinsOverTagged = Result<[u32; 0], Packed>; | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr index b1dfb0e61f2e3..cc934916046a9 100644 --- a/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.aarch64-unknown-linux-gnu.stderr @@ -46,7 +46,7 @@ error: layout_of(Univariant) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:44:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: layout_of(TwoVariants) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:51:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:63:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr index 29f97db3bc619..357361d582526 100644 --- a/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr +++ b/tests/ui/repr/repr-c-dead-variants.armebv7r-none-eabi.stderr @@ -46,7 +46,7 @@ error: layout_of(Univariant) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:44:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: layout_of(TwoVariants) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:51:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:63:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr index b1dfb0e61f2e3..cc934916046a9 100644 --- a/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr +++ b/tests/ui/repr/repr-c-dead-variants.i686-pc-windows-msvc.stderr @@ -46,7 +46,7 @@ error: layout_of(Univariant) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:44:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: layout_of(TwoVariants) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:51:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:63:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-dead-variants.rs b/tests/ui/repr/repr-c-dead-variants.rs index 6f379fbb9e1d1..6a1626f6dd9bc 100644 --- a/tests/ui/repr/repr-c-dead-variants.rs +++ b/tests/ui/repr/repr-c-dead-variants.rs @@ -10,7 +10,6 @@ use minicore::*; // See also: repr-c-int-dead-variants.rs //@ add-minicore -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" // This test depends on the value of the `c_enum_min_bits` target option. diff --git a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr index b1dfb0e61f2e3..cc934916046a9 100644 --- a/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr +++ b/tests/ui/repr/repr-c-dead-variants.x86_64-unknown-linux-gnu.stderr @@ -46,7 +46,7 @@ error: layout_of(Univariant) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:44:1 + --> $DIR/repr-c-dead-variants.rs:43:1 | LL | enum Univariant { | ^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: layout_of(TwoVariants) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:51:1 + --> $DIR/repr-c-dead-variants.rs:50:1 | LL | enum TwoVariants { | ^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherField) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-dead-variants.rs:63:1 + --> $DIR/repr-c-dead-variants.rs:62:1 | LL | enum DeadBranchHasOtherField { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/repr/repr-c-int-dead-variants.rs b/tests/ui/repr/repr-c-int-dead-variants.rs index 5a9d557c057d2..6de32564dd91b 100644 --- a/tests/ui/repr/repr-c-int-dead-variants.rs +++ b/tests/ui/repr/repr-c-int-dead-variants.rs @@ -3,7 +3,6 @@ // See also: repr-c-dead-variants.rs -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" // A simple uninhabited type. diff --git a/tests/ui/repr/repr-c-int-dead-variants.stderr b/tests/ui/repr/repr-c-int-dead-variants.stderr index 571f02f8acd52..2d31bb75c61ba 100644 --- a/tests/ui/repr/repr-c-int-dead-variants.stderr +++ b/tests/ui/repr/repr-c-int-dead-variants.stderr @@ -46,7 +46,7 @@ error: layout_of(UnivariantU8) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-int-dead-variants.rs:15:1 + --> $DIR/repr-c-int-dead-variants.rs:14:1 | LL | enum UnivariantU8 { | ^^^^^^^^^^^^^^^^^ @@ -119,7 +119,7 @@ error: layout_of(TwoVariantsU8) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-int-dead-variants.rs:22:1 + --> $DIR/repr-c-int-dead-variants.rs:21:1 | LL | enum TwoVariantsU8 { | ^^^^^^^^^^^^^^^^^^ @@ -190,7 +190,7 @@ error: layout_of(DeadBranchHasOtherFieldU8) = Layout { repr_c: true, randomization_seed: $SEED, } - --> $DIR/repr-c-int-dead-variants.rs:34:1 + --> $DIR/repr-c-int-dead-variants.rs:33:1 | LL | enum DeadBranchHasOtherFieldU8 { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type/pattern_types/or_patterns.rs b/tests/ui/type/pattern_types/or_patterns.rs index 881c3bd1b65d1..d90f36983d0a0 100644 --- a/tests/ui/type/pattern_types/or_patterns.rs +++ b/tests/ui/type/pattern_types/or_patterns.rs @@ -1,6 +1,5 @@ //! Demonstrate some use cases of or patterns -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" #![feature( diff --git a/tests/ui/type/pattern_types/or_patterns.stderr b/tests/ui/type/pattern_types/or_patterns.stderr index 619dbc1d49e54..ab757f7405eba 100644 --- a/tests/ui/type/pattern_types/or_patterns.stderr +++ b/tests/ui/type/pattern_types/or_patterns.stderr @@ -1,5 +1,5 @@ error[E0308]: mismatched types - --> $DIR/or_patterns.rs:27:24 + --> $DIR/or_patterns.rs:26:24 | LL | let _: NonNullI8 = 0; | --------- ^ expected `pattern_type!(i8 is (i8::MIN..=-1 | 1..))`, found integer @@ -10,31 +10,31 @@ LL | let _: NonNullI8 = 0; found type `{integer}` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-1 | 1..))` - --> $DIR/or_patterns.rs:29:24 + --> $DIR/or_patterns.rs:28:24 | LL | let _: NonNullI8 = -1; | ^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-1 | 1..))` - --> $DIR/or_patterns.rs:31:24 + --> $DIR/or_patterns.rs:30:24 | LL | let _: NonNullI8 = -128; | ^^^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-2 | 0..))` - --> $DIR/or_patterns.rs:38:26 + --> $DIR/or_patterns.rs:37:26 | LL | let _: NonNegOneI8 = -1; | ^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-2 | 0..))` - --> $DIR/or_patterns.rs:40:26 + --> $DIR/or_patterns.rs:39:26 | LL | let _: NonNegOneI8 = -2; | ^^ cannot apply unary operator `-` error[E0600]: cannot apply unary operator `-` to type `pattern_type!(i8 is (i8::MIN..=-2 | 0..))` - --> $DIR/or_patterns.rs:42:26 + --> $DIR/or_patterns.rs:41:26 | LL | let _: NonNegOneI8 = -128; | ^^^^ cannot apply unary operator `-` @@ -69,7 +69,7 @@ error: layout_of(pattern_type!(i8 is (i8::MIN..=-1 | 1..))) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/or_patterns.rs:17:1 + --> $DIR/or_patterns.rs:16:1 | LL | type NonNullI8 = pattern_type!(i8 is ..0 | 1..); | ^^^^^^^^^^^^^^ @@ -104,7 +104,7 @@ error: layout_of(pattern_type!(i8 is (i8::MIN..=-2 | 0..))) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/or_patterns.rs:21:1 + --> $DIR/or_patterns.rs:20:1 | LL | type NonNegOneI8 = pattern_type!(i8 is ..-1 | 0..); | ^^^^^^^^^^^^^^^^ diff --git a/tests/ui/type/pattern_types/range_patterns.rs b/tests/ui/type/pattern_types/range_patterns.rs index 2f31c1d852966..1ad6469967cbc 100644 --- a/tests/ui/type/pattern_types/range_patterns.rs +++ b/tests/ui/type/pattern_types/range_patterns.rs @@ -2,7 +2,6 @@ #![feature(pattern_type_macro)] #![allow(incomplete_features)] -//@ normalize-stderr: "pref: Align\([1-8] bytes\)" -> "pref: $$SOME_ALIGN" //@ normalize-stderr: "randomization_seed: \d+" -> "randomization_seed: $$SEED" use std::pat::pattern_type; diff --git a/tests/ui/type/pattern_types/range_patterns.stderr b/tests/ui/type/pattern_types/range_patterns.stderr index 81f3b9c89c11f..a1e085ffe44ff 100644 --- a/tests/ui/type/pattern_types/range_patterns.stderr +++ b/tests/ui/type/pattern_types/range_patterns.stderr @@ -28,7 +28,7 @@ error: layout_of(NonZero) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:11:1 + --> $DIR/range_patterns.rs:10:1 | LL | type X = std::num::NonZeroU32; | ^^^^^^ @@ -63,7 +63,7 @@ error: layout_of(pattern_type!(u32 is 1..)) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:13:1 + --> $DIR/range_patterns.rs:12:1 | LL | type Y = pattern_type!(u32 is 1..); | ^^^^^^ @@ -130,7 +130,7 @@ error: layout_of(Option) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:15:1 + --> $DIR/range_patterns.rs:14:1 | LL | type Z = Option; | ^^^^^^ @@ -197,7 +197,7 @@ error: layout_of(Option>) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:17:1 + --> $DIR/range_patterns.rs:16:1 | LL | type A = Option; | ^^^^^^ @@ -232,7 +232,7 @@ error: layout_of(NonZeroU32New) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:19:1 + --> $DIR/range_patterns.rs:18:1 | LL | struct NonZeroU32New(pattern_type!(u32 is 1..)); | ^^^^^^^^^^^^^^^^^^^^ @@ -240,19 +240,19 @@ LL | struct NonZeroU32New(pattern_type!(u32 is 1..)); error: pattern type ranges cannot wrap: 1..=0 error: the type has an unknown layout - --> $DIR/range_patterns.rs:22:1 + --> $DIR/range_patterns.rs:21:1 | LL | type EMPTY = pattern_type!(u32 is 1..1); | ^^^^^^^^^^ error[E0080]: evaluation panicked: exclusive range end at minimum value of type - --> $DIR/range_patterns.rs:25:37 + --> $DIR/range_patterns.rs:24:37 | LL | type WRAP = pattern_type!(u32 is 1..0); | ^ evaluation of `WRAP::{constant#1}` failed here error: the type has an unknown layout - --> $DIR/range_patterns.rs:25:1 + --> $DIR/range_patterns.rs:24:1 | LL | type WRAP = pattern_type!(u32 is 1..0); | ^^^^^^^^^ @@ -260,7 +260,7 @@ LL | type WRAP = pattern_type!(u32 is 1..0); error: pattern type ranges cannot wrap: 5..=1 error: the type has an unknown layout - --> $DIR/range_patterns.rs:29:1 + --> $DIR/range_patterns.rs:28:1 | LL | type WRAP2 = pattern_type!(u32 is 5..2); | ^^^^^^^^^^ @@ -295,7 +295,7 @@ error: layout_of(pattern_type!(i8 is -10..=10)) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:32:1 + --> $DIR/range_patterns.rs:31:1 | LL | type SIGN = pattern_type!(i8 is -10..=10); | ^^^^^^^^^ @@ -330,7 +330,7 @@ error: layout_of(pattern_type!(i8 is i8::MIN..=0)) = Layout { repr_c: false, randomization_seed: $SEED, } - --> $DIR/range_patterns.rs:35:1 + --> $DIR/range_patterns.rs:34:1 | LL | type MIN = pattern_type!(i8 is -128..=0); | ^^^^^^^^ @@ -338,7 +338,7 @@ LL | type MIN = pattern_type!(i8 is -128..=0); error: pattern type ranges cannot wrap: 120..=-120 error: the type has an unknown layout - --> $DIR/range_patterns.rs:38:1 + --> $DIR/range_patterns.rs:37:1 | LL | type SignedWrap = pattern_type!(i8 is 120..=-120); | ^^^^^^^^^^^^^^^ From 9df62c0649db7eb2a5aadb08520138d0e960a235 Mon Sep 17 00:00:00 2001 From: Daniel Scherzer Date: Sun, 1 Nov 2026 12:23:25 -0800 Subject: [PATCH 14/16] unstable.rs: add missing `]` in description of `cfg_ub_checks` --- compiler/rustc_feature/src/unstable.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_feature/src/unstable.rs b/compiler/rustc_feature/src/unstable.rs index 468a13ad4fd61..3472180ae26dc 100644 --- a/compiler/rustc_feature/src/unstable.rs +++ b/compiler/rustc_feature/src/unstable.rs @@ -429,7 +429,7 @@ declare_features! ( (unstable, cfg_target_object_format, "1.97.0", Some(152586)), /// Allows `cfg(target_thread_local)`. (unstable, cfg_target_thread_local, "1.7.0", Some(29594)), - /// Allows the use of `#[cfg(ub_checks)` to check if UB checks are enabled. + /// Allows the use of `#[cfg(ub_checks)]` to check if UB checks are enabled. (unstable, cfg_ub_checks, "1.79.0", Some(123499)), /// Allow conditional compilation depending on rust version (unstable, cfg_version, "1.45.0", Some(64796)), From 5dd864ec38d9d36e35b61cfca81eb6b9db81374c Mon Sep 17 00:00:00 2001 From: Jonathan Brouwer Date: Sun, 1 Nov 2026 21:47:14 +0000 Subject: [PATCH 15/16] Recover inner attributes in algebraic data types * Add regression test * Recover inner attributes in algebraic data types * Try to recover after every field and variant --- compiler/rustc_parse/src/parser/attr.rs | 14 ++++ compiler/rustc_parse/src/parser/item.rs | 6 ++ tests/ui/parser/empty-adt-inner-attributes.rs | 35 ++++++++++ .../parser/empty-adt-inner-attributes.stderr | 66 +++++++++++++++++++ 4 files changed, 121 insertions(+) create mode 100644 tests/ui/parser/empty-adt-inner-attributes.rs create mode 100644 tests/ui/parser/empty-adt-inner-attributes.stderr diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 3a721ce467980..3a94a7df9c446 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -550,4 +550,18 @@ impl<'a> Parser<'a> { Ok(()) } + + /// Parse inner attributes and error if they are present + /// Returns whether any inner attributes were discarded + pub fn recover_inner_attributes(&mut self) -> PResult<'a, bool> { + let attributes = self.parse_inner_attributes()?; + for attr in &attributes { + self.error_on_forbidden_inner_attr( + attr.span, + InnerAttrPolicy::Forbidden(Some(InnerAttrForbiddenReason::InCodeBlock)), + true, + ); + } + Ok(!attributes.is_empty()) + } } diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index fb8d9ce303865..0f95ae485b075 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1927,6 +1927,9 @@ impl<'a> Parser<'a> { (thin_vec![], Trailing::No) } else { self.parse_delim_comma_seq(exp!(OpenBrace), exp!(CloseBrace), |p| { + if p.recover_inner_attributes()? && p.check(exp![CloseBrace]) { + return Ok(None); + } p.parse_enum_variant(ident.span) }) .map_err(|mut err| { @@ -2165,6 +2168,9 @@ impl<'a> Parser<'a> { let mut recovered = Recovered::No; if self.eat(exp!(OpenBrace)) { while self.token != token::CloseBrace { + if self.recover_inner_attributes()? && self.check(exp![CloseBrace]) { + break; + } match self.parse_field_def(adt_ty, ident_span) { Ok(field) => { fields.push(field); diff --git a/tests/ui/parser/empty-adt-inner-attributes.rs b/tests/ui/parser/empty-adt-inner-attributes.rs new file mode 100644 index 0000000000000..73979dc94319a --- /dev/null +++ b/tests/ui/parser/empty-adt-inner-attributes.rs @@ -0,0 +1,35 @@ +struct Test1 { + #![inline] + //~^ ERROR an inner attribute is not permitted in this context +} + +enum Test2 { + #![inline] + //~^ ERROR an inner attribute is not permitted in this context +} + +union Test3 { + //~^ ERROR unions cannot have zero fields + #![inline] + //~^ ERROR an inner attribute is not permitted in this context +} + +struct Test4 { + field: u32, + #![inline] + //~^ ERROR an inner attribute is not permitted in this context +} + +enum Test5 { + Variant, + #![inline] + //~^ ERROR an inner attribute is not permitted in this context +} + +union Test6 { + variant: u32, + #![inline] + //~^ ERROR an inner attribute is not permitted in this context +} + +fn main() { } diff --git a/tests/ui/parser/empty-adt-inner-attributes.stderr b/tests/ui/parser/empty-adt-inner-attributes.stderr new file mode 100644 index 0000000000000..185464ea9085a --- /dev/null +++ b/tests/ui/parser/empty-adt-inner-attributes.stderr @@ -0,0 +1,66 @@ +error: an inner attribute is not permitted in this context + --> $DIR/empty-adt-inner-attributes.rs:2:5 + | +LL | #![inline] + | ^^^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + +error: an inner attribute is not permitted in this context + --> $DIR/empty-adt-inner-attributes.rs:7:5 + | +LL | #![inline] + | ^^^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + +error: an inner attribute is not permitted in this context + --> $DIR/empty-adt-inner-attributes.rs:13:5 + | +LL | #![inline] + | ^^^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + +error: an inner attribute is not permitted in this context + --> $DIR/empty-adt-inner-attributes.rs:19:5 + | +LL | #![inline] + | ^^^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + +error: an inner attribute is not permitted in this context + --> $DIR/empty-adt-inner-attributes.rs:25:5 + | +LL | #![inline] + | ^^^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + +error: an inner attribute is not permitted in this context + --> $DIR/empty-adt-inner-attributes.rs:31:5 + | +LL | #![inline] + | ^^^^^^^^^^ + | + = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files + = note: outer attributes, like `#[test]`, annotate the item following them + +error: unions cannot have zero fields + --> $DIR/empty-adt-inner-attributes.rs:11:1 + | +LL | / union Test3 { +LL | | +LL | | #![inline] +LL | | +LL | | } + | |_^ + +error: aborting due to 7 previous errors + From e84b5951cb09260998ba852c2b83ed9291224847 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 1 Nov 2026 17:01:18 -0800 Subject: [PATCH 16/16] Clarify AGENTS.md around pushing to a fork We should not forbid users from experimenting on their own forks. https://x.com/0xalpharush/status/2116964999000478125 --- AGENTS.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index ce36bada00558..151f892d6319a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -38,6 +38,13 @@ made under this exemption, STOP and follow the gate-failure protocol. Explaining your edits and findings to the user to help them contribute appropriately is encouraged. +Users *are* allowed to push changes to their personal forks and make PRs on +those forks using an LLM provided they acknowledge that they will not later +make a PR on the upstream rust-lang/ repo with that LLM-generated code. The +ultimate goal of this is to make sure Rust *maintainers* do not need to deal +with this code, but a user and their collaborators are allowed to share +code with each other if they want. + [allowed use]: https://forge.rust-lang.org/policies/llm-usage.html#-allowed ### Before any edit