Skip to content

Commit 3d43a0b

Browse files
authored
Rustup (#723)
Rustup
2 parents 2602569 + 7a5a030 commit 3d43a0b

File tree

7 files changed

+21
-21
lines changed

7 files changed

+21
-21
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7c71bc3208031b1307573de45a3b3e18fa45787a
1+
372be4f360ce42b1a10126a711189796f8440ab4

src/bin/miri-rustc-tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct MiriCompilerCalls {
3030
impl rustc_driver::Callbacks for MiriCompilerCalls {
3131
fn after_parsing(&mut self, compiler: &interface::Compiler) -> bool {
3232
let attr = (
33-
String::from("miri"),
33+
syntax::symbol::Symbol::intern("miri"),
3434
syntax::feature_gate::AttributeType::Whitelisted,
3535
);
3636
compiler.session().plugin_attributes.borrow_mut().push(attr);
@@ -47,7 +47,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls {
4747
impl<'a, 'tcx: 'a, 'hir> itemlikevisit::ItemLikeVisitor<'hir> for Visitor<'a, 'tcx> {
4848
fn visit_item(&mut self, i: &'hir hir::Item) {
4949
if let hir::ItemKind::Fn(.., body_id) = i.node {
50-
if i.attrs.iter().any(|attr| attr.check_name("test")) {
50+
if i.attrs.iter().any(|attr| attr.check_name(syntax::symbol::sym::test)) {
5151
let config = MiriConfig { validate: true, args: vec![], seed: None };
5252
let did = self.0.hir().body_owner_def_id(body_id);
5353
println!("running test: {}", self.0.def_path_debug_str(did));

src/bin/miri.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ struct MiriCompilerCalls {
2727
impl rustc_driver::Callbacks for MiriCompilerCalls {
2828
fn after_parsing(&mut self, compiler: &interface::Compiler) -> bool {
2929
let attr = (
30-
String::from("miri"),
30+
syntax::symbol::Symbol::intern("miri"),
3131
syntax::feature_gate::AttributeType::Whitelisted,
3232
);
3333
compiler.session().plugin_attributes.borrow_mut().push(attr);
@@ -66,26 +66,26 @@ fn init_early_loggers() {
6666
// If it is not set, we avoid initializing now so that we can initialize
6767
// later with our custom settings, and *not* log anything for what happens before
6868
// `miri` gets started.
69-
if env::var("RUST_LOG").is_ok() {
69+
if env::var("RUSTC_LOG").is_ok() {
7070
rustc_driver::init_rustc_env_logger();
7171
}
7272
}
7373

7474
fn init_late_loggers() {
75-
// We initialize loggers right before we start evaluation. We overwrite the `RUST_LOG`
75+
// We initialize loggers right before we start evaluation. We overwrite the `RUSTC_LOG`
7676
// env var if it is not set, control it based on `MIRI_LOG`.
7777
if let Ok(var) = env::var("MIRI_LOG") {
78-
if env::var("RUST_LOG").is_err() {
78+
if env::var("RUSTC_LOG").is_err() {
7979
// We try to be a bit clever here: if `MIRI_LOG` is just a single level
8080
// used for everything, we only apply it to the parts of rustc that are
81-
// CTFE-related. Otherwise, we use it verbatim for `RUST_LOG`.
81+
// CTFE-related. Otherwise, we use it verbatim for `RUSTC_LOG`.
8282
// This way, if you set `MIRI_LOG=trace`, you get only the right parts of
8383
// rustc traced, but you can also do `MIRI_LOG=miri=trace,rustc_mir::interpret=debug`.
8484
if log::Level::from_str(&var).is_ok() {
85-
env::set_var("RUST_LOG",
85+
env::set_var("RUSTC_LOG",
8686
&format!("rustc::mir::interpret={0},rustc_mir::interpret={0}", var));
8787
} else {
88-
env::set_var("RUST_LOG", &var);
88+
env::set_var("RUSTC_LOG", &var);
8989
}
9090
rustc_driver::init_rustc_env_logger();
9191
}

src/fn_call.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use rustc::ty::layout::{Align, LayoutOf, Size};
33
use rustc::hir::def_id::DefId;
44
use rustc::mir;
55
use syntax::attr;
6+
use syntax::symbol::sym;
67

78
use rand::RngCore;
89

@@ -141,7 +142,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
141142
) -> EvalResult<'tcx> {
142143
let this = self.eval_context_mut();
143144
let attrs = this.tcx.get_attrs(def_id);
144-
let link_name = match attr::first_attr_value_str_by_name(&attrs, "link_name") {
145+
let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) {
145146
Some(name) => name.as_str(),
146147
None => this.tcx.item_name(def_id).as_str(),
147148
};

src/helpers.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
1414
this.tcx
1515
.crates()
1616
.iter()
17-
.find(|&&krate| this.tcx.original_crate_name(krate) == path[0])
17+
.find(|&&krate| this.tcx.original_crate_name(krate).as_str() == path[0])
1818
.and_then(|krate| {
1919
let krate = DefId {
2020
krate: *krate,
@@ -25,12 +25,12 @@ pub trait EvalContextExt<'a, 'mir, 'tcx: 'a + 'mir>: crate::MiriEvalContextExt<'
2525

2626
while let Some(segment) = path_it.next() {
2727
for item in mem::replace(&mut items, Default::default()).iter() {
28-
if item.ident.name == *segment {
28+
if item.ident.name.as_str() == *segment {
2929
if path_it.peek().is_none() {
30-
return Some(ty::Instance::mono(this.tcx.tcx, item.def.def_id()));
30+
return Some(ty::Instance::mono(this.tcx.tcx, item.res.def_id()));
3131
}
3232

33-
items = this.tcx.item_children(item.def.def_id());
33+
items = this.tcx.item_children(item.res.def_id());
3434
break;
3535
}
3636
}

src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ pub use rustc_mir::interpret::*;
3737
pub use rustc_mir::interpret::{self, AllocMap, PlaceTy};
3838
use syntax::attr;
3939
use syntax::source_map::DUMMY_SP;
40+
use syntax::symbol::sym;
4041

4142
pub use crate::fn_call::EvalContextExt as MissingFnsEvalContextExt;
4243
pub use crate::operator::EvalContextExt as OperatorEvalContextExt;
@@ -478,7 +479,7 @@ impl<'a, 'mir, 'tcx> Machine<'a, 'mir, 'tcx> for Evaluator<'tcx> {
478479
memory_extra: &Self::MemoryExtra,
479480
) -> EvalResult<'tcx, Cow<'tcx, Allocation<Tag, Self::AllocExtra>>> {
480481
let attrs = tcx.get_attrs(def_id);
481-
let link_name = match attr::first_attr_value_str_by_name(&attrs, "link_name") {
482+
let link_name = match attr::first_attr_value_str_by_name(&attrs, sym::link_name) {
482483
Some(name) => name.as_str(),
483484
None => tcx.item_name(def_id).as_str(),
484485
};

tests/run-pass/hashmap.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ fn test_map<S: BuildHasher>(mut map: HashMap<i32, i32, S>) {
2424
}
2525

2626
fn main() {
27-
if cfg!(target_os = "macos") { // TODO: Implement random number generation on OS X.
27+
if cfg!(target_os = "macos") { // TODO: Implement libstd HashMap seeding for macOS (https://github.com/rust-lang/miri/issues/686).
2828
// Until then, use a deterministic map.
29-
let map : HashMap<i32, i32, BuildHasherDefault<collections::hash_map::DefaultHasher>> = HashMap::default();
30-
test_map(map);
29+
test_map::<BuildHasherDefault<collections::hash_map::DefaultHasher>>(HashMap::default());
3130
} else {
32-
let map: HashMap<i32, i32> = HashMap::default();
33-
test_map(map);
31+
test_map(HashMap::new());
3432
}
3533
}

0 commit comments

Comments
 (0)