2014-12-14 06:17:23 -06:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
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
|
2016-03-29 12:12:31 -05:00
|
|
|
fn b() { want_foo2::<SomeStruct>(); } //~ ERROR E0277
|
2014-12-14 06:17:23 -06:00
|
|
|
|
|
|
|
fn main() { }
|