diff options
| author | Lzu Tao <taolzu@gmail.com> | 2024-07-25 04:13:15 +0700 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2025-02-06 14:31:39 +0700 |
| commit | e3e6e6ea4131db92ff23a0e32eb40a353f50f8f6 (patch) | |
| tree | 6db93e26cc1d91b2c7aad6aa18904b7acff558c1 | |
| parent | 925718d8eb586d143de73e7eb3428cafb25077db (diff) | |
| download | rust-e3e6e6ea4131db92ff23a0e32eb40a353f50f8f6.tar.gz rust-e3e6e6ea4131db92ff23a0e32eb40a353f50f8f6.zip | |
add bug 13092
| -rw-r--r-- | tests/ui/use_self.fixed | 24 | ||||
| -rw-r--r-- | tests/ui/use_self.rs | 24 | ||||
| -rw-r--r-- | tests/ui/use_self.stderr | 22 |
3 files changed, 69 insertions, 1 deletions
diff --git a/tests/ui/use_self.fixed b/tests/ui/use_self.fixed index ffc5b74d7bd..c6358a90f1e 100644 --- a/tests/ui/use_self.fixed +++ b/tests/ui/use_self.fixed @@ -667,3 +667,27 @@ mod issue_10371 { } } } + +mod issue_13092 { + use std::cell::RefCell; + macro_rules! macro_inner_item { + ($ty:ty) => { + fn foo(_: $ty) { + fn inner(_: $ty) {} + } + }; + } + + #[derive(Default)] + struct MyStruct; + + impl MyStruct { + macro_inner_item!(Self); + } + + impl MyStruct { + thread_local! { + static SPECIAL: RefCell<Self> = RefCell::default(); + } + } +} diff --git a/tests/ui/use_self.rs b/tests/ui/use_self.rs index eb9d96168bc..c900341cadd 100644 --- a/tests/ui/use_self.rs +++ b/tests/ui/use_self.rs @@ -667,3 +667,27 @@ mod issue_10371 { } } } + +mod issue_13092 { + use std::cell::RefCell; + macro_rules! macro_inner_item { + ($ty:ty) => { + fn foo(_: $ty) { + fn inner(_: $ty) {} + } + }; + } + + #[derive(Default)] + struct MyStruct; + + impl MyStruct { + macro_inner_item!(MyStruct); + } + + impl MyStruct { + thread_local! { + static SPECIAL: RefCell<MyStruct> = RefCell::default(); + } + } +} diff --git a/tests/ui/use_self.stderr b/tests/ui/use_self.stderr index bd5b685b45d..06260a598be 100644 --- a/tests/ui/use_self.stderr +++ b/tests/ui/use_self.stderr @@ -259,5 +259,25 @@ error: unnecessary structure name repetition LL | E::A => {}, | ^ help: use the applicable keyword: `Self` -error: aborting due to 43 previous errors +error: unnecessary structure name repetition + --> tests/ui/use_self.rs:685:27 + | +LL | macro_inner_item!(MyStruct); + | ^^^^^^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> tests/ui/use_self.rs:690:37 + | +LL | static SPECIAL: RefCell<MyStruct> = RefCell::default(); + | ^^^^^^^^ help: use the applicable keyword: `Self` + +error: unnecessary structure name repetition + --> tests/ui/use_self.rs:690:37 + | +LL | static SPECIAL: RefCell<MyStruct> = RefCell::default(); + | ^^^^^^^^ help: use the applicable keyword: `Self` + | + = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` + +error: aborting due to 46 previous errors |
