about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-09-03 23:30:36 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-09-03 23:30:36 +0530
commit2a40e46f18206e30e8528a5a2adcef71a615aba4 (patch)
treefb72a3819bbb31448ad0e89da21bd251297a5429
parent0762f58c1143b4ff0ae5d0cdda9cdd8249512e77 (diff)
parentc6b0fccac822abe319a1f10d67c1271702098475 (diff)
downloadrust-2a40e46f18206e30e8528a5a2adcef71a615aba4.tar.gz
rust-2a40e46f18206e30e8528a5a2adcef71a615aba4.zip
Rollup merge of #28164 - AlisdairO:diagnostics329, r=Manishearth
As title :-)
Part of #24407.

r? @Manishearth
-rw-r--r--src/librustc_typeck/diagnostics.rs32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/librustc_typeck/diagnostics.rs b/src/librustc_typeck/diagnostics.rs
index e356f612cde..826524a415f 100644
--- a/src/librustc_typeck/diagnostics.rs
+++ b/src/librustc_typeck/diagnostics.rs
@@ -2705,6 +2705,37 @@ fn main() {
 ```
 "##,
 
+E0329: r##"
+An attempt was made to access an associated constant through either a generic
+type parameter or `Self`. This is not supported yet. An example causing this
+error is shown below:
+
+```
+trait Foo {
+    const BAR: f64;
+}
+
+struct MyStruct;
+
+impl Foo for MyStruct {
+    const BAR: f64 = 0f64;
+}
+
+fn get_bar_bad<F: Foo>(t: F) -> f64 {
+    F::BAR
+}
+```
+
+Currently, the value of `BAR` for a particular type can only be accessed through
+a concrete type, as shown below:
+
+```
+fn get_bar_good() -> f64 {
+    <MyStruct as Foo>::BAR
+}
+```
+"##,
+
 E0366: r##"
 An attempt was made to implement `Drop` on a concrete specialization of a
 generic type. An example is shown below:
@@ -3251,7 +3282,6 @@ register_diagnostics! {
     E0320, // recursive overflow during dropck
     E0321, // extended coherence rules for defaulted traits violated
     E0328, // cannot implement Unsize explicitly
-    E0329, // associated const depends on type parameter or Self.
     E0374, // the trait `CoerceUnsized` may only be implemented for a coercion
            // between structures with one field being coerced, none found
     E0375, // the trait `CoerceUnsized` may only be implemented for a coercion