]>
Commit | Line | Data |
---|---|---|
f9f354fc XL |
1 | // run-pass |
2 | // compile-flags: -Z chalk | |
3 | ||
4 | trait Foo { } | |
5 | ||
6 | impl Foo for i32 { } | |
7 | ||
8 | struct S<T: Foo> { | |
9 | x: T, | |
10 | } | |
11 | ||
12 | fn only_foo<T: Foo>(_x: &T) { } | |
13 | ||
14 | impl<T> S<T> { | |
15 | // Test that we have the correct environment inside an inherent method. | |
16 | fn dummy_foo(&self) { | |
17 | only_foo(&self.x) | |
18 | } | |
19 | } | |
20 | ||
21 | fn main() { | |
22 | let s = S { | |
23 | x: 5, | |
24 | }; | |
25 | ||
26 | s.dummy_foo(); | |
27 | } |