rust/tests/ui/rfcs/rfc-2632-const-trait-impl/const-trait-bounds-trait-objects.rs
2024-06-22 14:11:11 +00:00

18 lines
563 B
Rust

#![feature(const_trait_impl, effects)] //~ WARN the feature `effects` is incomplete
//@ edition: 2021
#[const_trait]
trait Trait {}
fn main() {
let _: &dyn const Trait; //~ ERROR const trait bounds are not allowed in trait object types
let _: &dyn ~const Trait; //~ ERROR `~const` is not allowed here
}
// Regression test for issue #119525.
trait NonConst {}
const fn handle(_: &dyn const NonConst) {}
//~^ ERROR const trait bounds are not allowed in trait object types
const fn take(_: &dyn ~const NonConst) {}
//~^ ERROR `~const` is not allowed here