Skip to content

Commit

Permalink
Put non_local_definitions lint back to warn-by-default
Browse files Browse the repository at this point in the history
  • Loading branch information
Urgau committed Mar 23, 2024
1 parent ac2c494 commit ba7f52d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/non_local_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/lint/non_local_definitions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//@ rustc-env:CARGO_CRATE_NAME=non_local_def

#![feature(inline_const)]
#![warn(non_local_definitions)]


extern crate non_local_macro;

Expand Down
6 changes: 1 addition & 5 deletions tests/ui/lint/non_local_definitions.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/rust-lang/rust/issues/120363>
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
Expand Down

0 comments on commit ba7f52d

Please sign in to comment.