diff options
| author | Ryan Senior <ryan.senior@puppetlabs.com> | 2016-10-16 16:35:22 -0500 |
|---|---|---|
| committer | Ryan Senior <ryan.senior@puppetlabs.com> | 2016-10-21 07:23:40 -0500 |
| commit | 5402271ceb072f2271e4dc9715c31dcfb525c51f (patch) | |
| tree | 469b0bd553e45a56a0ac2cd335ba98b2cd0f7b68 | |
| parent | e0111758eb4f215db4ec26f809ef3edf5dfb66f5 (diff) | |
| download | rust-5402271ceb072f2271e4dc9715c31dcfb525c51f.tar.gz rust-5402271ceb072f2271e4dc9715c31dcfb525c51f.zip | |
Add an error explaination for E0182
| -rw-r--r-- | src/librustc_typeck/diagnostics.rs | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs index 0d6b43b59c6..946e9add2b7 100644 --- a/src/librustc_typeck/diagnostics.rs +++ b/src/librustc_typeck/diagnostics.rs @@ -1915,6 +1915,45 @@ More details can be found in [RFC 438]. [RFC 438]: https://github.com/rust-lang/rfcs/pull/438 "##, +E0182: r##" +You bound an associated type in an expression path which is not +allowed. + +Erroneous code example: + +```compile_fail,E0182 +trait Foo { + type A; + fn bar() -> isize; +} + +impl Foo for isize { + type A = usize; + fn bar() -> isize { 42 } +} + +// error: unexpected binding of associated item in expression path +let x: isize = Foo::<A=usize>::bar(); +``` + +To give a concrete type when using the Universal Function Call Syntax, +use "Type as Trait". Example: + +``` +trait Foo { + type A; + fn bar() -> isize; +} + +impl Foo for isize { + type A = usize; + fn bar() -> isize { 42 } +} + +let x: isize = <isize as Foo>::bar(); // ok! +``` +"##, + E0184: r##" Explicitly implementing both Drop and Copy for a type is currently disallowed. This feature can make some sense in theory, but the current implementation is @@ -4054,7 +4093,6 @@ register_diagnostics! { // E0168, // E0173, // manual implementations of unboxed closure traits are experimental // E0174, - E0182, E0183, // E0187, // can't infer the kind of the closure // E0188, // can not cast an immutable reference to a mutable pointer |
