]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_resolve/lib.rs
Rollup merge of #55328 - raphlinus:copysign_typo, r=joshtriplett
[rust.git] / src / librustc_resolve / lib.rs
index 67dc749cb0051e3c17537dc735f33cf9f83be091..2c21067bd58c8881debec221bacd46ac150e3a76 100644 (file)
@@ -58,6 +58,7 @@
 use syntax::ext::base::SyntaxExtension;
 use syntax::ext::base::Determinacy::{self, Determined, Undetermined};
 use syntax::ext::base::MacroKind;
+use syntax::feature_gate::{emit_feature_err, GateIssue};
 use syntax::symbol::{Symbol, keywords};
 use syntax::util::lev_distance::find_best_match_for_name;
 
@@ -1971,7 +1972,7 @@ fn resolve_ident_in_lexical_scope(&mut self,
 
         if !module.no_implicit_prelude {
             if ns == TypeNS {
-                if let Some(binding) = self.extern_prelude_get(ident, !record_used) {
+                if let Some(binding) = self.extern_prelude_get(ident, !record_used, false) {
                     return Some(LexicalScopeBinding::Item(binding));
                 }
             }
@@ -4820,10 +4821,17 @@ fn report_conflict<'b>(&mut self,
         self.name_already_seen.insert(name, span);
     }
 
-    fn extern_prelude_get(&mut self, ident: Ident, speculative: bool)
+    fn extern_prelude_get(&mut self, ident: Ident, speculative: bool, skip_feature_gate: bool)
                           -> Option<&'a NameBinding<'a>> {
         self.extern_prelude.get(&ident.modern()).cloned().and_then(|entry| {
             if let Some(binding) = entry.extern_crate_item {
+                if !speculative && !skip_feature_gate && entry.introduced_by_item &&
+                   !self.session.features_untracked().extern_crate_item_prelude {
+                    emit_feature_err(&self.session.parse_sess, "extern_crate_item_prelude",
+                                     ident.span, GateIssue::Language,
+                                     "use of extern prelude names introduced \
+                                      with `extern crate` items is unstable");
+                }
                 Some(binding)
             } else {
                 let crate_id = if !speculative {