blob: b74716f00617f9cabd70baaf577cf72bf4ba2717 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
//@[new_precise] compile-flags: -Znext-solver
//@[new_stock] compile-flags: -Znext-solver
//@ revisions: new_stock old_stock new_precise old_precise
//@ ignore-backends: gcc
#![feature(const_trait_impl, const_destruct)]
#![cfg_attr(any(new_precise, old_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");
}
}
struct ConstImplWithDropGlue(NonTrivialDrop);
impl const Drop for ConstImplWithDropGlue {
fn drop(&mut self) {}
}
const fn check<T: [const] Destruct>(_: T) {}
macro_rules! check_all {
($($exp:expr),*$(,)?) => {$(
const _: () = check($exp);
)*};
}
check_all! {
NonTrivialDrop,
//~^ ERROR the trait bound `NonTrivialDrop: const Destruct` is not satisfied
ConstImplWithDropGlue(NonTrivialDrop),
//~^ ERROR the trait bound `NonTrivialDrop: const Destruct` is not satisfied
}
fn main() {}
|