@@ -58,6 +58,7 @@ use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
5858use syntax:: ext:: base:: SyntaxExtension ;
5959use syntax:: ext:: base:: Determinacy :: { self , Determined , Undetermined } ;
6060use syntax:: ext:: base:: MacroKind ;
61+ use syntax:: feature_gate:: { emit_feature_err, GateIssue } ;
6162use syntax:: symbol:: { Symbol , keywords} ;
6263use syntax:: util:: lev_distance:: find_best_match_for_name;
6364
@@ -1971,7 +1972,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
19711972
19721973 if !module. no_implicit_prelude {
19731974 if ns == TypeNS {
1974- if let Some ( binding) = self . extern_prelude_get ( ident, !record_used) {
1975+ if let Some ( binding) = self . extern_prelude_get ( ident, !record_used, false ) {
19751976 return Some ( LexicalScopeBinding :: Item ( binding) ) ;
19761977 }
19771978 }
@@ -4820,10 +4821,17 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
48204821 self . name_already_seen . insert ( name, span) ;
48214822 }
48224823
4823- fn extern_prelude_get ( & mut self , ident : Ident , speculative : bool )
4824+ fn extern_prelude_get ( & mut self , ident : Ident , speculative : bool , skip_feature_gate : bool )
48244825 -> Option < & ' a NameBinding < ' a > > {
48254826 self . extern_prelude . get ( & ident. modern ( ) ) . cloned ( ) . and_then ( |entry| {
48264827 if let Some ( binding) = entry. extern_crate_item {
4828+ if !speculative && !skip_feature_gate && entry. introduced_by_item &&
4829+ !self . session . features_untracked ( ) . extern_crate_item_prelude {
4830+ emit_feature_err ( & self . session . parse_sess , "extern_crate_item_prelude" ,
4831+ ident. span , GateIssue :: Language ,
4832+ "use of extern prelude names introduced \
4833+ with `extern crate` items is unstable") ;
4834+ }
48274835 Some ( binding)
48284836 } else {
48294837 let crate_id = if !speculative {
0 commit comments