2023-04-16 06:12:37 -05:00
|
|
|
// known-bug: #110395
|
2023-08-06 08:20:55 -05:00
|
|
|
#![feature(const_trait_impl)]
|
2023-03-24 04:17:51 -05:00
|
|
|
#![feature(const_mut_refs)]
|
|
|
|
#![cfg_attr(precise, feature(const_precise_live_drops))]
|
|
|
|
|
|
|
|
use std::marker::{Destruct, PhantomData};
|
|
|
|
|
|
|
|
struct NonTrivialDrop;
|
|
|
|
|
|
|
|
impl Drop for NonTrivialDrop {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
println!("Non trivial drop");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#[const_trait]
|
|
|
|
trait A { fn a() { } }
|
|
|
|
|
|
|
|
impl A for NonTrivialDrop {}
|
|
|
|
|
2023-08-06 08:20:55 -05:00
|
|
|
const fn check<T: ~const Destruct>(_: T) {}
|
|
|
|
|
|
|
|
|
|
|
|
/* FIXME(effects)
|
2023-03-24 04:17:51 -05:00
|
|
|
struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
|
|
|
|
|
|
|
|
impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
T::a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-28 03:40:37 -05:00
|
|
|
const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
|
|
|
|
ConstDropImplWithBounds(PhantomData)
|
|
|
|
);
|
2023-08-06 08:20:55 -05:00
|
|
|
*/
|
2023-03-24 04:17:51 -05:00
|
|
|
|
|
|
|
struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
|
|
|
|
|
|
|
|
impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
T::a();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|