2021-08-22 07:46:15 -05:00
|
|
|
// Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile!
|
2018-10-30 15:38:50 -05:00
|
|
|
//
|
|
|
|
// In particular, we test this pattern in trait solving, where it is not connected
|
|
|
|
// to any part of the source code.
|
|
|
|
|
|
|
|
fn foo<'a>() -> fn(&'a u32) {
|
|
|
|
panic!()
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2018-11-19 09:47:34 -06:00
|
|
|
// Here, proving that `fn(&'a u32) <: for<'b> fn(&'b u32)`:
|
2018-10-30 15:38:50 -05:00
|
|
|
//
|
2018-11-19 09:47:34 -06:00
|
|
|
// - instantiates `'b` with a placeholder `!b`,
|
|
|
|
// - requires that `&!b u32 <: &'a u32` and hence that `!b: 'a`,
|
|
|
|
// - but we can never know this.
|
2018-10-30 15:38:50 -05:00
|
|
|
|
2018-11-19 09:26:04 -06:00
|
|
|
let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types
|
2018-10-30 15:38:50 -05:00
|
|
|
}
|