Skip to content

Commit f7da074

Browse files
authored
Rollup merge of rust-lang#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.)
2 parents 0b1427e + ac4a454 commit f7da074

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

src/librustc_passes/ast_validation.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,9 @@ impl<'a> Visitor<'a> for AstValidator<'a> {
438438
}
439439
for predicate in &generics.where_clause.predicates {
440440
if let WherePredicate::EqPredicate(ref predicate) = *predicate {
441-
self.err_handler().span_err(predicate.span, "equality constraints are not yet \
442-
supported in where clauses (#20041)");
441+
self.err_handler()
442+
.span_err(predicate.span, "equality constraints are not yet \
443+
supported in where clauses (see #20041)");
443444
}
444445
}
445446
visit::walk_generics(self, generics)

src/librustc_typeck/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1108,7 +1108,7 @@ fn report_assoc_ty_on_inherent_impl<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, span:
11081108
tcx.sess,
11091109
span,
11101110
E0202,
1111-
"associated types are not allowed in inherent impls"
1111+
"associated types are not yet supported in inherent impls (see #8995)"
11121112
);
11131113
}
11141114

src/test/ui/assoc-inherent.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Test associated types are forbidden in inherent impls.
1+
// Test associated types are, until #8995 is implemented, forbidden in inherent impls.
22

33
struct Foo;
44

55
impl Foo {
6-
type Bar = isize; //~ERROR associated types are not allowed in inherent impls
6+
type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995)
77
}
88

99
fn main() {}

src/test/ui/assoc-inherent.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
error[E0202]: associated types are not allowed in inherent impls
1+
error[E0202]: associated types are not yet supported in inherent impls (see #8995)
22
--> $DIR/assoc-inherent.rs:6:5
33
|
4-
LL | type Bar = isize; //~ERROR associated types are not allowed in inherent impls
4+
LL | type Bar = isize; //~ERROR associated types are not yet supported in inherent impls (see #8995)
55
| ^^^^^^^^^^^^^^^^^
66

77
error: aborting due to previous error

src/test/ui/where-clauses/where-equality-constraints.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: equality constraints are not yet supported in where clauses (#20041)
1+
error: equality constraints are not yet supported in where clauses (see #20041)
22
--> $DIR/where-equality-constraints.rs:1:14
33
|
44
LL | fn f() where u8 = u16 {}
55
| ^^^^^^^^
66

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

0 commit comments

Comments
 (0)