Skip to content

Commit 8d9db57

Browse files
committed
Auto merge of #1335 - vakaras:add-threads-noop, r=RalfJung
Move the stack to the evaluator. (no-op PR for 70598) The changes to Miri to make it to compile with Rustc PR rust-lang/rust#70598.
2 parents 763782a + 7406c12 commit 8d9db57

23 files changed

+60
-43
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b2c1a606feb1fbdb0ac0acba76f881ef172ed474
1+
9b2f8dbba39dd4167f22a7026674a585c3d907d8

src/diagnostics.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub enum NonHaltingDiagnostic {
4747

4848
/// Emit a custom diagnostic without going through the miri-engine machinery
4949
pub fn report_error<'tcx, 'mir>(
50-
ecx: &InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
50+
ecx: &InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
5151
mut e: InterpErrorInfo<'tcx>,
5252
) -> Option<i64> {
5353
use InterpError::*;
@@ -121,13 +121,13 @@ pub fn report_error<'tcx, 'mir>(
121121
/// Report an error or note (depending on the `error` argument) at the current frame's current statement.
122122
/// Also emits a full stacktrace of the interpreter stack.
123123
fn report_msg<'tcx, 'mir>(
124-
ecx: &InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
124+
ecx: &InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
125125
title: &str,
126126
span_msg: String,
127127
mut helps: Vec<String>,
128128
error: bool,
129129
) -> Option<i64> {
130-
let span = if let Some(frame) = ecx.stack().last() {
130+
let span = if let Some(frame) = ecx.machine.stack.last() {
131131
frame.current_source_info().unwrap().span
132132
} else {
133133
DUMMY_SP
@@ -159,7 +159,7 @@ fn report_msg<'tcx, 'mir>(
159159

160160
err.emit();
161161

162-
for (i, frame) in ecx.stack().iter().enumerate() {
162+
for (i, frame) in ecx.machine.stack.iter().enumerate() {
163163
trace!("-------------------");
164164
trace!("Frame {}", i);
165165
trace!(" return: {:?}", frame.return_place.map(|p| *p));
@@ -181,7 +181,7 @@ pub fn register_diagnostic(e: NonHaltingDiagnostic) {
181181
DIAGNOSTICS.with(|diagnostics| diagnostics.borrow_mut().push(e));
182182
}
183183

184-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
184+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
185185
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
186186
/// Emit all diagnostics that were registed with `register_diagnostics`
187187
fn process_diagnostics(&self) {

src/eval.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub fn create_ecx<'mir, 'tcx: 'mir>(
6262
tcx: TyCtxt<'tcx>,
6363
main_id: DefId,
6464
config: MiriConfig,
65-
) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, Evaluator<'tcx>>, MPlaceTy<'tcx, Tag>)> {
65+
) -> InterpResult<'tcx, (InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>, MPlaceTy<'tcx, Tag>)> {
6666
let tcx_at = tcx.at(rustc_span::source_map::DUMMY_SP);
6767
let param_env = ty::ParamEnv::reveal_all();
6868
let layout_cx = LayoutCx { tcx, param_env };

src/helpers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use rand::RngCore;
1313

1414
use crate::*;
1515

16-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
16+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
1717

1818
/// Gets an instance for a path.
1919
fn try_resolve_did<'mir, 'tcx>(tcx: TyCtxt<'tcx>, path: &[&str]) -> Option<DefId> {
@@ -265,7 +265,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
265265
unsafe_cell_action: F,
266266
}
267267

268-
impl<'ecx, 'mir, 'tcx, F> ValueVisitor<'mir, 'tcx, Evaluator<'tcx>>
268+
impl<'ecx, 'mir, 'tcx: 'mir, F> ValueVisitor<'mir, 'tcx, Evaluator<'mir, 'tcx>>
269269
for UnsafeCellVisitor<'ecx, 'mir, 'tcx, F>
270270
where
271271
F: FnMut(MPlaceTy<'tcx, Tag>) -> InterpResult<'tcx>,

src/intptrcast.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl Default for GlobalState {
4141
impl<'mir, 'tcx> GlobalState {
4242
pub fn int_to_ptr(
4343
int: u64,
44-
memory: &Memory<'mir, 'tcx, Evaluator<'tcx>>,
44+
memory: &Memory<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
4545
) -> InterpResult<'tcx, Pointer<Tag>> {
4646
let global_state = memory.extra.intptrcast.borrow();
4747
let pos = global_state.int_to_ptr_map.binary_search_by_key(&int, |(addr, _)| *addr);
@@ -73,7 +73,7 @@ impl<'mir, 'tcx> GlobalState {
7373

7474
pub fn ptr_to_int(
7575
ptr: Pointer<Tag>,
76-
memory: &Memory<'mir, 'tcx, Evaluator<'tcx>>,
76+
memory: &Memory<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
7777
) -> InterpResult<'tcx, u64> {
7878
let mut global_state = memory.extra.intptrcast.borrow_mut();
7979
let global_state = &mut *global_state;

src/machine.rs

+22-4
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl<'mir, 'tcx: 'mir> PrimitiveLayouts<'tcx> {
215215
}
216216

217217
/// The machine itself.
218-
pub struct Evaluator<'tcx> {
218+
pub struct Evaluator<'mir, 'tcx> {
219219
/// Environment variables set by `setenv`.
220220
/// Miri does not expose env vars from the host to the emulated program.
221221
pub(crate) env_vars: EnvVars<'tcx>,
@@ -251,11 +251,14 @@ pub struct Evaluator<'tcx> {
251251
/// The "time anchor" for this machine's monotone clock (for `Instant` simulation).
252252
pub(crate) time_anchor: Instant,
253253

254+
/// The call stack.
255+
pub(crate) stack: Vec<Frame<'mir, 'tcx, Tag, FrameData<'tcx>>>,
256+
254257
/// Precomputed `TyLayout`s for primitive data types that are commonly used inside Miri.
255258
pub(crate) layouts: PrimitiveLayouts<'tcx>,
256259
}
257260

258-
impl<'tcx> Evaluator<'tcx> {
261+
impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
259262
pub(crate) fn new(
260263
communicate: bool,
261264
validate: bool,
@@ -279,12 +282,13 @@ impl<'tcx> Evaluator<'tcx> {
279282
panic_payload: None,
280283
time_anchor: Instant::now(),
281284
layouts,
285+
stack: Vec::default(),
282286
}
283287
}
284288
}
285289

286290
/// A rustc InterpCx for Miri.
287-
pub type MiriEvalContext<'mir, 'tcx> = InterpCx<'mir, 'tcx, Evaluator<'tcx>>;
291+
pub type MiriEvalContext<'mir, 'tcx> = InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>;
288292

289293
/// A little trait that's useful to be inherited by extension traits.
290294
pub trait MiriEvalContextExt<'mir, 'tcx> {
@@ -303,7 +307,7 @@ impl<'mir, 'tcx> MiriEvalContextExt<'mir, 'tcx> for MiriEvalContext<'mir, 'tcx>
303307
}
304308

305309
/// Machine hook implementations.
306-
impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
310+
impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
307311
type MemoryKind = MiriMemoryKind;
308312

309313
type FrameExtra = FrameData<'tcx>;
@@ -521,6 +525,20 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
521525
Ok(frame.with_extra(extra))
522526
}
523527

528+
#[inline(always)]
529+
fn stack<'a>(
530+
ecx: &'a InterpCx<'mir, 'tcx, Self>,
531+
) -> &'a [Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>] {
532+
&ecx.machine.stack
533+
}
534+
535+
#[inline(always)]
536+
fn stack_mut<'a>(
537+
ecx: &'a mut InterpCx<'mir, 'tcx, Self>,
538+
) -> &'a mut Vec<Frame<'mir, 'tcx, Self::PointerTag, Self::FrameExtra>> {
539+
&mut ecx.machine.stack
540+
}
541+
524542
#[inline(always)]
525543
fn after_stack_push(ecx: &mut InterpCx<'mir, 'tcx, Self>) -> InterpResult<'tcx> {
526544
if ecx.memory.extra.stacked_borrows.is_some() {

src/shims/dlsym.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ impl Dlsym {
2020
}
2121
}
2222

23-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
23+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
2424
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
2525
fn call_dlsym(
2626
&mut self,

src/shims/env.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub struct EnvVars<'tcx> {
3535

3636
impl<'tcx> EnvVars<'tcx> {
3737
pub(crate) fn init<'mir>(
38-
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
38+
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
3939
mut excluded_env_vars: Vec<String>,
4040
) -> InterpResult<'tcx> {
4141
let target_os = ecx.tcx.sess.target.target.target_os.as_str();
@@ -61,7 +61,7 @@ impl<'tcx> EnvVars<'tcx> {
6161
}
6262

6363
pub(crate) fn cleanup<'mir>(
64-
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
64+
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
6565
) -> InterpResult<'tcx> {
6666
// Deallocate individual env vars.
6767
for (_name, ptr) in ecx.machine.env_vars.map.drain() {
@@ -78,7 +78,7 @@ impl<'tcx> EnvVars<'tcx> {
7878
fn alloc_env_var_as_c_str<'mir, 'tcx>(
7979
name: &OsStr,
8080
value: &OsStr,
81-
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
81+
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
8282
) -> InterpResult<'tcx, Pointer<Tag>> {
8383
let mut name_osstring = name.to_os_string();
8484
name_osstring.push("=");
@@ -89,15 +89,15 @@ fn alloc_env_var_as_c_str<'mir, 'tcx>(
8989
fn alloc_env_var_as_wide_str<'mir, 'tcx>(
9090
name: &OsStr,
9191
value: &OsStr,
92-
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'tcx>>,
92+
ecx: &mut InterpCx<'mir, 'tcx, Evaluator<'mir, 'tcx>>,
9393
) -> InterpResult<'tcx, Pointer<Tag>> {
9494
let mut name_osstring = name.to_os_string();
9595
name_osstring.push("=");
9696
name_osstring.push(value);
9797
Ok(ecx.alloc_os_str_as_wide_str(name_osstring.as_os_str(), MiriMemoryKind::Env.into()))
9898
}
9999

100-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
100+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
101101
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
102102
fn getenv(&mut self, name_op: OpTy<'tcx, Tag>) -> InterpResult<'tcx, Scalar<Tag>> {
103103
let this = self.eval_context_mut();

src/shims/foreign_items.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_ast::attr;
1212

1313
use crate::*;
1414

15-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
15+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
1616
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1717
/// Returns the minimum alignment for the target architecture for allocations of the given size.
1818
fn min_align(&self, size: u64, kind: MiriMemoryKind) -> Align {

src/shims/foreign_items/posix.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::*;
99
use rustc_middle::mir;
1010
use rustc_target::abi::{Align, LayoutOf, Size};
1111

12-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
12+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
1313
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1414
fn emulate_foreign_item_by_name(
1515
&mut self,

src/shims/foreign_items/posix/linux.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::*;
22
use rustc_middle::mir;
33

4-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
4+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
55
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
66
fn emulate_foreign_item_by_name(
77
&mut self,

src/shims/foreign_items/posix/macos.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::*;
22
use rustc_middle::mir;
33

4-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
4+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
55
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
66
fn emulate_foreign_item_by_name(
77
&mut self,

src/shims/foreign_items/windows.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_target::abi::Size;
55

66
use crate::*;
77

8-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
8+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
99
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1010
fn emulate_foreign_item_by_name(
1111
&mut self,

src/shims/fs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ impl FileHandler {
6464
}
6565
}
6666

67-
impl<'mir, 'tcx> EvalContextExtPrivate<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
67+
impl<'mir, 'tcx: 'mir> EvalContextExtPrivate<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
6868
trait EvalContextExtPrivate<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
6969
/// Emulate `stat` or `lstat` on `macos`. This function is not intended to be
7070
/// called directly from `emulate_foreign_item_by_name`, so it does not check if isolation is
@@ -232,7 +232,7 @@ impl Default for DirHandler {
232232
}
233233
}
234234

235-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
235+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
236236
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
237237
fn open(
238238
&mut self,

src/shims/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use rustc_target::abi::{Align, LayoutOf, Size};
88

99
use crate::*;
1010

11-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
11+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
1212
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1313
fn call_intrinsic(
1414
&mut self,

src/shims/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::{mir, ty};
1717

1818
use crate::*;
1919

20-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
20+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
2121
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
2222
fn find_mir_or_eval_fn(
2323
&mut self,

src/shims/os_str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ fn convert_path_separator<'a>(
6060
};
6161
}
6262

63-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
63+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
6464
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
6565
/// Helper function to read an OsString from a null-terminated sequence of bytes, which is what
6666
/// the Unix APIs usually handle.

src/shims/panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub struct CatchUnwindData<'tcx> {
3131
ret: mir::BasicBlock,
3232
}
3333

34-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
34+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
3535
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
3636
/// Check if panicking is supported on this target, and give a good error otherwise.
3737
fn check_panic_supported(&self) -> InterpResult<'tcx> {

src/shims/time.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ pub fn system_time_to_duration<'tcx>(time: &SystemTime) -> InterpResult<'tcx, Du
1111
.map_err(|_| err_unsup_format!("times before the Unix epoch are not supported").into())
1212
}
1313

14-
15-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
14+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
1615
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
1716
fn clock_gettime(
1817
&mut self,

src/shims/tls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl<'tcx> TlsData<'tcx> {
154154
}
155155
}
156156

157-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
157+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
158158
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
159159
fn run_tls_dtors(&mut self) -> InterpResult<'tcx> {
160160
let this = self.eval_context_mut();

src/stacked_borrows.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ impl Stacks {
506506

507507
/// Retagging/reborrowing. There is some policy in here, such as which permissions
508508
/// to grant for which references, and when to add protectors.
509-
impl<'mir, 'tcx> EvalContextPrivExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
509+
impl<'mir, 'tcx: 'mir> EvalContextPrivExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
510510
trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
511511
fn reborrow(
512512
&mut self,
@@ -607,7 +607,7 @@ trait EvalContextPrivExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
607607
}
608608
}
609609

610-
impl<'mir, 'tcx> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
610+
impl<'mir, 'tcx: 'mir> EvalContextExt<'mir, 'tcx> for crate::MiriEvalContext<'mir, 'tcx> {}
611611
pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx> {
612612
fn retag(&mut self, kind: RetagKind, place: PlaceTy<'tcx, Tag>) -> InterpResult<'tcx> {
613613
let this = self.eval_context_mut();

test-cargo-miri/build.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
#![feature(asm)]
1+
#![feature(llvm_asm)]
22

33
fn not_in_miri() -> i32 {
44
// Inline assembly definitely does not work in Miri.
55
let dummy = 42;
66
unsafe {
7-
asm!("" : : "r"(&dummy));
7+
llvm_asm!("" : : "r"(&dummy));
88
}
99
return dummy;
1010
}

tests/compile-fail/rc_as_raw.rs renamed to tests/compile-fail/rc_as_ptr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
use std::rc::{Rc, Weak};
66
use std::ptr;
77

8-
/// Taken from the `Weak::as_raw` doctest.
8+
/// Taken from the `Weak::as_ptr` doctest.
99
fn main() {
1010
let strong = Rc::new(Box::new(42));
1111
let weak = Rc::downgrade(&strong);
1212
// Both point to the same object
13-
assert!(ptr::eq(&*strong, Weak::as_raw(&weak)));
13+
assert!(ptr::eq(&*strong, Weak::as_ptr(&weak)));
1414
// The strong here keeps it alive, so we can still access the object.
15-
assert_eq!(42, **unsafe { &*Weak::as_raw(&weak) });
15+
assert_eq!(42, **unsafe { &*Weak::as_ptr(&weak) });
1616

1717
drop(strong);
1818
// But not any more. We can do Weak::as_raw(&weak), but accessing the pointer would lead to
1919
// undefined behaviour.
20-
assert_eq!(42, **unsafe { &*Weak::as_raw(&weak) }); //~ ERROR dereferenced after this allocation got freed
20+
assert_eq!(42, **unsafe { &*Weak::as_ptr(&weak) }); //~ ERROR dereferenced after this allocation got freed
2121
}

0 commit comments

Comments
 (0)