1 // revisions: stock precise
2 #![feature(const_trait_impl)]
3 #![feature(const_mut_refs)]
4 #![feature(const_fn_trait_bound)]
5 #![cfg_attr(precise, feature(const_precise_live_drops))]
7 use std::marker::PhantomData;
11 impl Drop for NonTrivialDrop {
13 println!("Non trivial drop");
17 struct ConstImplWithDropGlue(NonTrivialDrop);
19 impl const Drop for ConstImplWithDropGlue {
23 trait A { fn a() { println!("A"); } }
25 impl A for NonTrivialDrop {}
27 struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
28 //~^ ERROR `~const` is not allowed
30 impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
36 const fn check<T: ~const Drop>(_: T) {}
38 macro_rules! check_all {
39 ($($exp:expr),*$(,)?) => {$(
40 const _: () = check($exp);
46 //~^ ERROR the trait bound
47 ConstImplWithDropGlue(NonTrivialDrop),
48 //~^ ERROR the trait bound
49 ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData),
50 //~^ ERROR the trait bound
51 //~| ERROR the trait bound