You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 28, 2025. It is now read-only.
Rollup merge of rust-lang#127015 - Urgau:non_local_def-tmp-allow, r=lqd
Switch back `non_local_definitions` lint to allow-by-default
This PR switch back (again) the `non_local_definitions` lint to allow-by-default as T-lang is requesting some (major) changes in the lint inner workings in rust-lang#126768 (comment).
This PR will need to be beta-backported, as the lint is currently warn-by-default in beta.
warning: non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
2
-
--> $DIR/non_local_defs.rs:9:1
2
+
--> $DIR/non_local_defs.rs:11:1
3
3
|
4
4
LL | macro_rules! a_macro { () => {} }
5
5
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6
6
|
7
7
= help: remove the `#[macro_export]` or make this doc-test a standalone test with its own `fn main() { ... }`
8
8
= note: a `macro_rules!` definition is non-local if it is nested inside an item and has a `#[macro_export]` attribute
9
9
= 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>
10
-
= note: `#[warn(non_local_definitions)]` on by default
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
15
15
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
16
16
= 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>
17
-
= note: `#[warn(non_local_definitions)]` on by default
17
+
note: the lint level is defined here
18
+
--> $DIR/cargo-update.rs:13:9
19
+
|
20
+
LL | #![warn(non_local_definitions)]
21
+
| ^^^^^^^^^^^^^^^^^^^^^
18
22
= note: this warning originates in the macro `non_local_macro::non_local_impl` (in Nightly builds, run with -Z macro-backtrace for more info)
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/consts.stderr
+13-9Lines changed: 13 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/consts.rs:13:5
2
+
--> $DIR/consts.rs:15:5
3
3
|
4
4
LL | const Z: () = {
5
5
| -----------
@@ -17,10 +17,14 @@ LL | impl Uto for &Test {}
17
17
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
18
18
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration for the purpose of this lint
19
19
= 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>
20
-
= note: `#[warn(non_local_definitions)]` on by default
20
+
note: the lint level is defined here
21
+
--> $DIR/consts.rs:5:9
22
+
|
23
+
LL | #![warn(non_local_definitions)]
24
+
| ^^^^^^^^^^^^^^^^^^^^^
21
25
22
26
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
23
-
--> $DIR/consts.rs:24:5
27
+
--> $DIR/consts.rs:26:5
24
28
|
25
29
LL | static A: u32 = {
26
30
| ------------- move the `impl` block outside of this static `A`
@@ -36,7 +40,7 @@ LL | impl Uto2 for Test {}
36
40
= 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>
37
41
38
42
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
39
-
--> $DIR/consts.rs:32:5
43
+
--> $DIR/consts.rs:34:5
40
44
|
41
45
LL | const B: u32 = {
42
46
| ------------ move the `impl` block outside of this constant `B`
@@ -52,7 +56,7 @@ LL | impl Uto3 for Test {}
52
56
= 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>
53
57
54
58
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
55
-
--> $DIR/consts.rs:43:5
59
+
--> $DIR/consts.rs:45:5
56
60
|
57
61
LL | fn main() {
58
62
| --------- move the `impl` block outside of this function `main`
@@ -65,7 +69,7 @@ LL | impl Test {
65
69
= 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>
66
70
67
71
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
68
-
--> $DIR/consts.rs:50:9
72
+
--> $DIR/consts.rs:52:9
69
73
|
70
74
LL | const {
71
75
| ___________-
@@ -84,7 +88,7 @@ LL | | };
84
88
= 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>
85
89
86
90
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
87
-
--> $DIR/consts.rs:59:9
91
+
--> $DIR/consts.rs:61:9
88
92
|
89
93
LL | const _: u32 = {
90
94
| ------------ move the `impl` block outside of this constant `_` and up 2 bodies
@@ -98,7 +102,7 @@ LL | impl Test {
98
102
= 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>
99
103
100
104
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
101
-
--> $DIR/consts.rs:72:9
105
+
--> $DIR/consts.rs:74:9
102
106
|
103
107
LL | let _a = || {
104
108
| -- move the `impl` block outside of this closure `<unnameable>` and up 2 bodies
@@ -113,7 +117,7 @@ LL | impl Uto9 for Test {}
113
117
= 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>
114
118
115
119
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/exhaustive-trait.stderr
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/exhaustive-trait.rs:7:5
2
+
--> $DIR/exhaustive-trait.rs:9:5
3
3
|
4
4
LL | fn main() {
5
5
| --------- move the `impl` block outside of this function `main`
@@ -12,10 +12,14 @@ LL | impl PartialEq<()> for Dog {
12
12
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
13
13
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
14
14
= 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>
15
-
= note: `#[warn(non_local_definitions)]` on by default
15
+
note: the lint level is defined here
16
+
--> $DIR/exhaustive-trait.rs:4:9
17
+
|
18
+
LL | #![warn(non_local_definitions)]
19
+
| ^^^^^^^^^^^^^^^^^^^^^
16
20
17
21
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
18
-
--> $DIR/exhaustive-trait.rs:14:5
22
+
--> $DIR/exhaustive-trait.rs:16:5
19
23
|
20
24
LL | fn main() {
21
25
| --------- move the `impl` block outside of this function `main`
= 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>
32
36
33
37
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
34
-
--> $DIR/exhaustive-trait.rs:21:5
38
+
--> $DIR/exhaustive-trait.rs:23:5
35
39
|
36
40
LL | fn main() {
37
41
| --------- move the `impl` block outside of this function `main`
= 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>
48
52
49
53
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
50
-
--> $DIR/exhaustive-trait.rs:28:5
54
+
--> $DIR/exhaustive-trait.rs:30:5
51
55
|
52
56
LL | fn main() {
53
57
| --------- move the `impl` block outside of this function `main`
= 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>
64
68
65
69
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
66
-
--> $DIR/exhaustive-trait.rs:35:5
70
+
--> $DIR/exhaustive-trait.rs:37:5
67
71
|
68
72
LL | fn main() {
69
73
| --------- move the `impl` block outside of this function `main`
= 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>
80
84
81
85
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
82
-
--> $DIR/exhaustive-trait.rs:42:5
86
+
--> $DIR/exhaustive-trait.rs:44:5
83
87
|
84
88
LL | fn main() {
85
89
| --------- move the `impl` block outside of this function `main`
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/exhaustive.stderr
+31-27Lines changed: 31 additions & 27 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/exhaustive.rs:10:5
2
+
--> $DIR/exhaustive.rs:12:5
3
3
|
4
4
LL | fn main() {
5
5
| --------- move the `impl` block outside of this function `main`
@@ -10,10 +10,14 @@ LL | impl Test {
10
10
|
11
11
= note: methods and associated constants are still usable outside the current expression, only `impl Local` and `impl dyn Local` can ever be private, and only if the type is nested in the same item as the `impl`
12
12
= 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>
13
-
= note: `#[warn(non_local_definitions)]` on by default
13
+
note: the lint level is defined here
14
+
--> $DIR/exhaustive.rs:4:9
15
+
|
16
+
LL | #![warn(non_local_definitions)]
17
+
| ^^^^^^^^^^^^^^^^^^^^^
14
18
15
19
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
16
-
--> $DIR/exhaustive.rs:15:5
20
+
--> $DIR/exhaustive.rs:17:5
17
21
|
18
22
LL | fn main() {
19
23
| --------- move the `impl` block outside of this function `main`
@@ -29,7 +33,7 @@ LL | impl Display for Test {
29
33
= 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>
30
34
31
35
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
32
-
--> $DIR/exhaustive.rs:22:5
36
+
--> $DIR/exhaustive.rs:24:5
33
37
|
34
38
LL | fn main() {
35
39
| --------- move the `impl` block outside of this function `main`
@@ -43,7 +47,7 @@ LL | impl dyn Trait {}
43
47
= 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>
44
48
45
49
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
46
-
--> $DIR/exhaustive.rs:25:5
50
+
--> $DIR/exhaustive.rs:27:5
47
51
|
48
52
LL | fn main() {
49
53
| --------- move the `impl` block outside of this function `main`
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
199
203
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
200
204
help: move the `impl` block outside of this function `main`
201
-
--> $DIR/exhaustive.rs:9:1
205
+
--> $DIR/exhaustive.rs:11:1
202
206
|
203
207
LL | fn main() {
204
208
| ^^^^^^^^^
@@ -208,7 +212,7 @@ LL | struct InsideMain;
208
212
= 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>
209
213
210
214
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
220
224
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
221
225
help: move the `impl` block outside of this function `main`
222
-
--> $DIR/exhaustive.rs:9:1
226
+
--> $DIR/exhaustive.rs:11:1
223
227
|
224
228
LL | fn main() {
225
229
| ^^^^^^^^^
@@ -229,7 +233,7 @@ LL | struct InsideMain;
229
233
= 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>
230
234
231
235
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
241
245
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
242
246
help: move the `impl` block outside of this function `main`
243
-
--> $DIR/exhaustive.rs:9:1
247
+
--> $DIR/exhaustive.rs:11:1
244
248
|
245
249
LL | fn main() {
246
250
| ^^^^^^^^^
@@ -250,7 +254,7 @@ LL | struct InsideMain;
250
254
= 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>
251
255
252
256
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
262
266
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
263
267
help: move the `impl` block outside of this function `main`
264
-
--> $DIR/exhaustive.rs:9:1
268
+
--> $DIR/exhaustive.rs:11:1
265
269
|
266
270
LL | fn main() {
267
271
| ^^^^^^^^^
@@ -271,7 +275,7 @@ LL | struct InsideMain;
271
275
= 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>
272
276
273
277
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
283
287
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
284
288
help: move the `impl` block outside of this function `main`
285
-
--> $DIR/exhaustive.rs:9:1
289
+
--> $DIR/exhaustive.rs:11:1
286
290
|
287
291
LL | fn main() {
288
292
| ^^^^^^^^^
@@ -292,7 +296,7 @@ LL | struct InsideMain;
292
296
= 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>
293
297
294
298
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
304
308
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
305
309
help: move the `impl` block outside of this function `main`
306
-
--> $DIR/exhaustive.rs:9:1
310
+
--> $DIR/exhaustive.rs:11:1
307
311
|
308
312
LL | fn main() {
309
313
| ^^^^^^^^^
@@ -313,7 +317,7 @@ LL | struct InsideMain;
313
317
= 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>
314
318
315
319
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
316
-
--> $DIR/exhaustive.rs:72:9
320
+
--> $DIR/exhaustive.rs:74:9
317
321
|
318
322
LL | fn inside_inside() {
319
323
| ------------------ move the `impl` block outside of this function `inside_inside` and up 2 bodies
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/from-local-for-global.stderr
+14-10Lines changed: 14 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/from-local-for-global.rs:8:5
2
+
--> $DIR/from-local-for-global.rs:10:5
3
3
|
4
4
LL | fn main() {
5
5
| --------- move the `impl` block outside of this function `main`
@@ -12,10 +12,14 @@ LL | impl From<Cat> for () {
12
12
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
13
13
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
14
14
= 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>
15
-
= note: `#[warn(non_local_definitions)]` on by default
15
+
note: the lint level is defined here
16
+
--> $DIR/from-local-for-global.rs:4:9
17
+
|
18
+
LL | #![warn(non_local_definitions)]
19
+
| ^^^^^^^^^^^^^^^^^^^^^
16
20
17
21
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
26
30
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
27
31
help: move the `impl` block outside of this function `main`
28
-
--> $DIR/from-local-for-global.rs:7:1
32
+
--> $DIR/from-local-for-global.rs:9:1
29
33
|
30
34
LL | fn main() {
31
35
| ^^^^^^^^^
@@ -35,7 +39,7 @@ LL | struct Elephant;
35
39
= 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>
36
40
37
41
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
48
52
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
49
53
help: move the `impl` block outside of this function `only_global`
50
-
--> $DIR/from-local-for-global.rs:30:1
54
+
--> $DIR/from-local-for-global.rs:32:1
51
55
|
52
56
LL | fn only_global() {
53
57
| ^^^^^^^^^^^^^^^^
@@ -56,7 +60,7 @@ LL | struct Foo;
56
60
= 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>
57
61
58
62
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
68
72
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
69
73
help: move the `impl` block outside of this function `same_function`
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
88
92
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
89
93
help: move the `impl` block outside of this function `same_function`
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/generics.stderr
+20-16Lines changed: 20 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/generics.rs:9:5
2
+
--> $DIR/generics.rs:11:5
3
3
|
4
4
LL | impl<T: Local> Global for Vec<T> { }
5
5
| ^^^^^^^^^^^^^^^------^^^^^---^^^
@@ -10,17 +10,21 @@ LL | impl<T: Local> Global for Vec<T> { }
10
10
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
11
11
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
12
12
help: move the `impl` block outside of this function `main`
13
-
--> $DIR/generics.rs:6:1
13
+
--> $DIR/generics.rs:8:1
14
14
|
15
15
LL | fn main() {
16
16
| ^^^^^^^^^
17
17
LL | trait Local {};
18
18
| ----------- may need to be moved as well
19
19
= 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>
20
-
= note: `#[warn(non_local_definitions)]` on by default
20
+
note: the lint level is defined here
21
+
--> $DIR/generics.rs:4:9
22
+
|
23
+
LL | #![warn(non_local_definitions)]
24
+
| ^^^^^^^^^^^^^^^^^^^^^
21
25
22
26
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
23
-
--> $DIR/generics.rs:20:5
27
+
--> $DIR/generics.rs:22:5
24
28
|
25
29
LL | impl Uto7 for Test where Local: std::any::Any {}
26
30
| ^^^^^----^^^^^----
@@ -31,7 +35,7 @@ LL | impl Uto7 for Test where Local: std::any::Any {}
31
35
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
32
36
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
33
37
help: move the `impl` block outside of this function `bad`
34
-
--> $DIR/generics.rs:18:1
38
+
--> $DIR/generics.rs:20:1
35
39
|
36
40
LL | fn bad() {
37
41
| ^^^^^^^^
@@ -40,7 +44,7 @@ LL | struct Local;
40
44
= 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>
41
45
42
46
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
43
-
--> $DIR/generics.rs:23:5
47
+
--> $DIR/generics.rs:25:5
44
48
|
45
49
LL | fn bad() {
46
50
| -------- move the `impl` block outside of this function `bad`
@@ -56,7 +60,7 @@ LL | impl<T> Uto8 for T {}
56
60
= 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>
57
61
58
62
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
68
72
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
69
73
help: move the `impl` block outside of this function `fun`
70
-
--> $DIR/generics.rs:29:1
74
+
--> $DIR/generics.rs:31:1
71
75
|
72
76
LL | fn fun() {
73
77
| ^^^^^^^^
@@ -77,7 +81,7 @@ LL | struct OwO;
77
81
= 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>
78
82
79
83
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
80
-
--> $DIR/generics.rs:43:5
84
+
--> $DIR/generics.rs:45:5
81
85
|
82
86
LL | impl AsRef<Cat> for () {
83
87
| ^^^^^-----^^^^^^^^^^--
@@ -88,7 +92,7 @@ LL | impl AsRef<Cat> for () {
88
92
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
89
93
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
90
94
help: move the `impl` block outside of this function `meow`
91
-
--> $DIR/generics.rs:40:1
95
+
--> $DIR/generics.rs:42:1
92
96
|
93
97
LL | fn meow() {
94
98
| ^^^^^^^^^
@@ -98,7 +102,7 @@ LL | struct Cat;
98
102
= 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>
99
103
100
104
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
101
-
--> $DIR/generics.rs:54:5
105
+
--> $DIR/generics.rs:56:5
102
106
|
103
107
LL | impl PartialEq<B> for G {
104
108
| ^^^^^---------^^^^^^^^-
@@ -109,7 +113,7 @@ LL | impl PartialEq<B> for G {
109
113
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
110
114
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
111
115
help: move the `impl` block outside of this function `fun2`
112
-
--> $DIR/generics.rs:51:1
116
+
--> $DIR/generics.rs:53:1
113
117
|
114
118
LL | fn fun2() {
115
119
| ^^^^^^^^^
@@ -119,7 +123,7 @@ LL | struct B;
119
123
= 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>
120
124
121
125
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
130
134
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
131
135
help: move the `impl` block outside of this function `rawr`
132
-
--> $DIR/generics.rs:66:1
136
+
--> $DIR/generics.rs:68:1
133
137
|
134
138
LL | fn rawr() {
135
139
| ^^^^^^^^^
@@ -138,7 +142,7 @@ LL | struct Lion;
138
142
= 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>
139
143
140
144
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
150
154
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
151
155
help: move the `impl` block outside of this function `rawr`
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/inside-macro_rules.stderr
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/inside-macro_rules.rs:9:13
2
+
--> $DIR/inside-macro_rules.rs:11:13
3
3
|
4
4
LL | fn my_func() {
5
5
| ------------ move the `impl` block outside of this function `my_func`
@@ -16,7 +16,11 @@ LL | m!();
16
16
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
17
17
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
18
18
= 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>
19
-
= note: `#[warn(non_local_definitions)]` on by default
19
+
note: the lint level is defined here
20
+
--> $DIR/inside-macro_rules.rs:4:9
21
+
|
22
+
LL | #![warn(non_local_definitions)]
23
+
| ^^^^^^^^^^^^^^^^^^^^^
20
24
= note: this warning originates in the macro `m` (in Nightly builds, run with -Z macro-backtrace for more info)
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
11
11
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
12
12
help: move the `impl` block outside of this function `main`
13
-
--> $DIR/suggest-moving-inner.rs:5:1
13
+
--> $DIR/suggest-moving-inner.rs:7:1
14
14
|
15
15
LL | fn main() {
16
16
| ^^^^^^^^^
@@ -23,7 +23,11 @@ LL | struct InsideMain;
23
23
LL | trait HasFoo {}
24
24
| ------------ may need to be moved as well
25
25
= 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>
26
-
= note: `#[warn(non_local_definitions)]` on by default
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/trait-solver-overflow-123573.stderr
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/trait-solver-overflow-123573.rs:12:5
2
+
--> $DIR/trait-solver-overflow-123573.rs:14:5
3
3
|
4
4
LL | impl Test for &Local {}
5
5
| ^^^^^----^^^^^------
@@ -11,14 +11,18 @@ LL | impl Test for &Local {}
11
11
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
12
12
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
13
13
help: move the `impl` block outside of this function `main`
14
-
--> $DIR/trait-solver-overflow-123573.rs:10:1
14
+
--> $DIR/trait-solver-overflow-123573.rs:12:1
15
15
|
16
16
LL | fn main() {
17
17
| ^^^^^^^^^
18
18
LL | struct Local {}
19
19
| ------------ may need to be moved as well
20
20
= 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>
21
-
= note: `#[warn(non_local_definitions)]` on by default
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/weird-exprs.stderr
+11-7Lines changed: 11 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
2
-
--> $DIR/weird-exprs.rs:8:5
2
+
--> $DIR/weird-exprs.rs:10:5
3
3
|
4
4
LL | type A = [u32; {
5
5
| ________________-
@@ -16,10 +16,14 @@ LL | | }];
16
16
= note: `impl` may be usable in bounds, etc. from outside the expression, which might e.g. make something constructible that previously wasn't, because it's still on a publicly-visible type
17
17
= note: an `impl` is never scoped, even when it is nested inside an item, as it may impact type checking outside of that item, which can be the case if neither the trait or the self type are at the same nesting level as the `impl`
18
18
= 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>
19
-
= note: `#[warn(non_local_definitions)]` on by default
19
+
note: the lint level is defined here
20
+
--> $DIR/weird-exprs.rs:4:9
21
+
|
22
+
LL | #![warn(non_local_definitions)]
23
+
| ^^^^^^^^^^^^^^^^^^^^^
20
24
21
25
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
22
-
--> $DIR/weird-exprs.rs:16:9
26
+
--> $DIR/weird-exprs.rs:18:9
23
27
|
24
28
LL | Discr = {
25
29
| _____________-
@@ -38,7 +42,7 @@ LL | | }
38
42
= 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>
39
43
40
44
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
41
-
--> $DIR/weird-exprs.rs:25:9
45
+
--> $DIR/weird-exprs.rs:27:9
42
46
|
43
47
LL | let _array = [0i32; {
44
48
| _________________________-
@@ -57,7 +61,7 @@ LL | | }];
57
61
= 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>
58
62
59
63
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
60
-
--> $DIR/weird-exprs.rs:34:9
64
+
--> $DIR/weird-exprs.rs:36:9
61
65
|
62
66
LL | type A = [u32; {
63
67
| ____________________-
@@ -76,7 +80,7 @@ LL | | }];
76
80
= 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>
77
81
78
82
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
79
-
--> $DIR/weird-exprs.rs:41:9
83
+
--> $DIR/weird-exprs.rs:43:9
80
84
|
81
85
LL | fn a(_: [u32; {
82
86
| ___________________-
@@ -95,7 +99,7 @@ LL | | }]) {}
95
99
= 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>
96
100
97
101
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
0 commit comments