//@ unit-test: InstSimplify #![crate_type = "lib"] #![feature(core_intrinsics)] // All these assertions pass, so all the intrinsic calls should be deleted. // EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff pub fn removable() { // CHECK-LABEL: fn removable( // CHECK-NOT: assert_inhabited // CHECK-NOT: assert_zero_valid // CHECK-NOT: assert_mem_uninitialized_valid core::intrinsics::assert_inhabited::<()>(); core::intrinsics::assert_zero_valid::(); core::intrinsics::assert_mem_uninitialized_valid::(); } enum Never {} // These assertions all diverge, so their target blocks should become None. // EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff pub fn panics() { // CHECK-LABEL: fn panics( // CHECK: assert_inhabited::() -> unwind // CHECK: assert_zero_valid::<&u8>() -> unwind // CHECK: assert_mem_uninitialized_valid::<&u8>() -> unwind core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::<&u8>(); core::intrinsics::assert_mem_uninitialized_valid::<&u8>(); } // Whether or not these asserts pass isn't known, so they shouldn't be modified. // EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff pub fn generic() { // CHECK-LABEL: fn generic( // CHECK: assert_inhabited::() -> [return: // CHECK: assert_zero_valid::() -> [return: // CHECK: assert_mem_uninitialized_valid::() -> [return: core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::(); core::intrinsics::assert_mem_uninitialized_valid::(); } // Whether or not these asserts pass isn't known, so they shouldn't be modified. // EMIT_MIR intrinsic_asserts.generic_ref.InstSimplify.diff pub fn generic_ref() { // CHECK-LABEL: fn generic_ref( // CHECK: assert_mem_uninitialized_valid::<&T>() -> [return: core::intrinsics::assert_mem_uninitialized_valid::<&T>(); }