]>
Commit | Line | Data |
---|---|---|
416331ca | 1 | // build-pass (FIXME(62277): could be check-pass?) |
0bf4aa26 | 2 | |
dc9dc135 | 3 | #![deny(unused)] |
0bf4aa26 XL |
4 | |
5 | trait Trt {} | |
dc9dc135 | 6 | pub struct Str {} |
0bf4aa26 XL |
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 | ||
0bf4aa26 XL |
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 | } |