]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hrtb/hrtb-conflate-regions.rs
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / hrtb / 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 ///////////////////////////////////////////////////////////////////////////
19 // Expressed as a where clause
20
21 struct SomeStruct;
22
23 impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct
24 {
25 }
26
27 fn a() { want_foo1::<SomeStruct>(); } // OK -- foo wants just one region
28 fn b() { want_foo2::<SomeStruct>(); } //~ ERROR
29
30 fn main() { }