about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-08-10 18:38:27 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2019-08-10 21:50:56 +0300
commitfa7fe196018e5fec39dee7ca6567c2024e60daf6 (patch)
treebeba5525dfbb2cf50b30cad8f37684ac74327b1a /src
parentbe3fb0cd2cc408eb4cc9c1d71f9cedb2c974dcd9 (diff)
downloadrust-fa7fe196018e5fec39dee7ca6567c2024e60daf6.tar.gz
rust-fa7fe196018e5fec39dee7ca6567c2024e60daf6.zip
resolve: Remove remaining special cases from built-in macros
Diffstat (limited to 'src')
-rw-r--r--src/librustc_resolve/build_reduced_graph.rs7
-rw-r--r--src/librustc_resolve/lib.rs3
-rw-r--r--src/librustc_resolve/macros.rs2
-rw-r--r--src/libsyntax/ext/base.rs4
-rw-r--r--src/libsyntax/ext/build.rs2
-rw-r--r--src/test/pretty/dollar-crate.pp8
-rw-r--r--src/test/pretty/issue-4264.pp2
-rw-r--r--src/test/ui-fulldeps/deriving-encodable-decodable-box.rs7
-rw-r--r--src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs7
-rw-r--r--src/test/ui-fulldeps/deriving-global.rs3
-rw-r--r--src/test/ui-fulldeps/deriving-hygiene.rs3
-rw-r--r--src/test/ui-fulldeps/issue-11881.rs9
12 files changed, 20 insertions, 37 deletions
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs
index 6e5750e752e..5dd7bc30548 100644
--- a/src/librustc_resolve/build_reduced_graph.rs
+++ b/src/librustc_resolve/build_reduced_graph.rs
@@ -126,8 +126,6 @@ impl<'a> Resolver<'a> {
         };
         if let Some(id) = self.definitions.as_local_node_id(def_id) {
             self.local_macro_def_scopes[&id]
-        } else if self.is_builtin_macro(Some(def_id)) {
-            self.injected_crate.unwrap_or(self.graph_root)
         } else {
             let module_def_id = ty::DefIdTree::parent(&*self, def_id).unwrap();
             self.get_module(module_def_id)
@@ -596,11 +594,6 @@ impl<'a, 'b> BuildReducedGraphVisitor<'a, 'b> {
                 };
 
                 self.r.populate_module_if_necessary(module);
-                if let Some(name) = self.r.session.parse_sess.injected_crate_name.try_get() {
-                    if name.as_str() == ident.name.as_str() {
-                        self.r.injected_crate = Some(module);
-                    }
-                }
 
                 let used = self.process_legacy_macro_imports(item, module);
                 let binding =
diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs
index e786e102002..4cde00404f0 100644
--- a/src/librustc_resolve/lib.rs
+++ b/src/librustc_resolve/lib.rs
@@ -929,8 +929,6 @@ pub struct Resolver<'a> {
     /// it's not used during normal resolution, only for better error reporting.
     struct_constructors: DefIdMap<(Res, ty::Visibility)>,
 
-    injected_crate: Option<Module<'a>>,
-
     /// Features enabled for this crate.
     active_features: FxHashSet<Symbol>,
 }
