Add regression test for ICE in use-self lint

This commit is contained in:
flip1995 2019-10-15 14:57:54 +02:00
parent 55e7818a06
commit 2d6adb9424
No known key found for this signature in database
GPG key ID: 693086869D506637
2 changed files with 36 additions and 0 deletions

View 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
View 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() {}