2019-07-02 16:30:28 -05:00
|
|
|
//@ build-pass (FIXME(62277): could be check-pass?)
|
2018-10-11 17:34:26 -05:00
|
|
|
|
2019-05-30 05:30:03 -05:00
|
|
|
#![deny(unused)]
|
2018-10-11 17:34:26 -05:00
|
|
|
|
2024-02-06 20:42:01 -06:00
|
|
|
pub trait Trt {}
|
2019-05-30 05:30:03 -05:00
|
|
|
pub struct Str {}
|
2018-10-11 17:34:26 -05:00
|
|
|
impl Trt for Str {}
|
|
|
|
|
|
|
|
macro_rules! check_impl {
|
2024-02-06 20:42:01 -06:00
|
|
|
($struct:ident, $trait:ident) => {
|
2018-10-11 17:34:26 -05:00
|
|
|
const _ : () = {
|
|
|
|
use std::marker::PhantomData;
|
|
|
|
struct ImplementsTrait<T: $trait>(PhantomData<T>);
|
|
|
|
let _ = ImplementsTrait::<$struct>(PhantomData);
|
|
|
|
()
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const _ : () = ();
|
|
|
|
|
|
|
|
const _ : i32 = 42;
|
|
|
|
const _ : Str = Str{};
|
|
|
|
|
|
|
|
check_impl!(Str, Trt);
|
|
|
|
check_impl!(Str, Trt);
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
check_impl!(Str, Trt);
|
|
|
|
check_impl!(Str, Trt);
|
|
|
|
}
|