File tree 1 file changed +7
-1
lines changed
src/tools/miri/tests/pass/intrinsics
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 1
1
//@compile-flags: -Zmiri-permissive-provenance
2
- #![ feature( core_intrinsics, layout_for_ptr) ]
2
+ #![ feature( core_intrinsics, layout_for_ptr, ptr_metadata ) ]
3
3
//! Tests for various intrinsics that do not fit anywhere else.
4
4
5
5
use std:: intrinsics;
@@ -57,4 +57,10 @@ fn main() {
57
57
// Make sure that even if the discriminant is stored together with data, the intrinsic returns
58
58
// only the discriminant, nothing about the data.
59
59
assert_eq ! ( discriminant( & Some ( false ) ) , discriminant( & Some ( true ) ) ) ;
60
+
61
+ let ( ) = intrinsics:: ptr_metadata ( & [ 1 , 2 , 3 ] ) ;
62
+ let len = intrinsics:: ptr_metadata ( & [ 1 , 2 , 3 ] [ ..] ) ;
63
+ assert_eq ! ( len, 3 ) ;
64
+ let dyn_meta = intrinsics:: ptr_metadata ( & [ 1 , 2 , 3 ] as & dyn std:: fmt:: Debug ) ;
65
+ assert_eq ! ( dyn_meta. size_of( ) , 12 ) ;
60
66
}
You can’t perform that action at this time.
0 commit comments