Skip to content

Commit 8ff0aac

Browse files
committed
More review feedback
* Store the local crates in an Rc<[CrateNum]> * Move all the allocation history into Stacks * Clean up the implementation of get_logs_relevant_to a bit
1 parent 972b3b3 commit 8ff0aac

File tree

4 files changed

+168
-187
lines changed

4 files changed

+168
-187
lines changed

src/helpers.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::mem;
22
use std::num::NonZeroUsize;
3+
use std::rc::Rc;
34
use std::time::Duration;
45

56
use log::trace;
@@ -797,7 +798,7 @@ pub fn isolation_abort_error(name: &str) -> InterpResult<'static> {
797798

798799
/// Retrieve the list of local crates that should have been passed by cargo-miri in
799800
/// MIRI_LOCAL_CRATES and turn them into `CrateNum`s.
800-
pub fn get_local_crates(tcx: &TyCtxt<'_>) -> Vec<CrateNum> {
801+
pub fn get_local_crates(tcx: &TyCtxt<'_>) -> Rc<[CrateNum]> {
801802
// Convert the local crate names from the passed-in config into CrateNums so that they can
802803
// be looked up quickly during execution
803804
let local_crate_names = std::env::var("MIRI_LOCAL_CRATES")
@@ -811,7 +812,7 @@ pub fn get_local_crates(tcx: &TyCtxt<'_>) -> Vec<CrateNum> {
811812
local_crates.push(crate_num);
812813
}
813814
}
814-
local_crates
815+
Rc::from(local_crates.as_slice())
815816
}
816817

817818
/// Formats an AllocRange like [0x1..0x3], for use in diagnostics.

src/machine.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::cell::RefCell;
66
use std::collections::HashSet;
77
use std::fmt;
88
use std::num::NonZeroU64;
9+
use std::rc::Rc;
910
use std::time::Instant;
1011

1112
use rand::rngs::StdRng;
@@ -273,7 +274,7 @@ pub struct Evaluator<'mir, 'tcx> {
273274
pub(crate) backtrace_style: BacktraceStyle,
274275

275276
/// Crates which are considered local for the purposes of error reporting.
276-
pub(crate) local_crates: Vec<CrateNum>,
277+
pub(crate) local_crates: Rc<[CrateNum]>,
277278

278279
/// Mapping extern static names to their base pointer.
279280
extern_statics: FxHashMap<Symbol, Pointer<Tag>>,
@@ -307,7 +308,6 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
307308
config.tracked_pointer_tags.clone(),
308309
config.tracked_call_ids.clone(),
309310
config.tag_raw,
310-
local_crates.clone(),
311311
)))
312312
} else {
313313
None
@@ -575,6 +575,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
575575
stacked_borrows,
576576
kind,
577577
&ecx.machine.threads,
578+
ecx.machine.local_crates.clone(),
578579
))
579580
} else {
580581
None

0 commit comments

Comments
 (0)