From eab25383174ec70b76395d079ad6e85dfd15f2ff Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Sun, 1 Dec 2019 00:02:58 +0100 Subject: [PATCH] Rename track-id to track-pointer-tag --- benches/helpers/miri_helper.rs | 2 +- src/bin/miri-rustc-tests.rs | 4 ++-- src/bin/miri.rs | 14 +++++++------- src/eval.rs | 4 ++-- src/machine.rs | 4 ++-- src/stacked_borrows.rs | 8 ++++---- tests/compile-fail/stacked_borrows/track_id.rs | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/benches/helpers/miri_helper.rs b/benches/helpers/miri_helper.rs index 40683f8d7475..e2951110acdf 100644 --- a/benches/helpers/miri_helper.rs +++ b/benches/helpers/miri_helper.rs @@ -32,7 +32,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls<'_> { excluded_env_vars: vec![], args: vec![], seed: None, - tracked_id: None, + tracked_pointer_tag: None, }; eval_main(tcx, entry_def_id, config); }); diff --git a/src/bin/miri-rustc-tests.rs b/src/bin/miri-rustc-tests.rs index 8b1739f3443b..370d2a206178 100644 --- a/src/bin/miri-rustc-tests.rs +++ b/src/bin/miri-rustc-tests.rs @@ -45,7 +45,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { excluded_env_vars: vec![], args: vec![], seed: None, - tracked_id: None, + tracked_pointer_tag: None, }; let did = self.0.hir().body_owner_def_id(body_id); println!("running test: {}", self.0.def_path_debug_str(did)); @@ -66,7 +66,7 @@ impl rustc_driver::Callbacks for MiriCompilerCalls { excluded_env_vars: vec![], args: vec![], seed: None, - tracked_id: None, + tracked_pointer_tag: None, }; miri::eval_main(tcx, entry_def_id, config); diff --git a/src/bin/miri.rs b/src/bin/miri.rs index e3aa75b9e880..48af81296257 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -126,7 +126,7 @@ fn main() { let mut communicate = false; let mut ignore_leaks = false; let mut seed: Option = None; - let mut tracked_id: Option = None; + let mut tracked_pointer_tag: Option = None; let mut rustc_args = vec![]; let mut miri_args = vec![]; let mut after_dashdash = false; @@ -177,15 +177,15 @@ fn main() { arg if arg.starts_with("-Zmiri-env-exclude=") => { excluded_env_vars.push(arg.trim_start_matches("-Zmiri-env-exclude=").to_owned()); }, - arg if arg.starts_with("-Zmiri-track-id=") => { - let id: u64 = match arg.trim_start_matches("-Zmiri-track-id=").parse() { + arg if arg.starts_with("-Zmiri-track-pointer-tag=") => { + let id: u64 = match arg.trim_start_matches("-Zmiri-track-pointer-tag=").parse() { Ok(id) => id, - Err(err) => panic!("-Zmiri-track-id requires a valid `u64` as the argument: {}", err), + Err(err) => panic!("-Zmiri-track-pointer-tag requires a valid `u64` as the argument: {}", err), }; if let Some(id) = miri::PtrId::new(id) { - tracked_id = Some(id); + tracked_pointer_tag = Some(id); } else { - panic!("-Zmiri-track-id must be a nonzero id"); + panic!("-Zmiri-track-pointer-tag must be a nonzero id"); } }, _ => { @@ -220,7 +220,7 @@ fn main() { excluded_env_vars, seed, args: miri_args, - tracked_id, + tracked_pointer_tag, }; rustc_driver::install_ice_hook(); let result = rustc_driver::catch_fatal_errors(move || { diff --git a/src/eval.rs b/src/eval.rs index fb82679523e3..81de2fa882c5 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -27,7 +27,7 @@ pub struct MiriConfig { /// The seed to use when non-determinism or randomness are required (e.g. ptr-to-int cast, `getrandom()`). pub seed: Option, /// The stacked borrow id to report about - pub tracked_id: Option, + pub tracked_pointer_tag: Option, } /// Details of premature program termination. @@ -49,7 +49,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( tcx.at(syntax::source_map::DUMMY_SP), ty::ParamEnv::reveal_all(), Evaluator::new(config.communicate), - MemoryExtra::new(StdRng::seed_from_u64(config.seed.unwrap_or(0)), config.validate, config.tracked_id), + MemoryExtra::new(StdRng::seed_from_u64(config.seed.unwrap_or(0)), config.validate, config.tracked_pointer_tag), ); // Complete initialization. EnvVars::init(&mut ecx, config.excluded_env_vars); diff --git a/src/machine.rs b/src/machine.rs index 3d8e724c57c3..d5cd86d97878 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -77,9 +77,9 @@ pub struct MemoryExtra { } impl MemoryExtra { - pub fn new(rng: StdRng, validate: bool, tracked_id: Option) -> Self { + pub fn new(rng: StdRng, validate: bool, tracked_pointer_tag: Option) -> Self { MemoryExtra { - stacked_borrows: Rc::new(RefCell::new(GlobalState::new(tracked_id))), + stacked_borrows: Rc::new(RefCell::new(GlobalState::new(tracked_pointer_tag))), intptrcast: Default::default(), rng: RefCell::new(rng), validate, diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index be54b7f5abab..ad70b05d8abd 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -106,7 +106,7 @@ pub struct GlobalState { /// Those call IDs corresponding to functions that are still running. active_calls: HashSet, /// The id to trace in this execution run - tracked_id: Option, + tracked_pointer_tag: Option, } /// Memory extra state gives us interior mutable access to the global state. pub type MemoryExtra = Rc>; @@ -154,13 +154,13 @@ impl fmt::Display for RefKind { /// Utilities for initialization and ID generation impl GlobalState { - pub fn new(tracked_id: Option) -> Self { + pub fn new(tracked_pointer_tag: Option) -> Self { GlobalState { next_ptr_id: NonZeroU64::new(1).unwrap(), base_ptr_ids: HashMap::default(), next_call_id: NonZeroU64::new(1).unwrap(), active_calls: HashSet::default(), - tracked_id, + tracked_pointer_tag, } } @@ -272,7 +272,7 @@ impl<'tcx> Stack { /// Check if the given item is protected. fn check_protector(item: &Item, tag: Option, global: &GlobalState) -> InterpResult<'tcx> { if let Tag::Tagged(id) = item.tag { - if Some(id) == global.tracked_id { + if Some(id) == global.tracked_pointer_tag { throw_unsup!(Unsupported(format!("disabling item {:?} for tag {:?}", item, tag))); } } diff --git a/tests/compile-fail/stacked_borrows/track_id.rs b/tests/compile-fail/stacked_borrows/track_id.rs index e691603b5341..35a0f04ee6f1 100644 --- a/tests/compile-fail/stacked_borrows/track_id.rs +++ b/tests/compile-fail/stacked_borrows/track_id.rs @@ -1,4 +1,4 @@ -// compile-flags: -Zmiri-track-id=1372 +// compile-flags: -Zmiri-track-pointer-tag=1372 // do not run on anything but x86_64 linux, because minor libstd changes can change the borrow stack ids // only-x86_64 // only-linux