Skip to content

Commit 0fde35b

Browse files
committed
Also says to move the necessary types/traits
1 parent b4024cc commit 0fde35b

File tree

10 files changed

+57
-57
lines changed

10 files changed

+57
-57
lines changed

compiler/rustc_lint/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,7 @@ lint_non_local_definitions_deprecation = this lint may become deny-by-default in
442442
443443
lint_non_local_definitions_impl = non-local `impl` definition, `impl` blocks should be written at the same level as their item
444444
.help =
445-
move this `impl` block outside the of the current {$body_kind_descr} {$depth ->
445+
move this `impl` block and all the necessary types/traits outside the of the current {$body_kind_descr} {$depth ->
446446
[one] `{$body_name}`
447447
*[other] `{$body_name}` and up {$depth} bodies
448448
}

tests/ui/lint/non-local-defs/cargo-update.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
44
LL | non_local_macro::non_local_impl!(LocalStruct);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
66
|
7-
= help: move this `impl` block outside the of the current constant `_IMPL_DEBUG`
7+
= help: move this `impl` block and all the necessary types/traits outside the of the current constant `_IMPL_DEBUG`
88
= 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
99
= 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`
1010
= 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`

tests/ui/lint/non-local-defs/consts.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | const Z: () = {
77
LL | impl Uto for &Test {}
88
| ^^^^^^^^^^^^^^^^^^^^^
99
|
10-
= help: move this `impl` block outside the of the current constant `Z`
10+
= help: move this `impl` block and all the necessary types/traits outside the of the current constant `Z`
1111
= 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
1212
= 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`
1313
= note: anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type are consider to be transparent regarding the nesting level
@@ -20,7 +20,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
2020
LL | impl Uto2 for Test {}
2121
| ^^^^^^^^^^^^^^^^^^^^^
2222
|
23-
= help: move this `impl` block outside the of the current static `A`
23+
= help: move this `impl` block and all the necessary types/traits outside the of the current static `A`
2424
= 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
2525
= 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`
2626
= note: anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type are consider to be transparent regarding the nesting level
@@ -32,7 +32,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
3232
LL | impl Uto3 for Test {}
3333
| ^^^^^^^^^^^^^^^^^^^^^
3434
|
35-
= help: move this `impl` block outside the of the current constant `B`
35+
= help: move this `impl` block and all the necessary types/traits outside the of the current constant `B`
3636
= 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
3737
= 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`
3838
= note: anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type are consider to be transparent regarding the nesting level
@@ -47,7 +47,7 @@ LL | | fn foo() {}
4747
LL | | }
4848
| |_____^
4949
|
50-
= help: move this `impl` block outside the of the current function `main`
50+
= help: move this `impl` block and all the necessary types/traits outside the of the current function `main`
5151
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
5252
= 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>
5353

@@ -60,7 +60,7 @@ LL | | fn hoo() {}
6060
LL | | }
6161
| |_________^
6262
|
63-
= help: move this `impl` block outside the of the current inline constant `<unnameable>` and up 2 bodies
63+
= help: move this `impl` block and all the necessary types/traits outside the of the current inline constant `<unnameable>` and up 2 bodies
6464
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
6565
= 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>
6666

@@ -73,7 +73,7 @@ LL | | fn foo2() {}
7373
LL | | }
7474
| |_________^
7575
|
76-
= help: move this `impl` block outside the of the current constant `_` and up 2 bodies
76+
= help: move this `impl` block and all the necessary types/traits outside the of the current constant `_` and up 2 bodies
7777
= note: methods and assoc const are still usable outside the current expression, only `impl Local` and `impl dyn Local` are local and only if the `Local` type is at the same nesting as the `impl` block
7878
= note: anon-const (`const _: () = { ... }`) at top-level module and anon-const at the same nesting as the trait or type are consider to be transparent regarding the nesting level
7979
= 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>
@@ -84,7 +84,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
8484
LL | impl Uto9 for Test {}
8585
| ^^^^^^^^^^^^^^^^^^^^^
8686
|
87-
= help: move this `impl` block outside the of the current closure `<unnameable>` and up 2 bodies
87+
= help: move this `impl` block and all the necessary types/traits outside the of the current closure `<unnameable>` and up 2 bodies
8888
= 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
8989
= 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`
9090
= 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>
@@ -95,7 +95,7 @@ warning: non-local `impl` definition, `impl` blocks should be written at the sam
9595
LL | impl Uto10 for Test {}
9696
| ^^^^^^^^^^^^^^^^^^^^^^
9797
|
98-
= help: move this `impl` block outside the of the current constant expression `<unnameable>` and up 2 bodies
98+
= help: move this `impl` block and all the necessary types/traits outside the of the current constant expression `<unnameable>` and up 2 bodies
9999
= 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
100100
= 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`
101101
= 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>

tests/ui/lint/non-local-defs/exhaustive-trait.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | | }
99
LL | | }
1010
| |_____^
1111
|
12-
= help: move this `impl` block outside the of the current function `main`
12+
= help: move this `impl` block and all the necessary types/traits outside the of the current function `main`
1313
= 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
1414
= 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`
1515
= 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,7 +26,7 @@ LL | | }
2626
LL | | }
2727
| |_____^
2828
|
29-
= help: move this `impl` block outside the of the current function `main`
29+
= help: move this `impl` block and all the necessary types/traits outside the of the current function `main`
3030
= 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
3131
= 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`
3232
= 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,7 +42,7 @@ LL | | }
4242
LL | | }
4343
| |_____^
4444
|
45-
= help: move this `impl` block outside the of the current function `main`
45+
= help: move this `impl` block and all the necessary types/traits outside the of the current function `main`
4646
= 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
4747
= 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`
4848
= 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,7 +58,7 @@ LL | | }
5858
LL | | }
5959
| |_____^
6060
|
61-
= help: move this `impl` block outside the of the current function `main`
61+
= help: move this `impl` block and all the necessary types/traits outside the of the current function `main`
6262
= 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
6363
= 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`
6464
= 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>
@@ -74,7 +74,7 @@ LL | | }
7474
LL | | }
7575
| |_____^
7676
|
77-
= help: move this `impl` block outside the of the current function `main`
77+
= help: move this `impl` block and all the necessary types/traits outside the of the current function `main`
7878
= 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
7979
= 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`
8080
= 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>
@@ -90,7 +90,7 @@ LL | | }
9090
LL | | }
9191
| |_____^
9292
|
93-
= help: move this `impl` block outside the of the current function `main`
93+
= help: move this `impl` block and all the necessary types/traits outside the of the current function `main`
9494
= 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
9595
= 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`
9696
= 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

Comments
 (0)