aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/rust-const-blog-issue.rs
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-09-18 10:37:06 +0100
committerArthur Cohen <arthur.cohen@embecosm.com>2023-01-31 14:16:52 +0100
commitf92f8ee75bf0f4a653218a52698263b559c463a4 (patch)
tree83ead212e1ebc96e2ec2e5fa94c76a30ca5b3a75 /gcc/testsuite/rust/compile/rust-const-blog-issue.rs
parenta0c2ea3ee6e47f4090759ad4cacd43225ceea669 (diff)
downloadgcc-f92f8ee75bf0f4a653218a52698263b559c463a4.zip
gcc-f92f8ee75bf0f4a653218a52698263b559c463a4.tar.gz
gcc-f92f8ee75bf0f4a653218a52698263b559c463a4.tar.bz2
gccrs: Add testcase for const-eval issue from rust-blog
see: https://blog.rust-lang.org/2022/09/15/const-eval-safety-rule-revision.html gcc/testsuite/ChangeLog: * rust/compile/rust-const-blog-issue.rs: New test.
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;
+};