Skip to content

Commit 12b579f

Browse files
committed
Add regression test for ICE in use-self lint
1 parent 55e7818 commit 12b579f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

tests/ui/auxiliary/use_self_macro.rs

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
macro_rules! use_self {
2+
(
3+
impl $ty:ident {
4+
fn func(&$this:ident) {
5+
[fields($($field:ident)*)]
6+
}
7+
}
8+
) => (
9+
impl $ty {
10+
fn func(&$this) {
11+
let $ty { $($field),* } = $this;
12+
}
13+
}
14+
)
15+
}
16+

tests/ui/ice-4671.rs

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#![warn(clippy::use_self)]
2+
3+
#[macro_use]
4+
#[path = "auxiliary/use_self_macro.rs"]
5+
mod use_self_macro;
6+
7+
struct Foo {
8+
a: u32,
9+
}
10+
11+
use_self! {
12+
impl Foo {
13+
fn func(&self) {
14+
[fields(
15+
a
16+
)]
17+
}
18+
}
19+
}
20+
21+
fn main() {}

0 commit comments

Comments
 (0)