about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2025-07-16 15:11:11 +0200
committerRalf Jung <post@ralfj.de>2025-07-16 15:29:52 +0200
commit8f854d9cb2d108a2d4f980ccb4d5909e214e6ef0 (patch)
tree96f27edd5f2e963cce5fea17cfacad2a342aa98c /tests/ui
parentfd48b7b8dd911229b635f7969e6213b5af337b7d (diff)
downloadrust-8f854d9cb2d108a2d4f980ccb4d5909e214e6ef0.tar.gz
rust-8f854d9cb2d108a2d4f980ccb4d5909e214e6ef0.zip
const heap: fix ICE on forgotten make_global
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.rs9
-rw-r--r--tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr8
2 files changed, 5 insertions, 12 deletions
diff --git a/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.rs b/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.rs
index 201fa715022..e44a3f7a23c 100644
--- a/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.rs
+++ b/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.rs
@@ -1,12 +1,11 @@
-// We unleash Miri here since this test demonstrates code that bypasses the checks against interning
-// mutable pointers, which currently ICEs. Unleashing Miri silences the ICE.
-//@ compile-flags: -Zunleash-the-miri-inside-of-you
+// Ensure that we reject interning `const_allocate`d allocations in the final value of constants
+// if they have not been made global through `const_make_global`. This covers the case where the
+// pointer is even still mutable, which used to ICE.
 #![feature(core_intrinsics)]
 #![feature(const_heap)]
 use std::intrinsics;
 
 const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32 };
-//~^ error: mutable pointer in final value of constant
-//~| error: encountered `const_allocate` pointer in final value that was not made global
+//~^ error: encountered `const_allocate` pointer in final value that was not made global
 
 fn main() {}
diff --git a/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr b/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr
index eae79d24797..2445ce633d6 100644
--- a/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr
+++ b/tests/ui/consts/const-eval/heap/ptr_not_made_global_mut.stderr
@@ -6,11 +6,5 @@ LL | const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32
    |
    = note: use `const_make_global` to make allocated pointers immutable before returning
 
-error: encountered mutable pointer in final value of constant
-  --> $DIR/ptr_not_made_global_mut.rs:8:1
-   |
-LL | const BAR: *mut i32 = unsafe { intrinsics::const_allocate(4, 4) as *mut i32 };
-   | ^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to 1 previous error