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.

25 lines
436 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 {
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() {}