Skip to content

Commit 9f1aec3

Browse files
committed
Auto merge of #1055 - RalfJung:panic-stub, r=RalfJung
minimal rustup for panic changes Main patch by @Aaron1011
2 parents abab020 + f2c0c44 commit 9f1aec3

File tree

10 files changed

+51
-30
lines changed

10 files changed

+51
-30
lines changed

Cargo.lock

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ cargo_miri = ["cargo_metadata", "directories", "rustc_version"]
5959
rustc_tests = []
6060

6161
[dev-dependencies]
62-
compiletest_rs = { version = "0.3.24", features = ["tmp"] }
62+
compiletest_rs = { version = "0.3.24", features = ["tmp", "stable"] }
6363
colored = "1.6"

rust-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
56237d75b4271a8a2e0f47d86ea76ebf6d966152
1+
8831d766ace89bc74714918a7d9fbd3ca5ec946a

src/bin/miri-rustc-tests.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ struct MiriCompilerCalls {
2929
}
3030

3131
impl rustc_driver::Callbacks for MiriCompilerCalls {
32-
fn after_parsing(&mut self, compiler: &interface::Compiler) -> Compilation {
33-
let attr = (
34-
syntax::symbol::Symbol::intern("miri"),
35-
syntax::feature_gate::AttributeType::Whitelisted,
36-
);
37-
compiler.session().plugin_attributes.borrow_mut().push(attr);
38-
39-
Compilation::Continue
40-
}
41-
4232
fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation {
4333
compiler.session().abort_if_errors();
4434
compiler.global_ctxt().unwrap().peek_mut().enter(|tcx| {

src/bin/miri.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ struct MiriCompilerCalls {
2828
}
2929

3030
impl rustc_driver::Callbacks for MiriCompilerCalls {
31-
fn after_parsing(&mut self, compiler: &interface::Compiler) -> Compilation {
32-
let attr = (
33-
syntax::symbol::Symbol::intern("miri"),
34-
syntax::feature_gate::AttributeType::Whitelisted,
35-
);
36-
compiler.session().plugin_attributes.borrow_mut().push(attr);
37-
38-
Compilation::Continue
39-
}
40-
4131
fn after_analysis(&mut self, compiler: &interface::Compiler) -> Compilation {
4232
init_late_loggers();
4333
compiler.session().abort_if_errors();

src/eval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ pub fn eval_main<'tcx>(tcx: TyCtxt<'tcx>, main_id: DefId, config: MiriConfig) {
213213
};
214214
e.print_backtrace();
215215
if let Some(frame) = ecx.stack().last() {
216-
let block = &frame.body.basic_blocks()[frame.block];
216+
let block = &frame.body.basic_blocks()[frame.block.unwrap()];
217217
let span = if frame.stmt < block.statements.len() {
218218
block.statements[frame.stmt].source_info.span
219219
} else {

src/machine.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
173173
args: &[OpTy<'tcx, Tag>],
174174
dest: Option<PlaceTy<'tcx, Tag>>,
175175
ret: Option<mir::BasicBlock>,
176+
_unwind: Option<mir::BasicBlock>,
176177
) -> InterpResult<'tcx, Option<&'mir mir::Body<'tcx>>> {
177178
ecx.find_fn(instance, args, dest, ret)
178179
}
@@ -194,8 +195,14 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
194195
span: Span,
195196
instance: ty::Instance<'tcx>,
196197
args: &[OpTy<'tcx, Tag>],
197-
dest: PlaceTy<'tcx, Tag>,
198+
dest: Option<PlaceTy<'tcx, Tag>>,
199+
_ret: Option<mir::BasicBlock>,
200+
_unwind: Option<mir::BasicBlock>
198201
) -> InterpResult<'tcx> {
202+
let dest = match dest {
203+
Some(dest) => dest,
204+
None => throw_ub!(Unreachable)
205+
};
199206
ecx.call_intrinsic(span, instance, args, dest)
200207
}
201208

@@ -353,13 +360,15 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
353360
fn stack_pop(
354361
ecx: &mut InterpCx<'mir, 'tcx, Self>,
355362
extra: stacked_borrows::CallId,
356-
) -> InterpResult<'tcx> {
357-
Ok(ecx
363+
_unwinding: bool
364+
) -> InterpResult<'tcx, StackPopInfo> {
365+
ecx
358366
.memory
359367
.extra
360368
.stacked_borrows
361369
.borrow_mut()
362-
.end_call(extra))
370+
.end_call(extra);
371+
Ok(StackPopInfo::Normal)
363372
}
364373

365374
#[inline(always)]

src/shims/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
335335
mir,
336336
Some(ret_place),
337337
// Directly return to caller.
338-
StackPopCleanup::Goto(Some(ret)),
338+
StackPopCleanup::Goto { ret: Some(ret), unwind: None },
339339
)?;
340340
let mut args = this.frame().body.args_iter();
341341

src/shims/intrinsics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2222
dest: PlaceTy<'tcx, Tag>,
2323
) -> InterpResult<'tcx> {
2424
let this = self.eval_context_mut();
25-
if this.emulate_intrinsic(span, instance, args, dest)? {
25+
if this.emulate_intrinsic(span, instance, args, Some(dest))? {
2626
return Ok(());
2727
}
2828
let tcx = &{this.tcx.tcx};

src/shims/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
2727
);
2828

2929
// First, run the common hooks also supported by CTFE.
30-
if this.hook_fn(instance, args, dest)? {
30+
if this.hook_panic_fn(instance, args, dest)? {
3131
this.goto_block(ret)?;
3232
return Ok(None);
3333
}

0 commit comments

Comments
 (0)