Skip to content

Commit 47b91e6

Browse files
committed
test unreachable intrinsic
1 parent 5d8229e commit 47b91e6

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/shims/intrinsics.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
3636
let (dest, ret) = match ret {
3737
None => match intrinsic_name {
3838
"miri_start_panic" => return this.handle_miri_start_panic(args, unwind),
39+
"unreachable" => throw_ub!(Unreachable),
3940
_ => throw_unsup_format!("unimplemented (diverging) intrinsic: {}", intrinsic_name),
4041
},
4142
Some(p) => p,

tests/compile-fail/unreachable.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// error-pattern: entering unreachable code
2+
fn main() {
3+
unsafe { std::hint::unreachable_unchecked() }
4+
}

0 commit comments

Comments
 (0)