Skip to content

Commit

Permalink
Rollup merge of rust-lang#57459 - varkor:E0202-issue-reference, r=pet…
Browse files Browse the repository at this point in the history
…rochenkov

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.)
  • Loading branch information
Centril authored Jan 12, 2019
2 parents 0b1427e + ac4a454 commit f7da074
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/librustc_passes/ast_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/collect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
);
}

Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/assoc-inherent.rs
Original file line number Diff line number Diff line change
@@ -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() {}
4 changes: 2 additions & 2 deletions src/test/ui/assoc-inherent.stderr
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/where-clauses/where-equality-constraints.stderr
Original file line number Diff line number Diff line change
@@ -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, {}
Expand Down

0 comments on commit f7da074

Please sign in to comment.