]> git.lizzy.rs Git - rust.git/blob - tests/ui/where-clauses/where-clauses-method.rs
Rollup merge of #105784 - yanns:update_stdarch, r=Amanieu
[rust.git] / tests / ui / where-clauses / where-clauses-method.rs
1 // run-pass
2 // Test that a where clause attached to a method allows us to add
3 // additional constraints to a parameter out of scope.
4
5 struct Foo<T> {
6     value: T
7 }
8
9 impl<T> Foo<T> {
10     fn equals(&self, u: &Foo<T>) -> bool where T : Eq {
11         self.value == u.value
12     }
13 }
14
15 fn main() {
16     let x = Foo { value: 1 };
17     let y = Foo { value: 2 };
18     println!("{}", x.equals(&x));
19     println!("{}", x.equals(&y));
20 }