diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-07-21 14:34:12 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2025-07-22 14:28:48 +0200 |
| commit | a27f3e3fd1e4d16160f8885b6b06665b5319f56c (patch) | |
| tree | b033935392cbadf6f85d2dbddf433a88e323aeeb /tests/codegen/precondition-checks.rs | |
| parent | ed93c1783b404d728d4809973a0550eb33cd293f (diff) | |
| download | rust-a27f3e3fd1e4d16160f8885b6b06665b5319f56c.tar.gz rust-a27f3e3fd1e4d16160f8885b6b06665b5319f56c.zip | |
Rename `tests/codegen` into `tests/codegen-llvm`
Diffstat (limited to 'tests/codegen/precondition-checks.rs')
| -rw-r--r-- | tests/codegen/precondition-checks.rs | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/tests/codegen/precondition-checks.rs b/tests/codegen/precondition-checks.rs deleted file mode 100644 index 16812ca1720..00000000000 --- a/tests/codegen/precondition-checks.rs +++ /dev/null @@ -1,25 +0,0 @@ -//@ compile-flags: -Cno-prepopulate-passes -Copt-level=0 -Cdebug-assertions=no - -// This test ensures that in a debug build which turns off debug assertions, we do not monomorphize -// any of the standard library's unsafe precondition checks. -// The naive codegen of those checks contains the actual check underneath an `if false`, which -// could be optimized out if optimizations are enabled. But if we rely on optimizations to remove -// panic branches, then we can't link compiler_builtins without optimizing it, which means that -// -Zbuild-std doesn't work with -Copt-level=0. -// -// In other words, this tests for a mandatory optimization. - -#![crate_type = "lib"] - -use std::ptr::NonNull; - -// CHECK-LABEL: ; core::ptr::non_null::NonNull<T>::new_unchecked -// CHECK-NOT: call -// CHECK: } - -// CHECK-LABEL: @nonnull_new -#[no_mangle] -pub unsafe fn nonnull_new(ptr: *mut u8) -> NonNull<u8> { - // CHECK: ; call core::ptr::non_null::NonNull<T>::new_unchecked - unsafe { NonNull::new_unchecked(ptr) } -} |
