Skip to content

Commit 2a40e46

Browse files
committed
Rollup merge of rust-lang#28164 - AlisdairO:diagnostics329, r=Manishearth
As title :-) Part of rust-lang#24407. r? @Manishearth
2 parents 0762f58 + c6b0fcc commit 2a40e46

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

src/librustc_typeck/diagnostics.rs

+31-1
Original file line numberDiff line numberDiff line change
@@ -2705,6 +2705,37 @@ fn main() {
27052705
```
27062706
"##,
27072707

2708+
E0329: r##"
2709+
An attempt was made to access an associated constant through either a generic
2710+
type parameter or `Self`. This is not supported yet. An example causing this
2711+
error is shown below:
2712+
2713+
```
2714+
trait Foo {
2715+
const BAR: f64;
2716+
}
2717+
2718+
struct MyStruct;
2719+
2720+
impl Foo for MyStruct {
2721+
const BAR: f64 = 0f64;
2722+
}
2723+
2724+
fn get_bar_bad<F: Foo>(t: F) -> f64 {
2725+
F::BAR
2726+
}
2727+
```
2728+
2729+
Currently, the value of `BAR` for a particular type can only be accessed through
2730+
a concrete type, as shown below:
2731+
2732+
```
2733+
fn get_bar_good() -> f64 {
2734+
<MyStruct as Foo>::BAR
2735+
}
2736+
```
2737+
"##,
2738+
27082739
E0366: r##"
27092740
An attempt was made to implement `Drop` on a concrete specialization of a
27102741
generic type. An example is shown below:
@@ -3251,7 +3282,6 @@ register_diagnostics! {
32513282
E0320, // recursive overflow during dropck
32523283
E0321, // extended coherence rules for defaulted traits violated
32533284
E0328, // cannot implement Unsize explicitly
3254-
E0329, // associated const depends on type parameter or Self.
32553285
E0374, // the trait `CoerceUnsized` may only be implemented for a coercion
32563286
// between structures with one field being coerced, none found
32573287
E0375, // the trait `CoerceUnsized` may only be implemented for a coercion

0 commit comments

Comments
 (0)