summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/transmute-const-param-static-reference.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/transmute-const-param-static-reference.rs')
-rw-r--r--src/test/ui/const-generics/transmute-const-param-static-reference.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/transmute-const-param-static-reference.rs b/src/test/ui/const-generics/transmute-const-param-static-reference.rs
new file mode 100644
index 000000000..6b443c8bd
--- /dev/null
+++ b/src/test/ui/const-generics/transmute-const-param-static-reference.rs
@@ -0,0 +1,16 @@
+// revisions: full min
+//[full] check-pass
+
+#![cfg_attr(full, feature(adt_const_params))]
+#![cfg_attr(full, allow(incomplete_features))]
+
+struct Const<const P: &'static ()>;
+//[min]~^ ERROR `&'static ()` is forbidden as the type of a const generic parameter
+
+fn main() {
+ const A: &'static () = unsafe {
+ std::mem::transmute(10 as *const ())
+ };
+
+ let _ = Const::<{A}>;
+}