]> git.lizzy.rs Git - rust.git/blob - src/test/ui/underscore_const_names.rs
811d166ed65a78c7c486a88b09e58ee103895bb5
[rust.git] / src / test / ui / underscore_const_names.rs
1 // compile-pass
2
3 #![feature(const_let)]
4 #![feature(underscore_const_names)]
5
6 trait Trt {}
7 struct Str {}
8 impl Trt for Str {}
9
10 macro_rules! check_impl {
11     ($struct:ident,$trait:ident) => {
12         const _ : () = {
13             use std::marker::PhantomData;
14             struct ImplementsTrait<T: $trait>(PhantomData<T>);
15             let _ = ImplementsTrait::<$struct>(PhantomData);
16             ()
17         };
18     }
19 }
20
21 #[deny(unused)]
22 const _ : () = ();
23
24 const _ : i32 = 42;
25 const _ : Str = Str{};
26
27 check_impl!(Str, Trt);
28 check_impl!(Str, Trt);
29
30 fn main() {
31   check_impl!(Str, Trt);
32   check_impl!(Str, Trt);
33 }