Files
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.

28 lines
457 B
Rust
Raw Normal View History

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