]> git.proxmox.com Git - rustc.git/blob - src/test/ui/where-clauses/where-clause-constraints-are-local-for-trait-impl.rs
New upstream version 1.48.0~beta.8+dfsg1
[rustc.git] / src / test / ui / where-clauses / where-clause-constraints-are-local-for-trait-impl.rs
1 fn require_copy<T: Copy>(x: T) {}
2
3 struct Bar<T> { x: T }
4
5 trait Foo<T> {
6 fn needs_copy(self) where T: Copy;
7 fn fails_copy(self);
8 }
9
10 // Ensure constraints are only attached to methods locally
11 impl<T> Foo<T> for Bar<T> {
12 fn needs_copy(self) where T: Copy {
13 require_copy(self.x);
14
15 }
16
17 fn fails_copy(self) {
18 require_copy(self.x);
19 //~^ ERROR the trait bound `T: Copy` is not satisfied
20 }
21 }
22
23 fn main() {}