diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-03-25 01:42:40 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2016-03-25 19:29:07 +0100 |
| commit | 311ee0157add2bae24671336fc9da58a3fa798ea (patch) | |
| tree | 2a5e52591a5658511e49e385ef050d54ae692038 /src | |
| parent | dcfb8d72e99425686376298fd793715f35b5d512 (diff) | |
| download | rust-311ee0157add2bae24671336fc9da58a3fa798ea.tar.gz rust-311ee0157add2bae24671336fc9da58a3fa798ea.zip | |
Add an example for E0034
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 300868721e3..bef6c1ed43a 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -327,6 +327,30 @@ fn main() { <Test as Trait1>::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##" |
