rust/tests/ui/wf/closure-wf.rs

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

12 lines
296 B
Rust
Raw Normal View History

2024-04-15 19:13:31 -05:00
trait Bound {}
struct NeedsBound<T: Bound>(T);
// Checks that we enforce that closure args are WF.
fn constrain_inner<T, F: for<'a> FnOnce(&'a (), NeedsBound<T>)>(_: T, _: F) {}
fn main() {
constrain_inner(1u32, |&(), _| ());
//~^ ERROR the trait bound `u32: Bound` is not satisfied
}