1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Check testing of equality constraints in a higher-ranked context.
13 pub trait TheTrait<T> {
16 fn get(&self, t: T) -> Self::A;
23 impl<'a> TheTrait<&'a isize> for IntStruct {
26 fn get(&self, t: &'a isize) -> &'a isize {
35 impl<'a> TheTrait<&'a isize> for UintStruct {
38 fn get(&self, t: &'a isize) -> &'a uint {
44 where T : for<'x> TheTrait<&'x isize, A = &'x isize>
46 // ok for IntStruct, but not UintStruct
50 where T : for<'x> TheTrait<&'x isize, A = &'x uint>
52 // ok for UintStruct, but not IntStruct
56 where T : for<'x,'y> TheTrait<&'x isize, A = &'y isize>
58 // not ok for either struct, due to the use of two lifetimes
63 foo::<UintStruct>(); //~ ERROR type mismatch
65 bar::<IntStruct>(); //~ ERROR type mismatch
68 baz::<IntStruct>(); //~ ERROR type mismatch
69 baz::<UintStruct>(); //~ ERROR type mismatch