rust/tests/ui/traits/const-traits/const-in-closure.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

26 lines
491 B
Rust
Raw Normal View History

2024-10-21 20:16:33 +00:00
//@ compile-flags: -Znext-solver
//@ check-pass
#![feature(const_trait_impl, effects)]
//~^ WARN the feature `effects` is incomplete
#[const_trait] trait Trait {
fn method();
}
const fn foo<T: Trait>() {
let _ = || {
// Make sure this doesn't enforce `T: ~const Trait`
T::method();
};
}
fn bar<T: const Trait>() {
let _ = || {
// Make sure unconditionally const bounds propagate from parent.
const { T::method(); };
};
}
fn main() {}