Rollup merge of #57459 - varkor:E0202-issue-reference, r=petrochenkov

Reference tracking issue for inherent associated types in diagnostic

This makes it clearer that associated types in inherent impls are an intended feature, like the diagnostic for equality constraints in where clauses. (This is more helpful, because the lack of associated types is a confusing omission and it lets users more easily track the state of the feature.)
This commit is contained in:
Mazdak Farrokhzad 2019-01-12 10:55:09 +01:00 committed by GitHub
commit f7da074d2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 9 deletions

View file

@ -438,8 +438,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
}
for predicate in &generics.where_clause.predicates {
if let WherePredicate::EqPredicate(ref predicate) = *predicate {
self.err_handler().span_err(predicate.span, "equality constraints are not yet \
supported in where clauses (#20041)");
self.err_handler()
.span_err(predicate.span, "equality constraints are not yet \
supported in where clauses (see #20041)");
}
}
visit::walk_generics(self, generics)

View file

@ -1108,7 +1108,7 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span:
tcx.sess,
span,
E0202,
"associated types are not allowed in inherent impls"
"associated types are not yet supported in inherent impls (see #8995)"
);
}

View file

@ -1,9 +1,9 @@
// Test associated types are forbidden in inherent impls.
// Test associated types are, until #8995 is implemented, forbidden in inherent impls.
struct Foo;
impl Foo {
type Bar = isize; //~ERROR associated types are not allowed in inherent impls
type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995)
}
fn main() {}

View file

@ -1,7 +1,7 @@
error[E0202]: associated types are not allowed in inherent impls
error[E0202]: associated types are not yet supported in inherent impls (see #8995)
--> $DIR/assoc-inherent.rs:6:5
|
LL | type Bar = isize; //~ERROR associated types are not allowed in inherent impls
LL | type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995)
| ^^^^^^^^^^^^^^^^^
error: aborting due to previous error

View file

@ -1,10 +1,10 @@
error: equality constraints are not yet supported in where clauses (#20041)
error: equality constraints are not yet supported in where clauses (see #20041)
--> $DIR/where-equality-constraints.rs:1:14
|
LL | fn f() where u8 = u16 {}
| ^^^^^^^^
error: equality constraints are not yet supported in where clauses (#20041)
error: equality constraints are not yet supported in where clauses (see #20041)
--> $DIR/where-equality-constraints.rs:3:14
|
LL | fn g() where for<'a> &'static (u8,) == u16, {}