]> git.lizzy.rs Git - rust.git/blob - tests/ui/higher-rank-trait-bounds/hrtb-conflate-regions.rs
Rollup merge of #106805 - madsravn:master, r=compiler-errors
[rust.git] / tests / ui / higher-rank-trait-bounds / hrtb-conflate-regions.rs
1 // Test that an impl with only one bound region `'a` cannot be used to
2 // satisfy a constraint where there are two bound regions.
3
4 trait Foo<X> {
5     fn foo(&self, x: X) { }
6 }
7
8 fn want_foo2<T>()
9     where T : for<'a,'b> Foo<(&'a isize, &'b isize)>
10 {
11 }
12
13 fn want_foo1<T>()
14     where T : for<'z> Foo<(&'z isize, &'z isize)>
15 {
16 }
17
18 // Expressed as a where clause
19
20 struct SomeStruct;
21
22 impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct
23 {
24 }
25
26 fn a() { want_foo1::<SomeStruct>(); } // OK -- foo wants just one region
27 fn b() { want_foo2::<SomeStruct>(); }
28 //~^ ERROR implementation of
29 //~| ERROR implementation of
30
31 fn main() { }