diff --git a/rust-version b/rust-version index 49e9739a2e..4cf2697aa4 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -7c71bc3208031b1307573de45a3b3e18fa45787a +372be4f360ce42b1a10126a711189796f8440ab4 diff --git a/src/bin/miri-rustc-tests.rs b/src/bin/miri-rustc-tests.rs index ce2ad1a271..cf50f8125c 100644 --- a/src/bin/miri-rustc-tests.rs +++ b/src/bin/miri-rustc-tests.rs @@ -30,7 +30,7 @@ struct MiriCompilerCalls { impl rustc_driver::Callbacks for MiriCompilerCalls { fn after_parsing(&mut self, compiler: &interface::Compiler) -> bool { let attr = ( - String::from("miri"), + syntax::symbol::Symbol::intern("miri"), syntax::feature_gate::AttributeType::Whitelisted, ); compiler.session().plugin_attributes.borrow_mut().push(attr); @@ -47,7 +47,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { impl<'a, 'tcx: 'a, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'a, 'tcx> { fn visit_item(&mut self, i: &'hir hir::Item) { if let hir::ItemKind::Fn(.., body_id) = i.node { - if i.attrs.iter().any(|attr| attr.check_name("test")) { + if i.attrs.iter().any(|attr| attr.check_name(syntax::symbol::sym::test)) { let config = MiriConfig { validate: true, args: vec![], seed: None }; let did = self.0.hir().body_owner_def_id(body_id); println!("running test: {}", self.0.def_path_debug_str(did)); diff --git a/src/bin/miri.rs b/src/bin/miri.rs index 6e68f803f8..31ed5f2ccd 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -27,7 +27,7 @@ struct MiriCompilerCalls { impl rustc_driver::Callbacks for MiriCompilerCalls { fn after_parsing(&mut self, compiler: &interface::Compiler) -> bool { let attr = ( - String::from("miri"), + syntax::symbol::Symbol::intern("miri"), syntax::feature_gate::AttributeType::Whitelisted, ); compiler.session().plugin_attributes.borrow_mut().push(attr); @@ -66,26 +66,26 @@ fn init_early_loggers() { // If it is not set, we avoid initializing now so that we can initialize // later with our custom settings, and *not* log anything for what happens before // `miri` gets started. - if env::var("RUST_LOG").is_ok() { + if env::var("RUSTC_LOG").is_ok() { rustc_driver::init_rustc_env_logger(); } } fn init_late_loggers() { - // We initialize loggers right before we start evaluation. We overwrite the `RUST_LOG` + // We initialize loggers right before we start evaluation. We overwrite the `RUSTC_LOG` // env var if it is not set, control it based on `MIRI_LOG`. if let Ok(var) = env::var("MIRI_LOG") { - if env::var("RUST_LOG").is_err() { + if env::var("RUSTC_LOG").is_err() { // We try to be a bit clever here: if `MIRI_LOG` is just a single level // used for everything, we only apply it to the parts of rustc that are - // CTFE-related. Otherwise, we use it verbatim for `RUST_LOG`. + // CTFE-related. Otherwise, we use it verbatim for `RUSTC_LOG`. // This way, if you set `MIRI_LOG=trace`, you get only the right parts of // rustc traced, but you can also do `MIRI_LOG=miri=trace,rustc_mir::interpret=debug`. if log::Level::from_str(&var).is_ok() { - env::set_var("RUST_LOG", + env::set_var("RUSTC_LOG", &format!("rustc::mir::interpret={0},rustc_mir::interpret={0}", var)); } else { - env::set_var("RUST_LOG", &var); + env::set_var("RUSTC_LOG", &var); } rustc_driver::init_rustc_env_logger(); } diff --git a/src/fn_call.rs b/src/fn_call.rs index 1fd10ff385..3ff0c1eb18 100644 --- a/src/fn_call.rs +++ b/src/fn_call.rs @@ -3,6 +3,7 @@ use rustc::ty::layout::{Align, LayoutOf, Size}; use rustc::hir::def_id::DefId; use rustc::mir; use syntax::attr; +use syntax::symbol::sym; use rand::RngCore; @@ -141,7 +142,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<' ) -> EvalResult<'tcx> { let this = self.eval_context_mut(); let attrs = this.tcx.get_attrs(def_id); - let link_name = match attr::first_attr_value_str_by_name(&attrs, "link_name") { + let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) { Some(name) => name.as_str(), None => this.tcx.item_name(def_id).as_str(), }; diff --git a/src/helpers.rs b/src/helpers.rs index f468d25603..89aba49472 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -14,7 +14,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<' this.tcx .crates() .iter() - .find(|&&krate| this.tcx.original_crate_name(krate) == path[0]) + .find(|&&krate| this.tcx.original_crate_name(krate).as_str() == path[0]) .and_then(|krate| { let krate = DefId { krate: *krate, @@ -25,12 +25,12 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<' while let Some(segment) = path_it.next() { for item in mem::replace(&mut items, Default::default()).iter() { - if item.ident.name == *segment { + if item.ident.name.as_str() == *segment { if path_it.peek().is_none() { - return Some(ty::Instance::mono(this.tcx.tcx, item.def.def_id())); + return Some(ty::Instance::mono(this.tcx.tcx, item.res.def_id())); } - items = this.tcx.item_children(item.def.def_id()); + items = this.tcx.item_children(item.res.def_id()); break; } } diff --git a/src/lib.rs b/src/lib.rs index 683eee0cb7..d3e30bbdde 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -37,6 +37,7 @@ pub use rustc_mir::interpret::*; pub use rustc_mir::interpret::{self, AllocMap, PlaceTy}; use syntax::attr; use syntax::source_map::DUMMY_SP; +use syntax::symbol::sym; pub use crate::fn_call::EvalContextExt as MissingFnsEvalContextExt; pub use crate::operator::EvalContextExt as OperatorEvalContextExt; @@ -478,7 +479,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> { memory_extra: &Self::MemoryExtra, ) -> EvalResult<'tcx, Cow<'tcx, Allocation>> { let attrs = tcx.get_attrs(def_id); - let link_name = match attr::first_attr_value_str_by_name(&attrs, "link_name") { + let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) { Some(name) => name.as_str(), None => tcx.item_name(def_id).as_str(), }; diff --git a/tests/run-pass/hashmap.rs b/tests/run-pass/hashmap.rs index 55037f55bf..e249238d48 100644 --- a/tests/run-pass/hashmap.rs +++ b/tests/run-pass/hashmap.rs @@ -24,12 +24,10 @@ fn test_map(mut map: HashMap) { } fn main() { - if cfg!(target_os = "macos") { // TODO: Implement random number generation on OS X. + if cfg!(target_os = "macos") { // TODO: Implement libstd HashMap seeding for macOS (https://github.com/rust-lang/miri/issues/686). // Until then, use a deterministic map. - let map : HashMap> = HashMap::default(); - test_map(map); + test_map::>(HashMap::default()); } else { - let map: HashMap = HashMap::default(); - test_map(map); + test_map(HashMap::new()); } }