From 311ee0157add2bae24671336fc9da58a3fa798ea Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 25 Mar 2016 01:42:40 +0100 Subject: [PATCH] Add an example for E0034 --- src/librustc_typeck/diagnostics.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 300868721e3ab..bef6c1ed43aa6 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -327,6 +327,30 @@ fn main() { ::foo() } ``` + +One last example: + +``` +trait F { + fn m(&self); +} + +trait G { + fn m(&self); +} + +struct X; + +impl F for X { fn m(&self) { println!("I am F"); } } +impl G for X { fn m(&self) { println!("I am G"); } } + +fn main() { + let f = X; + + F::m(&f); // it displays "I am F" + G::m(&f); // it displays "I am G" +} +``` "##, E0035: r##"