diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs index 001dd430a..d36c7f81c 100644 --- a/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs +++ b/src/test/ui/rfc-2632-const-trait-impl/const-drop-fail.rs @@ -19,11 +19,12 @@ impl const Drop for ConstImplWithDropGlue { fn drop(&mut self) {} } -trait A { fn a() { println!("A"); } } +#[const_trait] +trait A { fn a() { } } impl A for NonTrivialDrop {} -struct ConstDropImplWithBounds<T: A>(PhantomData<T>); +struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>); impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> { fn drop(&mut self) { @@ -46,6 +47,16 @@ check_all! { //~^ ERROR can't drop ConstDropImplWithBounds::<NonTrivialDrop>(PhantomData), //~^ ERROR the trait bound + //~| ERROR the trait bound +} + +struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>); + +impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> { +//~^ ERROR `Drop` impl requires `T: ~const A` but the struct it is implemented for does not + fn drop(&mut self) { + T::a(); + } } fn main() {} |