diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 5c090bf7cad08..e1fba9be5bb6d 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -437,6 +437,8 @@ fn mir_promoted( Some(MirPhase::Analysis(AnalysisPhase::Initial)), ); + lint_tail_expr_drop_order::run_lint(tcx, def, &body); + let promoted = promote_pass.promoted_fragments.into_inner(); (tcx.alloc_steal_mir(body), tcx.alloc_steal_promoted(promoted)) } @@ -492,7 +494,6 @@ fn mir_drops_elaborated_and_const_checked(tcx: TyCtxt<'_>, def: LocalDefId) -> & } let (body, _) = tcx.mir_promoted(def); - lint_tail_expr_drop_order::run_lint(tcx, def, &body.borrow()); let mut body = body.steal(); if let Some(error_reported) = tainted_by_errors { diff --git a/tests/ui/drop/lint-tail-expr-drop-order.rs b/tests/ui/drop/lint-tail-expr-drop-order.rs index cc7c081740dbc..b2a5db0d87133 100644 --- a/tests/ui/drop/lint-tail-expr-drop-order.rs +++ b/tests/ui/drop/lint-tail-expr-drop-order.rs @@ -2,7 +2,6 @@ // This lint is to capture potential change in program semantics // due to implementation of RFC 3606 //@ edition: 2021 -//@ build-fail #![deny(tail_expr_drop_order)] //~ NOTE: the lint level is defined here #![allow(dropping_copy_types)] diff --git a/tests/ui/drop/lint-tail-expr-drop-order.stderr b/tests/ui/drop/lint-tail-expr-drop-order.stderr index b6cf5f40b6eb0..92afae5af6766 100644 --- a/tests/ui/drop/lint-tail-expr-drop-order.stderr +++ b/tests/ui/drop/lint-tail-expr-drop-order.stderr @@ -1,5 +1,5 @@ error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:42:15 + --> $DIR/lint-tail-expr-drop-order.rs:41:15 | LL | let x = LoudDropper; | - @@ -19,14 +19,14 @@ LL | } = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#1` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | LL | | } | |_^ note: `x` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | @@ -34,13 +34,13 @@ LL | | } | |_^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages note: the lint level is defined here - --> $DIR/lint-tail-expr-drop-order.rs:7:9 + --> $DIR/lint-tail-expr-drop-order.rs:6:9 | LL | #![deny(tail_expr_drop_order)] | ^^^^^^^^^^^^^^^^^^^^ error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:67:19 + --> $DIR/lint-tail-expr-drop-order.rs:66:19 | LL | let x = LoudDropper; | - @@ -60,14 +60,14 @@ LL | } = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#1` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | LL | | } | |_^ note: `x` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | @@ -76,7 +76,7 @@ LL | | } = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:94:7 + --> $DIR/lint-tail-expr-drop-order.rs:93:7 | LL | let x = LoudDropper; | - @@ -96,14 +96,14 @@ LL | } = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#1` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | LL | | } | |_^ note: `x` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | @@ -112,7 +112,7 @@ LL | | } = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:147:5 + --> $DIR/lint-tail-expr-drop-order.rs:146:5 | LL | let future = f(); | ------ @@ -132,14 +132,14 @@ LL | } = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#1` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | LL | | } | |_^ note: `future` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | @@ -148,7 +148,7 @@ LL | | } = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:164:14 + --> $DIR/lint-tail-expr-drop-order.rs:163:14 | LL | let x = T::default(); | - @@ -170,7 +170,7 @@ LL | } = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:178:5 + --> $DIR/lint-tail-expr-drop-order.rs:177:5 | LL | let x: Result = Ok(LoudDropper); | - @@ -190,14 +190,14 @@ LL | } = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#1` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | LL | | } | |_^ note: `x` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | @@ -206,7 +206,7 @@ LL | | } = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:222:5 + --> $DIR/lint-tail-expr-drop-order.rs:221:5 | LL | let x = LoudDropper2; | - @@ -226,7 +226,7 @@ LL | } = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#1` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:195:5 + --> $DIR/lint-tail-expr-drop-order.rs:194:5 | LL | / impl Drop for LoudDropper3 { LL | | @@ -236,7 +236,7 @@ LL | | } LL | | } | |_____^ note: `x` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:207:5 + --> $DIR/lint-tail-expr-drop-order.rs:206:5 | LL | / impl Drop for LoudDropper2 { LL | | @@ -248,7 +248,7 @@ LL | | } = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages error: relative drop order changing in Rust 2024 - --> $DIR/lint-tail-expr-drop-order.rs:235:13 + --> $DIR/lint-tail-expr-drop-order.rs:234:13 | LL | LoudDropper.get() | ^^^^^^^^^^^ @@ -268,14 +268,14 @@ LL | )); = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#1` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | LL | | } | |_^ note: `_x` invokes this custom destructor - --> $DIR/lint-tail-expr-drop-order.rs:11:1 + --> $DIR/lint-tail-expr-drop-order.rs:10:1 | LL | / impl Drop for LoudDropper { ... | diff --git a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs index 8d85cee19fd07..5b9c24978b4c9 100644 --- a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs +++ b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.rs @@ -1,5 +1,4 @@ //@ edition: 2021 -//@ build-fail // Make sure we don't ICE when emitting the "lint" drop statement // used for tail_expr_drop_order. diff --git a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr index d04abebe14411..d98100bc1b04c 100644 --- a/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr +++ b/tests/ui/drop/tail_expr_drop_order-on-coroutine-unwind.stderr @@ -1,5 +1,5 @@ error: relative drop order changing in Rust 2024 - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:20:15 + --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:19:15 | LL | match func().await { | ^^^^^^^----- @@ -21,21 +21,21 @@ LL | } = warning: this changes meaning in Rust 2024 = note: for more information, see note: `#2` invokes this custom destructor - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:10:1 + --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 | LL | / impl std::ops::Drop for Drop { LL | | fn drop(&mut self) {} LL | | } | |_^ note: `#1` invokes this custom destructor - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:10:1 + --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 | LL | / impl std::ops::Drop for Drop { LL | | fn drop(&mut self) {} LL | | } | |_^ note: `e` invokes this custom destructor - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:10:1 + --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:9:1 | LL | / impl std::ops::Drop for Drop { LL | | fn drop(&mut self) {} @@ -43,7 +43,7 @@ LL | | } | |_^ = note: most of the time, changing drop order is harmless; inspect the `impl Drop`s for side effects like releasing locks or sending messages note: the lint level is defined here - --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:7:9 + --> $DIR/tail_expr_drop_order-on-coroutine-unwind.rs:6:9 | LL | #![deny(tail_expr_drop_order)] | ^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/error-codes/E0452.rs b/tests/ui/error-codes/E0452.rs index 5066cd99be9fa..4e5a6c9301467 100644 --- a/tests/ui/error-codes/E0452.rs +++ b/tests/ui/error-codes/E0452.rs @@ -2,5 +2,7 @@ //~| ERROR E0452 //~| ERROR E0452 //~| ERROR E0452 + //~| ERROR E0452 + //~| ERROR E0452 fn main() { } diff --git a/tests/ui/error-codes/E0452.stderr b/tests/ui/error-codes/E0452.stderr index 986c135ed89cd..c20429e363dda 100644 --- a/tests/ui/error-codes/E0452.stderr +++ b/tests/ui/error-codes/E0452.stderr @@ -28,6 +28,22 @@ LL | #![allow(foo = "")] | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error[E0452]: malformed lint attribute input + --> $DIR/E0452.rs:1:10 + | +LL | #![allow(foo = "")] + | ^^^^^^^^ bad attribute argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0452]: malformed lint attribute input + --> $DIR/E0452.rs:1:10 + | +LL | #![allow(foo = "")] + | ^^^^^^^^ bad attribute argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 6 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr index 65aa196283082..7bdee5ec9a40d 100644 --- a/tests/ui/lint/command-line-register-unknown-lint-tool.stderr +++ b/tests/ui/lint/command-line-register-unknown-lint-tool.stderr @@ -7,6 +7,11 @@ error[E0602]: unknown lint tool: `unknown_tool` = note: requested on the command line with `-A unknown_tool::foo` = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error[E0602]: unknown lint tool: `unknown_tool` + | + = note: requested on the command line with `-A unknown_tool::foo` + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0602`. diff --git a/tests/ui/lint/force-warn/warnings-lint-group.stderr b/tests/ui/lint/force-warn/warnings-lint-group.stderr index 3e73269a233ed..a303bb573f906 100644 --- a/tests/ui/lint/force-warn/warnings-lint-group.stderr +++ b/tests/ui/lint/force-warn/warnings-lint-group.stderr @@ -4,6 +4,10 @@ error[E0602]: `warnings` lint group is not supported with ´--force-warn´ | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 2 previous errors +error[E0602]: `warnings` lint group is not supported with ´--force-warn´ + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0602`. diff --git a/tests/ui/lint/lint-malformed.rs b/tests/ui/lint/lint-malformed.rs index 188e702f98b38..cf5570753d85d 100644 --- a/tests/ui/lint/lint-malformed.rs +++ b/tests/ui/lint/lint-malformed.rs @@ -3,4 +3,6 @@ //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute //~| ERROR malformed lint attribute + //~| ERROR malformed lint attribute + //~| ERROR malformed lint attribute fn main() { } diff --git a/tests/ui/lint/lint-malformed.stderr b/tests/ui/lint/lint-malformed.stderr index 2c9f045de71f5..0bdcc293b6524 100644 --- a/tests/ui/lint/lint-malformed.stderr +++ b/tests/ui/lint/lint-malformed.stderr @@ -34,6 +34,22 @@ LL | #![allow(bar = "baz")] | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 5 previous errors +error[E0452]: malformed lint attribute input + --> $DIR/lint-malformed.rs:2:10 + | +LL | #![allow(bar = "baz")] + | ^^^^^^^^^^^ bad attribute argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error[E0452]: malformed lint attribute input + --> $DIR/lint-malformed.rs:2:10 + | +LL | #![allow(bar = "baz")] + | ^^^^^^^^^^^ bad attribute argument + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 7 previous errors For more information about this error, try `rustc --explain E0452`. diff --git a/tests/ui/tool-attributes/unknown-lint-tool-name.rs b/tests/ui/tool-attributes/unknown-lint-tool-name.rs index cd5d2f028af02..59fc56d820ee2 100644 --- a/tests/ui/tool-attributes/unknown-lint-tool-name.rs +++ b/tests/ui/tool-attributes/unknown-lint-tool-name.rs @@ -1,5 +1,6 @@ #![deny(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar` //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` + //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` #[allow(foo::bar)] //~ ERROR unknown tool name `foo` found in scoped lint: `foo::bar` //~| ERROR unknown tool name `foo` found in scoped lint: `foo::bar` diff --git a/tests/ui/tool-attributes/unknown-lint-tool-name.stderr b/tests/ui/tool-attributes/unknown-lint-tool-name.stderr index 72731ab1e3db4..5d99777a14ae3 100644 --- a/tests/ui/tool-attributes/unknown-lint-tool-name.stderr +++ b/tests/ui/tool-attributes/unknown-lint-tool-name.stderr @@ -7,7 +7,7 @@ LL | #![deny(foo::bar)] = help: add `#![register_tool(foo)]` to the crate root error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:4:9 + --> $DIR/unknown-lint-tool-name.rs:5:9 | LL | #[allow(foo::bar)] | ^^^ @@ -24,7 +24,7 @@ LL | #![deny(foo::bar)] = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` - --> $DIR/unknown-lint-tool-name.rs:4:9 + --> $DIR/unknown-lint-tool-name.rs:5:9 | LL | #[allow(foo::bar)] | ^^^ @@ -32,6 +32,15 @@ LL | #[allow(foo::bar)] = help: add `#![register_tool(foo)]` to the crate root = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` -error: aborting due to 4 previous errors +error[E0710]: unknown tool name `foo` found in scoped lint: `foo::bar` + --> $DIR/unknown-lint-tool-name.rs:1:9 + | +LL | #![deny(foo::bar)] + | ^^^ + | + = help: add `#![register_tool(foo)]` to the crate root + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0710`.