mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
72800d3b89
Except for `simd-intrinsic/`, which has a lot of files containing multiple types like `u8x64` which really are better when hand-formatted. There is a surprising amount of two-space indenting in this directory. Non-trivial changes: - `rustfmt::skip` needed in `debug-column.rs` to preserve meaning of the test. - `rustfmt::skip` used in a few places where hand-formatting read more nicely: `enum/enum-match.rs` - Line number adjustments needed for the expected output of `debug-column.rs` and `coroutine-debug.rs`.
41 lines
743 B
Rust
41 lines
743 B
Rust
//@ compile-flags: -O
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
// Adapted from <https://github.com/rust-lang/rust/issues/73258#issue-637346014>
|
|
|
|
#[derive(Clone, Copy)]
|
|
#[repr(u8)]
|
|
pub enum Foo {
|
|
A,
|
|
B,
|
|
C,
|
|
D,
|
|
}
|
|
|
|
// CHECK-LABEL: @issue_73258(
|
|
#[no_mangle]
|
|
pub unsafe fn issue_73258(ptr: *const Foo) -> Foo {
|
|
// CHECK-NOT: icmp
|
|
// CHECK-NOT: call
|
|
// CHECK-NOT: br
|
|
// CHECK-NOT: select
|
|
|
|
// CHECK: %[[R:.+]] = load i8
|
|
// CHECK-SAME: !range !
|
|
|
|
// CHECK-NOT: icmp
|
|
// CHECK-NOT: call
|
|
// CHECK-NOT: br
|
|
// CHECK-NOT: select
|
|
|
|
// CHECK: ret i8 %[[R]]
|
|
|
|
// CHECK-NOT: icmp
|
|
// CHECK-NOT: call
|
|
// CHECK-NOT: br
|
|
// CHECK-NOT: select
|
|
let k: Option<Foo> = Some(ptr.read());
|
|
return k.unwrap();
|
|
}
|