From 5224c72403fd4f5cbbfd574c9a18fed5678c7488 Mon Sep 17 00:00:00 2001 From: Vytautas Astrauskas Date: Wed, 1 Apr 2020 16:55:52 -0700 Subject: [PATCH 1/3] Move the stack to the evaluator to make Miri compile with the newest Rustc. --- src/diagnostics.rs | 10 +++++----- src/eval.rs | 2 +- src/helpers.rs | 4 ++-- src/intptrcast.rs | 4 ++-- src/machine.rs | 26 ++++++++++++++++++++++---- src/shims/dlsym.rs | 2 +- src/shims/env.rs | 10 +++++----- src/shims/foreign_items.rs | 2 +- src/shims/foreign_items/posix.rs | 2 +- src/shims/foreign_items/posix/linux.rs | 2 +- src/shims/foreign_items/posix/macos.rs | 2 +- src/shims/foreign_items/windows.rs | 2 +- src/shims/fs.rs | 4 ++-- src/shims/intrinsics.rs | 2 +- src/shims/mod.rs | 2 +- src/shims/os_str.rs | 2 +- src/shims/panic.rs | 2 +- src/shims/time.rs | 3 +-- src/shims/tls.rs | 2 +- src/stacked_borrows.rs | 4 ++-- 20 files changed, 53 insertions(+), 36 deletions(-) diff --git a/src/diagnostics.rs b/src/diagnostics.rs index ff52e2385e..5189982b13 100644 --- a/src/diagnostics.rs +++ b/src/diagnostics.rs @@ -47,7 +47,7 @@ pub enum NonHaltingDiagnostic { /// Emit a custom diagnostic without going through the miri-engine machinery pub fn report_error<'tcx, 'mir>( - ecx: &InterpCx<'mir, 'tcx, Evaluator<'tcx>>, + ecx: &InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, mut e: InterpErrorInfo<'tcx>, ) -> Option { use InterpError::*; @@ -121,13 +121,13 @@ pub fn report_error<'tcx, 'mir>( /// Report an error or note (depending on the `error` argument) at the current frame's current statement. /// Also emits a full stacktrace of the interpreter stack. fn report_msg<'tcx, 'mir>( - ecx: &InterpCx<'mir, 'tcx, Evaluator<'tcx>>, + ecx: &InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, title: &str, span_msg: String, mut helps: Vec, error: bool, ) -> Option { - let span = if let Some(frame) = ecx.stack().last() { + let span = if let Some(frame) = ecx.machine.stack.last() { frame.current_source_info().unwrap().span } else { DUMMY_SP @@ -159,7 +159,7 @@ fn report_msg<'tcx, 'mir>( err.emit(); - for (i, frame) in ecx.stack().iter().enumerate() { + for (i, frame) in ecx.machine.stack.iter().enumerate() { trace!("-------------------"); trace!("Frame {}", i); trace!(" return: {:?}", frame.return_place.map(|p| *p)); @@ -181,7 +181,7 @@ pub fn register_diagnostic(e: NonHaltingDiagnostic) { DIAGNOSTICS.with(|diagnostics| diagnostics.borrow_mut().push(e)); } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { /// Emit all diagnostics that were registed with `register_diagnostics` fn process_diagnostics(&self) { diff --git a/src/eval.rs b/src/eval.rs index 1caffe2647..548ecee7bc 100644 --- a/src/eval.rs +++ b/src/eval.rs @@ -62,7 +62,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>( tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig, -) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, Evaluator<'tcx>>, MPlaceTy<'tcx, Tag>)> { +) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, MPlaceTy<'tcx, Tag>)> { let tcx_at = tcx.at(rustc_span::source_map::DUMMY_SP); let param_env = ty::ParamEnv::reveal_all(); let layout_cx = LayoutCx { tcx, param_env }; diff --git a/src/helpers.rs b/src/helpers.rs index 40a33f09a8..644ea25fbc 100644 --- a/src/helpers.rs +++ b/src/helpers.rs @@ -13,7 +13,7 @@ use rand::RngCore; use crate::*; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} /// Gets an instance for a path. fn try_resolve_did<'mir, 'tcx>(tcx: TyCtxt<'tcx>, path: &[&str]) -> Option { @@ -265,7 +265,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx unsafe_cell_action: F, } - impl<'ecx, 'mir, 'tcx, F> ValueVisitor<'mir, 'tcx, Evaluator<'tcx>> + impl<'ecx, 'mir, 'tcx: 'mir, F> ValueVisitor<'mir, 'tcx, Evaluator<'mir, 'tcx>> for UnsafeCellVisitor<'ecx, 'mir, 'tcx, F> where F: FnMut(MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>, diff --git a/src/intptrcast.rs b/src/intptrcast.rs index ac27138d76..5413e6b935 100644 --- a/src/intptrcast.rs +++ b/src/intptrcast.rs @@ -41,7 +41,7 @@ impl Default for GlobalState { impl<'mir, 'tcx> GlobalState { pub fn int_to_ptr( int: u64, - memory: &Memory<'mir, 'tcx, Evaluator<'tcx>>, + memory: &Memory<'mir, 'tcx, Evaluator<'mir, 'tcx>>, ) -> InterpResult<'tcx, Pointer> { let global_state = memory.extra.intptrcast.borrow(); let pos = global_state.int_to_ptr_map.binary_search_by_key(&int, |(addr, _)| *addr); @@ -73,7 +73,7 @@ impl<'mir, 'tcx> GlobalState { pub fn ptr_to_int( ptr: Pointer, - memory: &Memory<'mir, 'tcx, Evaluator<'tcx>>, + memory: &Memory<'mir, 'tcx, Evaluator<'mir, 'tcx>>, ) -> InterpResult<'tcx, u64> { let mut global_state = memory.extra.intptrcast.borrow_mut(); let global_state = &mut *global_state; diff --git a/src/machine.rs b/src/machine.rs index 236b31ec4a..90e6a0e513 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -215,7 +215,7 @@ impl<'mir, 'tcx: 'mir> PrimitiveLayouts<'tcx> { } /// The machine itself. -pub struct Evaluator<'tcx> { +pub struct Evaluator<'mir, 'tcx> { /// Environment variables set by `setenv`. /// Miri does not expose env vars from the host to the emulated program. pub(crate) env_vars: EnvVars<'tcx>, @@ -251,11 +251,14 @@ pub struct Evaluator<'tcx> { /// The "time anchor" for this machine's monotone clock (for `Instant` simulation). pub(crate) time_anchor: Instant, + /// The call stack. + pub(crate) stack: Vec>>, + /// Precomputed `TyLayout`s for primitive data types that are commonly used inside Miri. pub(crate) layouts: PrimitiveLayouts<'tcx>, } -impl<'tcx> Evaluator<'tcx> { +impl<'mir, 'tcx> Evaluator<'mir, 'tcx> { pub(crate) fn new( communicate: bool, validate: bool, @@ -279,12 +282,13 @@ impl<'tcx> Evaluator<'tcx> { panic_payload: None, time_anchor: Instant::now(), layouts, + stack: Vec::default(), } } } /// A rustc InterpCx for Miri. -pub type MiriEvalContext<'mir, 'tcx> = InterpCx<'mir, 'tcx, Evaluator<'tcx>>; +pub type MiriEvalContext<'mir, 'tcx> = InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>; /// A little trait that's useful to be inherited by extension traits. pub trait MiriEvalContextExt<'mir, 'tcx> { @@ -303,7 +307,7 @@ impl<'mir, 'tcx> MiriEvalContextExt<'mir, 'tcx> for MiriEvalContext<'mir, 'tcx> } /// Machine hook implementations. -impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> { +impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> { type MemoryKind = MiriMemoryKind; type FrameExtra = FrameData<'tcx>; @@ -322,6 +326,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> { memory_extra.check_alignment } + #[inline(always)] + fn stack<'a>( + ecx: &'a InterpCx<'mir, 'tcx, Self>, + ) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] { + &ecx.machine.stack + } + + #[inline(always)] + fn stack_mut<'a>( + ecx: &'a mut InterpCx<'mir, 'tcx, Self>, + ) -> &'a mut Vec> { + &mut ecx.machine.stack + } + #[inline(always)] fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool { ecx.machine.validate diff --git a/src/shims/dlsym.rs b/src/shims/dlsym.rs index b5fe3cb722..0f6ba63e98 100644 --- a/src/shims/dlsym.rs +++ b/src/shims/dlsym.rs @@ -20,7 +20,7 @@ impl Dlsym { } } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn call_dlsym( &mut self, diff --git a/src/shims/env.rs b/src/shims/env.rs index 8dd2a3ca30..8459aa3241 100644 --- a/src/shims/env.rs +++ b/src/shims/env.rs @@ -35,7 +35,7 @@ pub struct EnvVars<'tcx> { impl<'tcx> EnvVars<'tcx> { pub(crate) fn init<'mir>( - ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>, + ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, mut excluded_env_vars: Vec, ) -> InterpResult<'tcx> { let target_os = ecx.tcx.sess.target.target.target_os.as_str(); @@ -61,7 +61,7 @@ impl<'tcx> EnvVars<'tcx> { } pub(crate) fn cleanup<'mir>( - ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>, + ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, ) -> InterpResult<'tcx> { // Deallocate individual env vars. for (_name, ptr) in ecx.machine.env_vars.map.drain() { @@ -78,7 +78,7 @@ impl<'tcx> EnvVars<'tcx> { fn alloc_env_var_as_c_str<'mir, 'tcx>( name: &OsStr, value: &OsStr, - ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>, + ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, ) -> InterpResult<'tcx, Pointer> { let mut name_osstring = name.to_os_string(); name_osstring.push("="); @@ -89,7 +89,7 @@ fn alloc_env_var_as_c_str<'mir, 'tcx>( fn alloc_env_var_as_wide_str<'mir, 'tcx>( name: &OsStr, value: &OsStr, - ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>, + ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, ) -> InterpResult<'tcx, Pointer> { let mut name_osstring = name.to_os_string(); name_osstring.push("="); @@ -97,7 +97,7 @@ fn alloc_env_var_as_wide_str<'mir, 'tcx>( Ok(ecx.alloc_os_str_as_wide_str(name_osstring.as_os_str(), MiriMemoryKind::Env.into())) } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn getenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, Scalar> { let this = self.eval_context_mut(); diff --git a/src/shims/foreign_items.rs b/src/shims/foreign_items.rs index 7e7f17b0db..c7ab8dfd87 100644 --- a/src/shims/foreign_items.rs +++ b/src/shims/foreign_items.rs @@ -12,7 +12,7 @@ use rustc_ast::attr; use crate::*; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { /// Returns the minimum alignment for the target architecture for allocations of the given size. fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align { diff --git a/src/shims/foreign_items/posix.rs b/src/shims/foreign_items/posix.rs index 3ececb9c20..9fda0ad4ee 100644 --- a/src/shims/foreign_items/posix.rs +++ b/src/shims/foreign_items/posix.rs @@ -9,7 +9,7 @@ use crate::*; use rustc_middle::mir; use rustc_target::abi::{Align, LayoutOf, Size}; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn emulate_foreign_item_by_name( &mut self, diff --git a/src/shims/foreign_items/posix/linux.rs b/src/shims/foreign_items/posix/linux.rs index 16c6c002b6..b00704e47a 100644 --- a/src/shims/foreign_items/posix/linux.rs +++ b/src/shims/foreign_items/posix/linux.rs @@ -1,7 +1,7 @@ use crate::*; use rustc_middle::mir; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn emulate_foreign_item_by_name( &mut self, diff --git a/src/shims/foreign_items/posix/macos.rs b/src/shims/foreign_items/posix/macos.rs index e7baacf727..125b6b7685 100644 --- a/src/shims/foreign_items/posix/macos.rs +++ b/src/shims/foreign_items/posix/macos.rs @@ -1,7 +1,7 @@ use crate::*; use rustc_middle::mir; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn emulate_foreign_item_by_name( &mut self, diff --git a/src/shims/foreign_items/windows.rs b/src/shims/foreign_items/windows.rs index 1d17cbcefd..8d564d4676 100644 --- a/src/shims/foreign_items/windows.rs +++ b/src/shims/foreign_items/windows.rs @@ -5,7 +5,7 @@ use rustc_target::abi::Size; use crate::*; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn emulate_foreign_item_by_name( &mut self, diff --git a/src/shims/fs.rs b/src/shims/fs.rs index c70cc87416..3e20f5f972 100644 --- a/src/shims/fs.rs +++ b/src/shims/fs.rs @@ -64,7 +64,7 @@ impl FileHandler { } } -impl<'mir, 'tcx> EvalContextExtPrivate<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExtPrivate<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { /// Emulate `stat` or `lstat` on `macos`. This function is not intended to be /// called directly from `emulate_foreign_item_by_name`, so it does not check if isolation is @@ -232,7 +232,7 @@ impl Default for DirHandler { } } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn open( &mut self, diff --git a/src/shims/intrinsics.rs b/src/shims/intrinsics.rs index 1f90042219..b64aeef485 100644 --- a/src/shims/intrinsics.rs +++ b/src/shims/intrinsics.rs @@ -8,7 +8,7 @@ use rustc_target::abi::{Align, LayoutOf, Size}; use crate::*; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn call_intrinsic( &mut self, diff --git a/src/shims/mod.rs b/src/shims/mod.rs index 764e404141..71ff6024ec 100644 --- a/src/shims/mod.rs +++ b/src/shims/mod.rs @@ -17,7 +17,7 @@ use rustc_middle::{mir, ty}; use crate::*; -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn find_mir_or_eval_fn( &mut self, diff --git a/src/shims/os_str.rs b/src/shims/os_str.rs index c24d6df41e..73dc9119a8 100644 --- a/src/shims/os_str.rs +++ b/src/shims/os_str.rs @@ -60,7 +60,7 @@ fn convert_path_separator<'a>( }; } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { /// Helper function to read an OsString from a null-terminated sequence of bytes, which is what /// the Unix APIs usually handle. diff --git a/src/shims/panic.rs b/src/shims/panic.rs index 450f735ad6..c926046a04 100644 --- a/src/shims/panic.rs +++ b/src/shims/panic.rs @@ -31,7 +31,7 @@ pub struct CatchUnwindData<'tcx> { ret: mir::BasicBlock, } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { /// Check if panicking is supported on this target, and give a good error otherwise. fn check_panic_supported(&self) -> InterpResult<'tcx> { diff --git a/src/shims/time.rs b/src/shims/time.rs index de9a0313b1..e26d2ce2e3 100644 --- a/src/shims/time.rs +++ b/src/shims/time.rs @@ -11,8 +11,7 @@ pub fn system_time_to_duration<'tcx>(time: &SystemTime) -> InterpResult<'tcx, Du .map_err(|_| err_unsup_format!("times before the Unix epoch are not supported").into()) } - -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn clock_gettime( &mut self, diff --git a/src/shims/tls.rs b/src/shims/tls.rs index ba072e8ffd..7b84468402 100644 --- a/src/shims/tls.rs +++ b/src/shims/tls.rs @@ -154,7 +154,7 @@ impl<'tcx> TlsData<'tcx> { } } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn run_tls_dtors(&mut self) -> InterpResult<'tcx> { let this = self.eval_context_mut(); diff --git a/src/stacked_borrows.rs b/src/stacked_borrows.rs index a69948002c..3412f00964 100644 --- a/src/stacked_borrows.rs +++ b/src/stacked_borrows.rs @@ -506,7 +506,7 @@ impl Stacks { /// Retagging/reborrowing. There is some policy in here, such as which permissions /// to grant for which references, and when to add protectors. -impl<'mir, 'tcx> EvalContextPrivExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextPrivExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn reborrow( &mut self, @@ -607,7 +607,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx } } -impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} +impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {} pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> { fn retag(&mut self, kind: RetagKind, place: PlaceTy<'tcx, Tag>) -> InterpResult<'tcx> { let this = self.eval_context_mut(); From 192fd3d97e9371345d82c79351da80984cd65e9a Mon Sep 17 00:00:00 2001 From: Vytautas Astrauskas Date: Thu, 16 Apr 2020 10:14:46 -0700 Subject: [PATCH 2/3] Move stack and stack_mut implementation in Machine to match their position in the trait. --- src/machine.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/machine.rs b/src/machine.rs index 90e6a0e513..2ab5f10af6 100644 --- a/src/machine.rs +++ b/src/machine.rs @@ -326,20 +326,6 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> { memory_extra.check_alignment } - #[inline(always)] - fn stack<'a>( - ecx: &'a InterpCx<'mir, 'tcx, Self>, - ) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] { - &ecx.machine.stack - } - - #[inline(always)] - fn stack_mut<'a>( - ecx: &'a mut InterpCx<'mir, 'tcx, Self>, - ) -> &'a mut Vec> { - &mut ecx.machine.stack - } - #[inline(always)] fn enforce_validity(ecx: &InterpCx<'mir, 'tcx, Self>) -> bool { ecx.machine.validate @@ -539,6 +525,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> { Ok(frame.with_extra(extra)) } + #[inline(always)] + fn stack<'a>( + ecx: &'a InterpCx<'mir, 'tcx, Self>, + ) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] { + &ecx.machine.stack + } + + #[inline(always)] + fn stack_mut<'a>( + ecx: &'a mut InterpCx<'mir, 'tcx, Self>, + ) -> &'a mut Vec> { + &mut ecx.machine.stack + } + #[inline(always)] fn after_stack_push(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> { if ecx.memory.extra.stacked_borrows.is_some() { From 5d2c8358f844a943ac5318cfdbe166a6688397cb Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 20 Apr 2020 09:33:34 +0200 Subject: [PATCH 3/3] rustup --- rust-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-version b/rust-version index e9b00f6497..b48a98d229 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -b2c1a606feb1fbdb0ac0acba76f881ef172ed474 +9b2f8dbba39dd4167f22a7026674a585c3d907d8