]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hrtb/hrtb-exists-forall-fn.rs
Simplify attribute handling in `parse_bottom_expr`.
[rust.git] / src / test / ui / hrtb / hrtb-exists-forall-fn.rs
1 // Test an `exists<'a> { forall<'b> { 'a = 'b } }` pattern -- which should not compile!
2 //
3 // In particular, we test this pattern in trait solving, where it is not connected
4 // to any part of the source code.
5
6 fn foo<'a>() -> fn(&'a u32) {
7     panic!()
8 }
9
10 fn main() {
11     // Here, proving that `fn(&'a u32) <: for<'b> fn(&'b u32)`:
12     //
13     // - instantiates `'b` with a placeholder `!b`,
14     // - requires that `&!b u32 <: &'a u32` and hence that `!b: 'a`,
15     // - but we can never know this.
16
17     let _: for<'b> fn(&'b u32) = foo(); //~ ERROR mismatched types
18 }