diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 6e5750e752e94..5dd7bc3054829 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 e786e1020026a..4cde00404f0b6 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>, - /// Features enabled for this crate. active_features: FxHashSet, } @@ -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 5af71a0170a7b..8e9e1380002cf 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 d69822c7c7f1a..7f4feff6be670 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -592,8 +592,8 @@ pub struct SyntaxExtension { pub helper_attrs: Vec, /// 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 db562840e8d3b..22962499a2b75 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 3d2d949be2b2e..131cd0a67c669 100644 --- a/src/test/pretty/dollar-crate.pp +++ b/src/test/pretty/dollar-crate.pp @@ -10,9 +10,9 @@ 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 bd839d3542199..4cf2e90e635fd 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -30,7 +30,7 @@ ((::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 877fb57a25132..29c1b8fb0da97 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 a35b681641a4b..fe608890bbd4d 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 b59d55ff213ce..d7cc98fed2595 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 0d7439ef87246..b1bdfaceb887d 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 c8893e629418a..bd046a6cdee5f 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 {