summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/const-eval/issue-49296.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/const-eval/issue-49296.rs')
-rw-r--r--tests/ui/consts/const-eval/issue-49296.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/ui/consts/const-eval/issue-49296.rs b/tests/ui/consts/const-eval/issue-49296.rs
new file mode 100644
index 000000000..917777a32
--- /dev/null
+++ b/tests/ui/consts/const-eval/issue-49296.rs
@@ -0,0 +1,14 @@
+// issue-49296: Unsafe shenigans in constants can result in missing errors
+
+use std::mem::transmute;
+
+const fn wat(x: u64) -> &'static u64 {
+ unsafe { transmute(&x) }
+}
+
+const X: u64 = *wat(42);
+//~^ ERROR evaluation of constant value failed
+
+fn main() {
+ println!("{}", X);
+}