File tree 1 file changed +3
-1
lines changed
tests/ui/consts/const-eval
1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 1
1
// ignore-tidy-linelength
2
2
#![ allow( unused) ]
3
3
4
- use std:: mem;
4
+ use std:: { ptr , mem} ;
5
5
6
6
// Strip out raw byte dumps to make comparison platform-independent:
7
7
//@ normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
@@ -145,6 +145,8 @@ const RAW_TRAIT_OBJ_VTABLE_NULL: *const dyn Trait = unsafe { mem::transmute((&92
145
145
const RAW_TRAIT_OBJ_VTABLE_INVALID : * const dyn Trait = unsafe { mem:: transmute ( ( & 92u8 , & 3u64 ) ) } ;
146
146
//~^ ERROR it is undefined behavior to use this value
147
147
const RAW_TRAIT_OBJ_CONTENT_INVALID : * const dyn Trait = unsafe { mem:: transmute :: < _ , & bool > ( & 3u8 ) } as * const dyn Trait ; // ok because raw
148
+ // Officially blessed way to get the vtable
149
+ const DYN_METADATA : DynMetadata < dyn Send > = ptr:: metadata :: < dyn Send > ( ptr:: null :: < i32 > ( ) ) ;
148
150
149
151
// Const eval fails for these, so they need to be statics to error.
150
152
static mut RAW_TRAIT_OBJ_VTABLE_NULL_THROUGH_REF : * const dyn Trait = unsafe {
You can’t perform that action at this time.
0 commit comments