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