]> git.lizzy.rs Git - rust.git/blob - src/test/ui/consts/const-needs_drop.rs
Auto merge of #64546 - weiznich:bugfix/rfc-2451-rerebalance-tests, r=nikomatsakis
[rust.git] / src / test / ui / consts / const-needs_drop.rs
1 // run-pass
2
3 use std::mem;
4
5 struct Trivial(u8, f32);
6
7 struct NonTrivial(u8, String);
8
9 const CONST_U8: bool = mem::needs_drop::<u8>();
10 const CONST_STRING: bool = mem::needs_drop::<String>();
11 const CONST_TRIVIAL: bool = mem::needs_drop::<Trivial>();
12 const CONST_NON_TRIVIAL: bool = mem::needs_drop::<NonTrivial>();
13
14 static STATIC_U8: bool = mem::needs_drop::<u8>();
15 static STATIC_STRING: bool = mem::needs_drop::<String>();
16 static STATIC_TRIVIAL: bool = mem::needs_drop::<Trivial>();
17 static STATIC_NON_TRIVIAL: bool = mem::needs_drop::<NonTrivial>();
18
19 fn main() {
20     assert!(!CONST_U8);
21     assert!(CONST_STRING);
22     assert!(!CONST_TRIVIAL);
23     assert!(CONST_NON_TRIVIAL);
24
25     assert!(!STATIC_U8);
26     assert!(STATIC_STRING);
27     assert!(!STATIC_TRIVIAL);
28     assert!(STATIC_NON_TRIVIAL);
29 }