@@ -455,6 +455,9 @@ declare_features! (
455455
456456 // Parentheses in patterns
457457 ( active, pattern_parentheses, "1.26.0" , None , None ) ,
458+
459+ // `use path as _;` and `extern crate c as _;`
460+ ( active, underscore_imports, "1.26.0" , Some ( 48216 ) , None ) ,
458461) ;
459462
460463declare_features ! (
@@ -1436,9 +1439,24 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
14361439 }
14371440 }
14381441
1442+ fn visit_use_tree ( & mut self , use_tree : & ' a ast:: UseTree , id : NodeId , _nested : bool ) {
1443+ if let ast:: UseTreeKind :: Simple ( ident) = use_tree. kind {
1444+ if ident. name == "_" {
1445+ gate_feature_post ! ( & self , underscore_imports, use_tree. span,
1446+ "renaming imports with `_` is unstable" ) ;
1447+ }
1448+ }
1449+
1450+ visit:: walk_use_tree ( self , use_tree, id) ;
1451+ }
1452+
14391453 fn visit_item ( & mut self , i : & ' a ast:: Item ) {
14401454 match i. node {
14411455 ast:: ItemKind :: ExternCrate ( _) => {
1456+ if i. ident . name == "_" {
1457+ gate_feature_post ! ( & self , underscore_imports, i. span,
1458+ "renaming extern crates with `_` is unstable" ) ;
1459+ }
14421460 if let Some ( attr) = attr:: find_by_name ( & i. attrs [ ..] , "macro_reexport" ) {
14431461 gate_feature_post ! ( & self , macro_reexport, attr. span,
14441462 "macros re-exports are experimental \
0 commit comments