Conversation
estebank
commented
Sep 20, 2026
Contributor
```
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/consts.rs:13:5
|
LL | const Z: () = {
| ----------- move the `impl` block outside of this constant `Z`
...
LL | impl Uto for &Test {}
| ^^^^^---^^^^^^----
| | |
| | `Test` is not local
| `Uto` is not local
|
= 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`
= 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
= note: `#[warn(non_local_definitions)]` on by default
help: use a const-anon item to suppress this lint
|
LL - const Z: () = {
LL + const _: () = {
|
```
Collaborator
|
r? @folkertdev rustbot has assigned @folkertdev. Use Why was this reviewer chosen?The reviewer was selected based on:
|
3 tasks
Contributor
|
@bors r+ rollup |
Contributor
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 20, 2026
Use verbose suggestion for `const _`
```
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/consts.rs:13:5
|
LL | const Z: () = {
| ----------- move the `impl` block outside of this constant `Z`
...
LL | impl Uto for &Test {}
| ^^^^^---^^^^^^----
| | |
| | `Test` is not local
| `Uto` is not local
|
= 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`
= 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
= note: `#[warn(non_local_definitions)]` on by default
help: use a const-anon item to suppress this lint
|
LL - const Z: () = {
LL + const _: () = {
|
```
JonathanBrouwer
added a commit
to JonathanBrouwer/rust
that referenced
this pull request
Sep 20, 2026
Use verbose suggestion for `const _`
```
warning: non-local `impl` definition, `impl` blocks should be written at the same level as their item
--> $DIR/consts.rs:13:5
|
LL | const Z: () = {
| ----------- move the `impl` block outside of this constant `Z`
...
LL | impl Uto for &Test {}
| ^^^^^---^^^^^^----
| | |
| | `Test` is not local
| `Uto` is not local
|
= 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`
= 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
= note: `#[warn(non_local_definitions)]` on by default
help: use a const-anon item to suppress this lint
|
LL - const Z: () = {
LL + const _: () = {
|
```
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 20, 2026
…uwer Rollup of 15 pull requests Successful merges: - #162726 (std: fix unix socket address panic on a full sun_path) - #163016 (Don't claim that escaping value is a reference in diagnostics) - #163040 (Tweak "use array's length as const param" suggestion) - #163060 (Point to fields that introduce trait requirements) - #163066 (don't mark `f128` as reliable on AIX) - #162098 (Tweak `Infallible` docs) - #162854 (Add safety section for atomic_load/store) - #163015 (add `minicore::ffi::VaList`) - #163021 (`va_arg`: pass in `TyAndLayout`) - #163036 ([rustdoc] Correctly handle `dyn` trait methods linking for jump to def feature) - #163042 (Remove redundant output from suggestion) - #163046 (Use verbose suggestion for `const _`) - #163050 (Use verbose suggestion for similarly named label suggestion) - #163052 (Use verbose suggestion for wrong primitive type names) - #163055 (Use the full path of `bug_impl` to avoid bogus errors in rust-analyzer)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.