rust/src/test/ui/consts/const-block-const-bound.rs

24 lines
490 B
Rust
Raw Normal View History

2022-01-14 05:39:29 -06:00
#![allow(unused)]
#![feature(const_fn_trait_bound, const_trait_impl, inline_const, negative_impls)]
2022-01-14 05:39:29 -06:00
const fn f<T: ~const Drop>(x: T) {}
struct UnconstDrop;
impl Drop for UnconstDrop {
fn drop(&mut self) {}
}
struct NonDrop;
impl !Drop for NonDrop {}
2022-01-14 05:39:29 -06:00
fn main() {
const {
f(UnconstDrop);
//~^ ERROR the trait bound `UnconstDrop: ~const Drop` is not satisfied
f(NonDrop);
//~^ ERROR the trait bound `NonDrop: ~const Drop` is not satisfied
2022-01-14 05:39:29 -06:00
}
}