From ba7f52d0f25f26eddb8492cfa4f01279af765f0f Mon Sep 17 00:00:00 2001 From: Urgau Date: Tue, 19 Mar 2024 19:36:58 +0100 Subject: [PATCH] Put non_local_definitions lint back to warn-by-default --- compiler/rustc_lint/src/non_local_def.rs | 2 +- tests/ui/lint/non_local_definitions.rs | 2 +- tests/ui/lint/non_local_definitions.stderr | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_lint/src/non_local_def.rs b/compiler/rustc_lint/src/non_local_def.rs index 8b958f0b509cc..0c400543a31b0 100644 --- a/compiler/rustc_lint/src/non_local_def.rs +++ b/compiler/rustc_lint/src/non_local_def.rs @@ -47,7 +47,7 @@ declare_lint! { /// All nested bodies (functions, enum discriminant, array length, consts) (expect for /// `const _: Ty = { ... }` in top-level module, which is still undecided) are checked. pub NON_LOCAL_DEFINITIONS, - Allow, + Warn, "checks for non-local definitions", report_in_external_macro } diff --git a/tests/ui/lint/non_local_definitions.rs b/tests/ui/lint/non_local_definitions.rs index 4c4f19dd88d63..86b03cba33baa 100644 --- a/tests/ui/lint/non_local_definitions.rs +++ b/tests/ui/lint/non_local_definitions.rs @@ -4,7 +4,7 @@ //@ rustc-env:CARGO_CRATE_NAME=non_local_def #![feature(inline_const)] -#![warn(non_local_definitions)] + extern crate non_local_macro; diff --git a/tests/ui/lint/non_local_definitions.stderr b/tests/ui/lint/non_local_definitions.stderr index 70d8385a89518..9296527c66ca3 100644 --- a/tests/ui/lint/non_local_definitions.stderr +++ b/tests/ui/lint/non_local_definitions.stderr @@ -11,11 +11,7 @@ LL | impl Uto for &Test {} = note: an `impl` definition is non-local if it is nested inside an item and neither the type nor the trait are at the same nesting level as the `impl` block and should not impact code outside of that item = note: one exception to the rule are anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type = note: this lint may become deny-by-default in the edition 2024 and higher, see the tracking issue -note: the lint level is defined here - --> $DIR/non_local_definitions.rs:7:9 - | -LL | #![warn(non_local_definitions)] - | ^^^^^^^^^^^^^^^^^^^^^ + = note: `#[warn(non_local_definitions)]` on by default warning: non-local `impl` definition, they should be avoided as they go against expectation --> $DIR/non_local_definitions.rs:47:5