mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 07:00:55 +00:00
Add regression test for ICE in use-self lint
This commit is contained in:
parent
55e7818a06
commit
2d6adb9424
2 changed files with 36 additions and 0 deletions
15
tests/ui/auxiliary/use_self_macro.rs
Normal file
15
tests/ui/auxiliary/use_self_macro.rs
Normal file
|
@ -0,0 +1,15 @@
|
|||
macro_rules! use_self {
|
||||
(
|
||||
impl $ty:ident {
|
||||
fn func(&$this:ident) {
|
||||
[fields($($field:ident)*)]
|
||||
}
|
||||
}
|
||||
) => (
|
||||
impl $ty {
|
||||
fn func(&$this) {
|
||||
let $ty { $($field),* } = $this;
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
21
tests/ui/ice-4671.rs
Normal file
21
tests/ui/ice-4671.rs
Normal file
|
@ -0,0 +1,21 @@
|
|||
#![warn(clippy::use_self)]
|
||||
|
||||
#[macro_use]
|
||||
#[path = "auxiliary/use_self_macro.rs"]
|
||||
mod use_self_macro;
|
||||
|
||||
struct Foo {
|
||||
a: u32,
|
||||
}
|
||||
|
||||
use_self! {
|
||||
impl Foo {
|
||||
fn func(&self) {
|
||||
[fields(
|
||||
a
|
||||
)]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in a new issue