]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/underscore_const_names.rs
Rollup merge of #106873 - BoxyUwU:ty_const_formatting, r=compiler-errors
[rust.git] / tests / ui / consts / underscore_const_names.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2
3 #![deny(unused)]
4
5 trait Trt {}
6 pub 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 const _ : () = ();
21
22 const _ : i32 = 42;
23 const _ : Str = Str{};
24
25 check_impl!(Str, Trt);
26 check_impl!(Str, Trt);
27
28 fn main() {
29   check_impl!(Str, Trt);
30   check_impl!(Str, Trt);
31 }