@@ -1168,7 +1166,6 @@ impl<'a> Resolver<'a> {
             unused_macros: Default::default(),
             proc_macro_stubs: Default::default(),
             special_derives: Default::default(),
-            injected_crate: None,
             active_features:
                 features.declared_lib_features.iter().map(|(feat, ..)| *feat)
                     .chain(features.declared_lang_features.iter().map(|(feat, ..)| *feat))
diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs
index 5af71a0170a..8e9e1380002 100644
--- a/src/librustc_resolve/macros.rs
+++ b/src/librustc_resolve/macros.rs
@@ -854,8 +854,6 @@ impl<'a> Resolver<'a> {
                 if ext.is_builtin {
                     // The macro is a built-in, replace only the expander function.
                     result.kind = ext.kind;
-                    // Also reset its edition to the global one for compatibility.
-                    result.edition = self.session.edition();
                 } else {
                     // The macro is from a plugin, the in-source definition is dummy,
                     // take all the data from the resolver.
diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs
index d69822c7c7f..7f4feff6be6 100644
--- a/src/libsyntax/ext/base.rs
+++ b/src/libsyntax/ext/base.rs
@@ -592,8 +592,8 @@ pub struct SyntaxExtension {
     pub helper_attrs: Vec<Symbol>,
     /// Edition of the crate in which this macro is defined.
     pub edition: Edition,
-    /// Built-in macros have a couple of special properties (meaning of `$crate`,
-    /// availability in `#[no_implicit_prelude]` modules), so we have to keep this flag.
+    /// Built-in macros have a couple of special properties like availability
+    /// in `#[no_implicit_prelude]` modules, so we have to keep this flag.
     pub is_builtin: bool,
     /// We have to identify macros providing a `Copy` impl early for compatibility reasons.
     pub is_derive_copy: bool,
diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs
index db562840e8d..22962499a2b 100644
--- a/src/libsyntax/ext/build.rs
+++ b/src/libsyntax/ext/build.rs
@@ -495,7 +495,7 @@ impl<'a> ExtCtxt<'a> {
         let expr_loc_ptr = self.expr_addr_of(span, expr_loc_tuple);
         self.expr_call_global(
             span,
-            self.std_path(&[sym::rt, sym::begin_panic]),
+            [sym::std, sym::rt, sym::begin_panic].iter().map(|s| Ident::new(*s, span)).collect(),
             vec![
                 self.expr_str(span, msg),
                 expr_loc_ptr])
diff --git a/src/test/pretty/dollar-crate.pp b/src/test/pretty/dollar-crate.pp
index 3d2d949be2b..131cd0a67c6 100644
--- a/src/test/pretty/dollar-crate.pp
+++ b/src/test/pretty/dollar-crate.pp
@@ -10,9 +10,9 @@ extern crate std;
 
 fn main() {
     {
-        ::std::io::_print(::std::fmt::Arguments::new_v1(&["rust\n"],
-                                                        &match () {
-                                                             () => [],
-                                                         }));
+        ::std::io::_print(::core::fmt::Arguments::new_v1(&["rust\n"],
+                                                         &match () {
+                                                              () => [],
+                                                          }));
     };
 }
diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp
index bd839d35421..4cf2e90e635 100644
--- a/src/test/pretty/issue-4264.pp
+++ b/src/test/pretty/issue-4264.pp
@@ -30,7 +30,7 @@ pub fn bar() ({
 
 
                   ((::alloc::fmt::format as
-                       for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::std::fmt::Arguments>::new_v1
+                       for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::core::fmt::Arguments>::new_v1
                                                                                                            as
                                                                                                            fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments::<'_>::new_v1})((&([("test"
                                                                                                                                                                                                                             as
diff --git a/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs b/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs
index 877fb57a251..29c1b8fb0da 100644
--- a/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs
+++ b/src/test/ui-fulldeps/deriving-encodable-decodable-box.rs
@@ -5,11 +5,10 @@
 #![feature(box_syntax)]
 #![feature(rustc_private)]
 
-extern crate serialize;
-use serialize as rustc_serialize;
+extern crate serialize as rustc_serialize;
 
-use serialize::{Encodable, Decodable};
-use serialize::json;
+use rustc_serialize::{Encodable, Decodable};
+use rustc_serialize::json;
 
 #[derive(RustcEncodable, RustcDecodable)]
 struct A {
diff --git a/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs b/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs
index a35b681641a..fe608890bbd 100644
--- a/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs
+++ b/src/test/ui-fulldeps/deriving-encodable-decodable-cell-refcell.rs
@@ -7,12 +7,11 @@
 
 #![feature(rustc_private)]
 
-extern crate serialize;
-use serialize as rustc_serialize;
+extern crate serialize as rustc_serialize;
 
 use std::cell::{Cell, RefCell};
-use serialize::{Encodable, Decodable};
-use serialize::json;
+use rustc_serialize::{Encodable, Decodable};
+use rustc_serialize::json;
 
 #[derive(RustcEncodable, RustcDecodable)]
 struct A {
diff --git a/src/test/ui-fulldeps/deriving-global.rs b/src/test/ui-fulldeps/deriving-global.rs
index b59d55ff213..d7cc98fed25 100644
--- a/src/test/ui-fulldeps/deriving-global.rs
+++ b/src/test/ui-fulldeps/deriving-global.rs
@@ -2,8 +2,7 @@
 
 #![feature(rustc_private)]
 
-extern crate serialize;
-use serialize as rustc_serialize;
+extern crate serialize as rustc_serialize;
 
 mod submod {
     // if any of these are implemented without global calls for any
diff --git a/src/test/ui-fulldeps/deriving-hygiene.rs b/src/test/ui-fulldeps/deriving-hygiene.rs
index 0d7439ef872..b1bdfaceb88 100644
--- a/src/test/ui-fulldeps/deriving-hygiene.rs
+++ b/src/test/ui-fulldeps/deriving-hygiene.rs
@@ -2,8 +2,7 @@
 
 #![allow(non_upper_case_globals)]
 #![feature(rustc_private)]
-extern crate serialize;
-use serialize as rustc_serialize;
+extern crate serialize as rustc_serialize;
 
 pub const other: u8 = 1;
 pub const f: u8 = 1;
diff --git a/src/test/ui-fulldeps/issue-11881.rs b/src/test/ui-fulldeps/issue-11881.rs
index c8893e62941..bd046a6cdee 100644
--- a/src/test/ui-fulldeps/issue-11881.rs
+++ b/src/test/ui-fulldeps/issue-11881.rs
@@ -6,17 +6,16 @@
 
 #![feature(rustc_private)]
 
-extern crate serialize;
-use serialize as rustc_serialize;
+extern crate serialize as rustc_serialize;
 
 use std::io::Cursor;
 use std::io::prelude::*;
 use std::fmt;
 use std::slice;
 
-use serialize::{Encodable, Encoder};
-use serialize::json;
-use serialize::opaque;
+use rustc_serialize::{Encodable, Encoder};
+use rustc_serialize::json;
+use rustc_serialize::opaque;
 
 #[derive(RustcEncodable)]
 struct Foo {