aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/rust-const-blog-issue.rs
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/rust/compile/rust-const-blog-issue.rs')
-rw-r--r--gcc/testsuite/rust/compile/rust-const-blog-issue.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/rust/compile/rust-const-blog-issue.rs b/gcc/testsuite/rust/compile/rust-const-blog-issue.rs
new file mode 100644
index 0000000..a5ea2eb
--- /dev/null
+++ b/gcc/testsuite/rust/compile/rust-const-blog-issue.rs
@@ -0,0 +1,12 @@
+// { dg-excess-errors "accessing value of" }
+mod mem {
+ extern "rust-intrinsic" {
+ #[rustc_const_stable(feature = "const_transmute", since = "1.46.0")]
+ fn transmute<T, U>(_: T) -> U;
+ }
+}
+
+pub static FOO: () = unsafe {
+ let illegal_ptr2int: usize = mem::transmute(&());
+ let _copy = illegal_ptr2int;
+};