Skip to content

Commit e3e6e6e

Browse files
committed
add bug 13092
1 parent 925718d commit e3e6e6e

File tree

3 files changed

+69
-1
lines changed

3 files changed

+69
-1
lines changed

tests/ui/use_self.fixed

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,3 +667,27 @@ mod issue_10371 {
667667
}
668668
}
669669
}
670+
671+
mod issue_13092 {
672+
use std::cell::RefCell;
673+
macro_rules! macro_inner_item {
674+
($ty:ty) => {
675+
fn foo(_: $ty) {
676+
fn inner(_: $ty) {}
677+
}
678+
};
679+
}
680+
681+
#[derive(Default)]
682+
struct MyStruct;
683+
684+
impl MyStruct {
685+
macro_inner_item!(Self);
686+
}
687+
688+
impl MyStruct {
689+
thread_local! {
690+
static SPECIAL: RefCell<Self> = RefCell::default();
691+
}
692+
}
693+
}

tests/ui/use_self.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,3 +667,27 @@ mod issue_10371 {
667667
}
668668
}
669669
}
670+
671+
mod issue_13092 {
672+
use std::cell::RefCell;
673+
macro_rules! macro_inner_item {
674+
($ty:ty) => {
675+
fn foo(_: $ty) {
676+
fn inner(_: $ty) {}
677+
}
678+
};
679+
}
680+
681+
#[derive(Default)]
682+
struct MyStruct;
683+
684+
impl MyStruct {
685+
macro_inner_item!(MyStruct);
686+
}
687+
688+
impl MyStruct {
689+
thread_local! {
690+
static SPECIAL: RefCell<MyStruct> = RefCell::default();
691+
}
692+
}
693+
}

tests/ui/use_self.stderr

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,5 +259,25 @@ error: unnecessary structure name repetition
259259
LL | E::A => {},
260260
| ^ help: use the applicable keyword: `Self`
261261

262-
error: aborting due to 43 previous errors
262+
error: unnecessary structure name repetition
263+
--> tests/ui/use_self.rs:685:27
264+
|
265+
LL | macro_inner_item!(MyStruct);
266+
| ^^^^^^^^ help: use the applicable keyword: `Self`
267+
268+
error: unnecessary structure name repetition
269+
--> tests/ui/use_self.rs:690:37
270+
|
271+
LL | static SPECIAL: RefCell<MyStruct> = RefCell::default();
272+
| ^^^^^^^^ help: use the applicable keyword: `Self`
273+
274+
error: unnecessary structure name repetition
275+
--> tests/ui/use_self.rs:690:37
276+
|
277+
LL | static SPECIAL: RefCell<MyStruct> = RefCell::default();
278+
| ^^^^^^^^ help: use the applicable keyword: `Self`
279+
|
280+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
281+
282+
error: aborting due to 46 previous errors
263283

0 commit comments

Comments
 (0)