about summary refs log tree commit diff
path: root/tests/ui/const-generics/transmute-const-param-static-reference.rs
diff options
context:
space:
mode:
authorBoxy <supbscripter@gmail.com>2024-07-14 13:38:51 +0100
committerBoxy <rust@boxyuwu.dev>2024-07-17 11:01:29 +0100
commitd0c11bf6e3fea61711af107c896a763a71606340 (patch)
treeb4f60d4dc48e8e63b5404961397198b282010102 /tests/ui/const-generics/transmute-const-param-static-reference.rs
parent42cc42b942088a94d95bc5169724d77429f20582 (diff)
downloadrust-d0c11bf6e3fea61711af107c896a763a71606340.tar.gz
rust-d0c11bf6e3fea61711af107c896a763a71606340.zip
Split part of `adt_const_params` into `unsized_const_params`
Diffstat (limited to 'tests/ui/const-generics/transmute-const-param-static-reference.rs')
-rw-r--r--tests/ui/const-generics/transmute-const-param-static-reference.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/ui/const-generics/transmute-const-param-static-reference.rs b/tests/ui/const-generics/transmute-const-param-static-reference.rs
index 49541233ed1..0b47fd31eaf 100644
--- a/tests/ui/const-generics/transmute-const-param-static-reference.rs
+++ b/tests/ui/const-generics/transmute-const-param-static-reference.rs
@@ -1,16 +1,17 @@
-//@ revisions: full min
+//@ revisions: full adt_const_params min
 //@[full] check-pass
 
-#![cfg_attr(full, feature(adt_const_params))]
+#![cfg_attr(full, feature(adt_const_params, unsized_const_params))]
 #![cfg_attr(full, allow(incomplete_features))]
+#![cfg_attr(adt_const_params, feature(adt_const_params))]
+#![cfg_attr(adt_const_params, allow(incomplete_features))]
 
 struct Const<const P: &'static ()>;
 //[min]~^ ERROR `&'static ()` is forbidden as the type of a const generic parameter
+//[adt_const_params]~^^ ERROR `&'static ()` can't be used as a const parameter type
 
 fn main() {
-    const A: &'static () = unsafe {
-        std::mem::transmute(10 as *const ())
-    };
+    const A: &'static () = unsafe { std::mem::transmute(10 as *const ()) };
 
-    let _ = Const::<{A}>;
+    let _ = Const::<{ A }>;
 }