Skip to content

Commit 81ae8be

Browse files
committed
Auto merge of #30284 - GuillaumeGomez:patch-3, r=Manishearth
r? @Manishearth
2 parents 0b49cb1 + 1671af1 commit 81ae8be

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

src/librustc/diagnostics.rs

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,41 @@ enum Method { GET, POST }
989989
```
990990
"##,
991991

992+
E0229: r##"
993+
An associated type binding was done outside of the type parameter declaration
994+
and `where` clause. Erroneous code example:
995+
996+
```
997+
pub trait Foo {
998+
type A;
999+
fn boo(&self) -> <Self as Foo>::A;
1000+
}
1001+
1002+
struct Bar;
1003+
1004+
impl Foo for isize {
1005+
type A = usize;
1006+
fn boo(&self) -> usize { 42 }
1007+
}
1008+
1009+
fn baz<I>(x: &<I as Foo<A=Bar>>::A) {}
1010+
// error: associated type bindings are not allowed here
1011+
```
1012+
1013+
To solve this error, please move the type bindings in the type parameter
1014+
declaration:
1015+
1016+
```
1017+
fn baz<I: Foo<A=Bar>>(x: &<I as Foo>::A) {} // ok!
1018+
```
1019+
1020+
or in the `where` clause:
1021+
1022+
```
1023+
fn baz<I>(x: &<I as Foo>::A) where I: Foo<A=Bar> {}
1024+
```
1025+
"##,
1026+
9921027
E0261: r##"
9931028
When using a lifetime like `'a` in a type, it must be declared before being
9941029
used.
@@ -2241,7 +2276,6 @@ register_diagnostics! {
22412276
// E0006 // merged with E0005
22422277
// E0134,
22432278
// E0135,
2244-
E0229, // associated type bindings are not allowed here
22452279
E0278, // requirement is not satisfied
22462280
E0279, // requirement is not satisfied
22472281
E0280, // requirement is not satisfied

0 commit comments

Comments
 (0)