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
Copy file name to clipboardexpand all lines: compiler/rustc_lint/messages.ftl
+6-5
Original file line number
Diff line number
Diff line change
@@ -543,18 +543,19 @@ lint_non_local_definitions_cargo_update = the {$macro_kind} `{$macro_name}` may
543
543
lint_non_local_definitions_deprecation = 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>
544
544
545
545
lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks should be written at the same level as their item
546
-
.move_help =
547
-
move this `impl` block outside of the current {$body_kind_descr}{$depth->
548
-
[one] `{$body_name}`
549
-
*[other] `{$body_name}` and up {$depth} bodies
550
-
}
551
546
.remove_help = remove `{$may_remove_part}` to make the `impl` local
552
547
.without_trait = 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`
553
548
.with_trait = 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`
554
549
.bounds = `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
555
550
.exception = items in an anonymous const item (`const _: () = {"{"} ... {"}"}`) are treated as in the same scope as the anonymous const's declaration
556
551
.const_anon = use a const-anon item to suppress this lint
557
552
553
+
lint_non_local_definitions_impl_move_help =
554
+
move the `impl` block outside of this {$body_kind_descr}{$depth->
555
+
[one] `{$body_name}`
556
+
*[other] `{$body_name}` and up {$depth} bodies
557
+
}
558
+
558
559
lint_non_local_definitions_macro_rules = non-local `macro_rules!` definition, `#[macro_export]` macro should be written at top level module
559
560
.help =
560
561
remove the `#[macro_export]` or move this `macro_rules!` outside the of the current {$body_kind_descr}{$depth->
| move the `impl` block outside of this constant `_IMPL_DEBUG`
9
10
|
10
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
11
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`
12
-
help: move this `impl` block outside of the current constant `_IMPL_DEBUG`
= note: the macro `non_local_macro::non_local_impl` may come from an old version of the `non_local_macro` crate, try updating your dependency with `cargo update -p non_local_macro`
18
14
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
19
15
= 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>
Copy file name to clipboardexpand all lines: tests/ui/lint/non-local-defs/consts.stderr
+37-59
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,10 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
2
2
--> $DIR/consts.rs:13:5
3
3
|
4
4
LL | const Z: () = {
5
-
| - help: use a const-anon item to suppress this lint: `_`
5
+
| -----------
6
+
| | |
7
+
| | help: use a const-anon item to suppress this lint: `_`
8
+
| move the `impl` block outside of this constant `Z`
6
9
...
7
10
LL | impl Uto for &Test {}
8
11
| ^^^^^---^^^^^-----
@@ -12,18 +15,15 @@ LL | impl Uto for &Test {}
12
15
|
13
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
14
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`
15
-
help: move this `impl` block outside of the current constant `Z`
16
-
--> $DIR/consts.rs:13:5
17
-
|
18
-
LL | impl Uto for &Test {}
19
-
| ^^^^^^^^^^^^^^^^^^^^^
20
18
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
21
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>
22
20
= note: `#[warn(non_local_definitions)]` on by default
23
21
24
22
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
25
23
--> $DIR/consts.rs:24:5
26
24
|
25
+
LL | static A: u32 = {
26
+
| ------------- move the `impl` block outside of this static `A`
27
27
LL | impl Uto2 for Test {}
28
28
| ^^^^^----^^^^^----
29
29
| | |
@@ -32,17 +32,14 @@ LL | impl Uto2 for Test {}
32
32
|
33
33
= 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
34
34
= 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`
35
-
help: move this `impl` block outside of the current static `A`
36
-
--> $DIR/consts.rs:24:5
37
-
|
38
-
LL | impl Uto2 for Test {}
39
-
| ^^^^^^^^^^^^^^^^^^^^^
40
35
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
41
36
= 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>
42
37
43
38
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
44
39
--> $DIR/consts.rs:32:5
45
40
|
41
+
LL | const B: u32 = {
42
+
| ------------ move the `impl` block outside of this constant `B`
46
43
LL | impl Uto3 for Test {}
47
44
| ^^^^^----^^^^^----
48
45
| | |
@@ -51,75 +48,60 @@ LL | impl Uto3 for Test {}
51
48
|
52
49
= 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
53
50
= 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`
54
-
help: move this `impl` block outside of the current constant `B`
55
-
--> $DIR/consts.rs:32:5
56
-
|
57
-
LL | impl Uto3 for Test {}
58
-
| ^^^^^^^^^^^^^^^^^^^^^
59
51
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
60
52
= 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>
61
53
62
54
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
63
55
--> $DIR/consts.rs:43:5
64
56
|
57
+
LL | fn main() {
58
+
| --------- move the `impl` block outside of this function `main`
65
59
LL | impl Test {
66
60
| ^^^^^----
67
61
| |
68
62
| `Test` is not local
69
63
|
70
64
= 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`
71
-
help: move this `impl` block outside of the current function `main`
72
-
--> $DIR/consts.rs:43:5
73
-
|
74
-
LL | / impl Test {
75
-
LL | |
76
-
LL | | fn foo() {}
77
-
LL | | }
78
-
| |_____^
79
65
= 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
66
81
67
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
82
68
--> $DIR/consts.rs:50:9
83
69
|
84
-
LL | impl Test {
85
-
| ^^^^^----
86
-
| |
87
-
| `Test` is not local
88
-
|
89
-
= 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`
90
-
help: move this `impl` block outside of the current inline constant `<unnameable>` and up 2 bodies
91
-
--> $DIR/consts.rs:50:9
92
-
|
93
-
LL | / impl Test {
70
+
LL | const {
71
+
| ___________-
72
+
LL | | impl Test {
73
+
| | ^^^^^----
74
+
| | |
75
+
| | `Test` is not local
94
76
LL | |
95
77
LL | | fn hoo() {}
96
-
LL | | }
97
-
| |_________^
78
+
... |
79
+
LL | | 1
80
+
LL | | };
81
+
| |_____- move the `impl` block outside of this inline constant `<unnameable>` and up 2 bodies
82
+
|
83
+
= 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`
98
84
= 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
85
100
86
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
101
87
--> $DIR/consts.rs:59:9
102
88
|
89
+
LL | const _: u32 = {
90
+
| ------------ move the `impl` block outside of this constant `_` and up 2 bodies
103
91
LL | impl Test {
104
92
| ^^^^^----
105
93
| |
106
94
| `Test` is not local
107
95
|
108
96
= 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`
109
-
help: move this `impl` block outside of the current constant `_` and up 2 bodies
110
-
--> $DIR/consts.rs:59:9
111
-
|
112
-
LL | / impl Test {
113
-
LL | |
114
-
LL | | fn foo2() {}
115
-
LL | | }
116
-
| |_________^
117
97
= note: items in an anonymous const item (`const _: () = { ... }`) are treated as in the same scope as the anonymous const's declaration
118
98
= 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>
119
99
120
100
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
121
101
--> $DIR/consts.rs:72:9
122
102
|
103
+
LL | let _a = || {
104
+
| -- move the `impl` block outside of this closure `<unnameable>` and up 2 bodies
123
105
LL | impl Uto9 for Test {}
124
106
| ^^^^^----^^^^^----
125
107
| | |
@@ -128,29 +110,25 @@ LL | impl Uto9 for Test {}
128
110
|
129
111
= 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
112
= 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
-
help: move this `impl` block outside of the current closure `<unnameable>` and up 2 bodies
132
-
--> $DIR/consts.rs:72:9
133
-
|
134
-
LL | impl Uto9 for Test {}
135
-
| ^^^^^^^^^^^^^^^^^^^^^
136
113
= 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>
137
114
138
115
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
139
116
--> $DIR/consts.rs:79:9
140
117
|
141
-
LL | impl Uto10 for Test {}
142
-
| ^^^^^-----^^^^^----
143
-
| | |
144
-
| | `Test` is not local
145
-
| `Uto10` is not local
118
+
LL | type A = [u32; {
119
+
| ____________________-
120
+
LL | | impl Uto10 for Test {}
121
+
| | ^^^^^-----^^^^^----
122
+
| | | |
123
+
| | | `Test` is not local
124
+
| | `Uto10` is not local
125
+
LL | |
126
+
... |
127
+
LL | | }];
128
+
| |_____- move the `impl` block outside of this constant expression `<unnameable>` and up 2 bodies
146
129
|
147
130
= 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
148
131
= 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`
149
-
help: move this `impl` block outside of the current constant expression `<unnameable>` and up 2 bodies
150
-
--> $DIR/consts.rs:79:9
151
-
|
152
-
LL | impl Uto10 for Test {}
153
-
| ^^^^^^^^^^^^^^^^^^^^^^
154
132
= 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>
0 commit comments