]> git.lizzy.rs Git - rust.git/blob - tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs
Merge commit '7f27e2e74ef957baa382dc05cf08df6368165c74' into clippyup
[rust.git] / tests / ui / where-clauses / where-clause-constraints-are-local-for-inherent-impl.rs
1 fn require_copy<T: Copy>(x: T) {}
2
3 struct Foo<T> { x: T }
4
5 // Ensure constraints are only attached to methods locally
6 impl<T> Foo<T> {
7     fn needs_copy(self) where T: Copy {
8         require_copy(self.x);
9
10     }
11
12     fn fails_copy(self) {
13         require_copy(self.x);
14         //~^ ERROR the trait bound `T: Copy` is not satisfied
15     }
16 }
17
18 fn main() {}