blob: e2578407fea9db894319b9c7b6c263bb3d3ab0d0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#![feature(custom_mir, core_intrinsics)]
#![crate_type = "lib"]
use std::intrinsics::mir::*;
// unit-test: SimplifyCfg-after-uninhabited-enum-branching
// EMIT_MIR simplify_duplicate_unreachable_blocks.assert_nonzero_nonmax.SimplifyCfg-after-uninhabited-enum-branching.diff
#[custom_mir(dialect = "runtime", phase = "post-cleanup")]
pub unsafe fn assert_nonzero_nonmax(x: u8) -> u8 {
mir!(
{
match x {
0 => unreachable1,
u8::MAX => unreachable2,
_ => retblock,
}
}
unreachable1 = {
Unreachable()
}
unreachable2 = {
Unreachable()
}
retblock = {
RET = x;
Return()
}
)
}
|