]> git.lizzy.rs Git - rust.git/blob - tests/ui/where-clauses/where-clause-constraints-are-local-for-inherent-impl.rs
Auto merge of #106711 - albertlarsan68:use-ci-llvm-when-lld, r=jyn514
[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() {}