diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2024-10-14 06:04:30 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-14 06:04:30 +0200 |
| commit | d34b9324c0557abbcd52257fdc544e8a8ff77d4d (patch) | |
| tree | 30c1c26d8b1cc5f70f8bead17ee8328e68ca5393 /tests | |
| parent | 5d63a3db9c7c3a2543fbeb3fe8f30d0173acdcf8 (diff) | |
| parent | b5e91a00c89a065f618693873ad7074a13ad6b90 (diff) | |
| download | rust-d34b9324c0557abbcd52257fdc544e8a8ff77d4d.tar.gz rust-d34b9324c0557abbcd52257fdc544e8a8ff77d4d.zip | |
Rollup merge of #131660 - Urgau:non_local_def-131643, r=jieyouxu
Also use outermost const-anon for impl items in `non_local_defs` lint This PR update the logic for the impl paths (items) in the `non_local_definitions` lint to also consider const-anon in case the impl definition is wrapped inside const-anon it-self wrapped into a const-anon where the items are. r? `@jieyouxu` *(since you interacted on the issue)* Fixes *(after beta-backport)* #131643
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/lint/non-local-defs/convoluted-locals-131474-with-mods.rs | 11 | ||||
| -rw-r--r-- | tests/ui/lint/non-local-defs/convoluted-locals-131474.rs | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/lint/non-local-defs/convoluted-locals-131474-with-mods.rs b/tests/ui/lint/non-local-defs/convoluted-locals-131474-with-mods.rs index cef0f0205e8..72fd056d461 100644 --- a/tests/ui/lint/non-local-defs/convoluted-locals-131474-with-mods.rs +++ b/tests/ui/lint/non-local-defs/convoluted-locals-131474-with-mods.rs @@ -31,4 +31,15 @@ const _: () = { }; }; +// https://github.com/rust-lang/rust/issues/131643 +const _: () = { + const _: () = { + impl tmp::InnerTest {} + }; + + mod tmp { + pub(super) struct InnerTest; + } +}; + fn main() {} diff --git a/tests/ui/lint/non-local-defs/convoluted-locals-131474.rs b/tests/ui/lint/non-local-defs/convoluted-locals-131474.rs index 4881723f13b..8e738544a71 100644 --- a/tests/ui/lint/non-local-defs/convoluted-locals-131474.rs +++ b/tests/ui/lint/non-local-defs/convoluted-locals-131474.rs @@ -21,4 +21,13 @@ const _: () = { }; }; +// https://github.com/rust-lang/rust/issues/131643 +const _: () = { + const _: () = { + impl InnerTest {} + }; + + struct InnerTest; +}; + fn main() {} |
