Skip to content

Commit ba7f52d

Browse files
committed
Put non_local_definitions lint back to warn-by-default
1 parent ac2c494 commit ba7f52d

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

Diff for: compiler/rustc_lint/src/non_local_def.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ declare_lint! {
4747
/// All nested bodies (functions, enum discriminant, array length, consts) (expect for
4848
/// `const _: Ty = { ... }` in top-level module, which is still undecided) are checked.
4949
pub NON_LOCAL_DEFINITIONS,
50-
Allow,
50+
Warn,
5151
"checks for non-local definitions",
5252
report_in_external_macro
5353
}

Diff for: tests/ui/lint/non_local_definitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//@ rustc-env:CARGO_CRATE_NAME=non_local_def
55

66
#![feature(inline_const)]
7-
#![warn(non_local_definitions)]
7+
88

99
extern crate non_local_macro;
1010

Diff for: tests/ui/lint/non_local_definitions.stderr

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,7 @@ LL | impl Uto for &Test {}
1111
= 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
1212
= 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
1313
= 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>
14-
note: the lint level is defined here
15-
--> $DIR/non_local_definitions.rs:7:9
16-
|
17-
LL | #![warn(non_local_definitions)]
18-
| ^^^^^^^^^^^^^^^^^^^^^
14+
= note: `#[warn(non_local_definitions)]` on by default
1915

2016
warning: non-local `impl` definition, they should be avoided as they go against expectation
2117
--> $DIR/non_local_definitions.rs:47:5

0 commit comments

Comments
 (0)