rust/tests/ui/rfcs/rfc-2632-const-trait-impl/const-drop-fail-2.rs
Urgau 0c3f5cce89 Further cleanup cfgs in the UI test suite
This commit does three things:
 1. replaces (the last remaining) never true cfgs by the FALSE cfg
 2. fix derive-helper-configured.rs (typo in directive)
 3. and comment some current unused #[cfg_attr] (missing revisions)
2024-04-09 23:58:18 +02:00

47 lines
927 B
Rust

//@ known-bug: #110395
#![feature(const_trait_impl)]
#![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 {}
const fn check<T: ~const Destruct>(_: T) {}
/* FIXME(effects)
struct ConstDropImplWithBounds<T: ~const A>(PhantomData<T>);
impl<T: ~const A> const Drop for ConstDropImplWithBounds<T> {
fn drop(&mut self) {
T::a();
}
}
const _: () = check::<ConstDropImplWithBounds<NonTrivialDrop>>(
ConstDropImplWithBounds(PhantomData)
);
*/
struct ConstDropImplWithNonConstBounds<T: A>(PhantomData<T>);
impl<T: ~const A> const Drop for ConstDropImplWithNonConstBounds<T> {
fn drop(&mut self) {
T::a();
}
}
fn main() {}