Skip to content

Commit cc9d1de

Browse files
author
Nick Hamann
committed
Add error explanation for E0202.
1 parent 50b802a commit cc9d1de

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/librustc_typeck/collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ fn convert_item(ccx: &CrateCtxt, it: &ast::Item) {
877877
if let ast::TypeImplItem(ref ty) = impl_item.node {
878878
if opt_trait_ref.is_none() {
879879
span_err!(tcx.sess, impl_item.span, E0202,
880-
"associated items are not allowed in inherent impls");
880+
"associated types are not allowed in inherent impls");
881881
}
882882

883883
as_refsociated_type(ccx, ImplContainer(local_def(it.id)),

src/librustc_typeck/diagnostics.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,14 @@ impl Foo {
573573
```
574574
"##,
575575

576+
E0202: r##"
577+
Inherent associated types were part of [RFC 195] but are not yet implemented.
578+
See [the tracking issue][iss8995] for the status of this implementation.
579+
580+
[RFC 195]: https://github.com/rust-lang/rfcs/pull/195
581+
[iss8995]: https://github.com/rust-lang/rust/issues/8995
582+
"##,
583+
576584
E0204: r##"
577585
An attempt to implement the `Copy` trait for a struct failed because one of the
578586
fields does not implement `Copy`. To fix this, you must implement `Copy` for the
@@ -881,7 +889,6 @@ register_diagnostics! {
881889
E0194,
882890
E0195, // lifetime parameters or bounds on method do not match the trait declaration
883891
E0196, // cannot determine a type for this closure
884-
E0202, // associated items are not allowed in inherent impls
885892
E0203, // type parameter has more than one relaxed default bound,
886893
// and only one is supported
887894
E0207, // type parameter is not constrained by the impl trait, self type, or predicate

src/test/compile-fail/assoc-inherent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
struct Foo;
1414

1515
impl Foo {
16-
type Bar = isize; //~ERROR associated items are not allowed in inherent impls
16+
type Bar = isize; //~ERROR associated types are not allowed in inherent impls
1717
}
1818

1919
fn main() {}

0 commit comments

Comments
 (0)