2014-12-15 10:40:11 -06:00
|
|
|
// Test that an impl with only one bound region `'a` cannot be used to
|
|
|
|
// satisfy a constraint where there are two bound regions.
|
2014-12-14 06:17:23 -06:00
|
|
|
|
|
|
|
trait Foo<X> {
|
|
|
|
fn foo(&self, x: X) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn want_foo2<T>()
|
2015-01-08 04:54:35 -06:00
|
|
|
where T : for<'a,'b> Foo<(&'a isize, &'b isize)>
|
2014-12-14 06:17:23 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn want_foo1<T>()
|
2015-01-08 04:54:35 -06:00
|
|
|
where T : for<'z> Foo<(&'z isize, &'z isize)>
|
2014-12-14 06:17:23 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// Expressed as a where clause
|
|
|
|
|
|
|
|
struct SomeStruct;
|
|
|
|
|
2015-01-08 04:54:35 -06:00
|
|
|
impl<'a> Foo<(&'a isize, &'a isize)> for SomeStruct
|
2014-12-14 06:17:23 -06:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
fn a() { want_foo1::<SomeStruct>(); } // OK -- foo wants just one region
|
2022-05-21 23:39:32 -05:00
|
|
|
fn b() { want_foo2::<SomeStruct>(); }
|
2022-04-01 12:13:25 -05:00
|
|
|
//~^ ERROR implementation of
|
|
|
|
//~| ERROR implementation of
|
2014-12-14 06:17:23 -06:00
|
|
|
|
|
|
|
fn main() { }
|