blob: 0e8bb61a79b6ba96c91a2e8f76ff39b03db25f2b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
fn require_copy<T: Copy>(x: T) {}
struct Foo<T> { x: T }
// Ensure constraints are only attached to methods locally
impl<T> Foo<T> {
fn needs_copy(self) where T: Copy {
require_copy(self.x);
}
fn fails_copy(self) {
require_copy(self.x);
//~^ ERROR the trait bound `T: Copy` is not satisfied
}
}
fn main() {}
|