]> git.proxmox.com Git - rustc.git/blob - src/test/ui/where-clauses/where-clauses-method.rs
New upstream version 1.66.0+dfsg1
[rustc.git] / src / test / 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 }