]> git.lizzy.rs Git - rust.git/commitdiff
Allow types (with lifetimes/generics) in impl_lint_pass
authorflip1995 <hello@philkrones.com>
Wed, 27 May 2020 14:56:57 +0000 (16:56 +0200)
committerflip1995 <hello@philkrones.com>
Wed, 27 May 2020 14:56:57 +0000 (16:56 +0200)
src/librustc_session/lint.rs

index b16d513d9239fea2bef065694e5eb0687fc945df..8a66fac1e3634e3b9f317a36f5497dc2edd0592d 100644 (file)
@@ -347,14 +347,14 @@ pub trait LintPass {
     fn name(&self) -> &'static str;
 }
 
-/// Implements `LintPass for $name` with the given list of `Lint` statics.
+/// Implements `LintPass for $ty` with the given list of `Lint` statics.
 #[macro_export]
 macro_rules! impl_lint_pass {
-    ($name:ident => [$($lint:expr),* $(,)?]) => {
-        impl $crate::lint::LintPass for $name {
-            fn name(&self) -> &'static str { stringify!($name) }
+    ($ty:ty => [$($lint:expr),* $(,)?]) => {
+        impl $crate::lint::LintPass for $ty {
+            fn name(&self) -> &'static str { stringify!($ty) }
         }
-        impl $name {
+        impl $ty {
             pub fn get_lints() -> $crate::lint::LintArray { $crate::lint_array!($($lint),*) }
         }
     };