rust/tests/ui/regions/regions-fn-subtyping-2.rs

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

21 lines
584 B
Rust
Raw Normal View History

// run-pass
#![allow(dead_code)]
2012-06-01 00:41:01 +00:00
// Issue #2263.
// Here, `f` is a function that takes a pointer `x` and a function
// `g`, where `g` requires its argument `y` to be in the same region
// that `x` is in.
// pretty-expanded FIXME #23616
2019-05-28 18:47:21 +00:00
fn has_same_region(f: Box<dyn for<'a> FnMut(&'a isize, Box<dyn FnMut(&'a isize)>)>) {
2012-06-01 00:41:01 +00:00
// `f` should be the type that `wants_same_region` wants, but
// right now the compiler complains that it isn't.
wants_same_region(f);
}
2019-05-28 18:47:21 +00:00
fn wants_same_region(_f: Box<dyn for<'b> FnMut(&'b isize, Box<dyn FnMut(&'b isize)>)>) {
2012-06-01 00:41:01 +00:00
}
pub fn main() {
2012-06-01 00:41:01 +00:00
}