@@ -455,6 +455,9 @@ declare_features! (
455
455
456
456
// Parentheses in patterns
457
457
( 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 ) ,
458
461
) ;
459
462
460
463
declare_features ! (
@@ -1436,9 +1439,24 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
1436
1439
}
1437
1440
}
1438
1441
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
+
1439
1453
fn visit_item ( & mut self , i : & ' a ast:: Item ) {
1440
1454
match i. node {
1441
1455
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
+ }
1442
1460
if let Some ( attr) = attr:: find_by_name ( & i. attrs [ ..] , "macro_reexport" ) {
1443
1461
gate_feature_post ! ( & self , macro_reexport, attr. span,
1444
1462
"macros re-exports are experimental \
0 commit comments