@@ -58,6 +58,7 @@ use syntax::ast::{self, Name, NodeId, Ident, FloatTy, IntTy, UintTy};
58
58
use syntax:: ext:: base:: SyntaxExtension ;
59
59
use syntax:: ext:: base:: Determinacy :: { self , Determined , Undetermined } ;
60
60
use syntax:: ext:: base:: MacroKind ;
61
+ use syntax:: feature_gate:: { emit_feature_err, GateIssue } ;
61
62
use syntax:: symbol:: { Symbol , keywords} ;
62
63
use syntax:: util:: lev_distance:: find_best_match_for_name;
63
64
@@ -1971,7 +1972,7 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
1971
1972
1972
1973
if !module. no_implicit_prelude {
1973
1974
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 ) {
1975
1976
return Some ( LexicalScopeBinding :: Item ( binding) ) ;
1976
1977
}
1977
1978
}
@@ -4820,10 +4821,17 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> {
4820
4821
self . name_already_seen . insert ( name, span) ;
4821
4822
}
4822
4823
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 )
4824
4825
-> Option < & ' a NameBinding < ' a > > {
4825
4826
self . extern_prelude . get ( & ident. modern ( ) ) . cloned ( ) . and_then ( |entry| {
4826
4827
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
+ }
4827
4835
Some ( binding)
4828
4836
} else {
4829
4837
let crate_id = if !speculative {
0 commit comments