diff options
Diffstat (limited to 'src/test/ui/autoref-autoderef/auto-ref-bounded-ty-param.rs')
-rw-r--r-- | src/test/ui/autoref-autoderef/auto-ref-bounded-ty-param.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test/ui/autoref-autoderef/auto-ref-bounded-ty-param.rs b/src/test/ui/autoref-autoderef/auto-ref-bounded-ty-param.rs new file mode 100644 index 000000000..2482e1878 --- /dev/null +++ b/src/test/ui/autoref-autoderef/auto-ref-bounded-ty-param.rs @@ -0,0 +1,29 @@ +// run-pass +trait Foo { + fn f(&self); +} + +struct Bar { + x: isize +} + +trait Baz { + fn g(&self); +} + +impl<T:Baz> Foo for T { + fn f(&self) { + self.g(); + } +} + +impl Baz for Bar { + fn g(&self) { + println!("{}", self.x); + } +} + +pub fn main() { + let y = Bar { x: 42 }; + y.f(); +} |