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
+2-1
Original file line number
Diff line number
Diff line change
@@ -543,11 +543,12 @@ 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
-
.help =
546
+
.move_help =
547
547
move this `impl` block outside of the current {$body_kind_descr}{$depth->
548
548
[one] `{$body_name}`
549
549
*[other] `{$body_name}` and up {$depth} bodies
550
550
}
551
+
.remove_help = remove `{$may_remove_part}` to make the `impl` local
551
552
.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`
552
553
.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`
553
554
.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
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/exhaustive.stderr
+3-1
Original file line number
Diff line number
Diff line change
@@ -189,7 +189,9 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
189
189
--> $DIR/exhaustive.rs:58:5
190
190
|
191
191
LL | impl Trait for *mut InsideMain {}
192
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
192
+
| ^^^^^^^^^^^^^^^-----^^^^^^^^^^
193
+
| |
194
+
| help: remove `*mut ` to make the `impl` local
193
195
|
194
196
= 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
195
197
= 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`
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/from-local-for-global.stderr
+3-1
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,9 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
46
46
--> $DIR/from-local-for-global.rs:32:5
47
47
|
48
48
LL | impl StillNonLocal for &Foo {}
49
-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
49
+
| ^^^^^^^^^^^^^^^^^^^^^^^-^^^
50
+
| |
51
+
| help: remove `&` to make the `impl` local
50
52
|
51
53
= 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
52
54
= 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`
Copy file name to clipboardExpand all lines: tests/ui/lint/non-local-defs/trait-solver-overflow-123573.stderr
+3-1
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
2
2
--> $DIR/trait-solver-overflow-123573.rs:12:5
3
3
|
4
4
LL | impl Test for &Local {}
5
-
| ^^^^^^^^^^^^^^^^^^^^
5
+
| ^^^^^^^^^^^^^^-^^^^^
6
+
| |
7
+
| help: remove `&` to make the `impl` local
6
8
|
7
9
= 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
8
10
= 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`
0 commit comments