]> git.lizzy.rs Git - rust.git/commitdiff
Add support for feature attributes on macros
authorvarkor <github@varkor.com>
Mon, 23 Jul 2018 21:37:57 +0000 (22:37 +0100)
committervarkor <github@varkor.com>
Sun, 5 Aug 2018 14:54:49 +0000 (15:54 +0100)
src/librustc/middle/lib_features.rs
src/librustc/middle/stability.rs

index a1abfb704ec15fa692677d94fc910ad8f573bbf7..365fe1e6b5a4df77a57bb98aab5d3d50f42f6641 100644 (file)
@@ -171,5 +171,8 @@ pub fn collect<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> LibFeatures {
     }
     collector.collect_from_attrs(&tcx.hir.krate().attrs);
     tcx.hir.krate().visit_all_item_likes(&mut collector);
+    for exported_macro in &tcx.hir.krate().exported_macros {
+        collector.collect_from_attrs(&exported_macro.attrs);
+    }
     collector.lib_features
 }
index 34b253ff9c610b20016eaaf2d45f046197eb08f4..98c2eaaeb61b903994dfbb5cd745e87662605777 100644 (file)
@@ -840,10 +840,6 @@ pub fn check_unused_or_stable_features<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) {
     // FIXME(varkor): we don't properly handle lib features behind `cfg` attributes yet,
     // but it happens just to affect `libc`, so we're just going to hard-code it for now.
     remaining_lib_features.remove(&Symbol::intern("libc"));
-    // FIXME(varkor): we have a problem gathering features on macros right now, so we're
-    // going to hard-code some features here for now.
-    remaining_lib_features.remove(&Symbol::intern("await_macro"));
-    remaining_lib_features.remove(&Symbol::intern("unstable_macros"));
 
     for (feature, stable) in tcx.lib_features().iter() {
         if let Some(since) = stable {