Skip to content

Commit 25c9097

Browse files
committed
Update E0393 to new error format
1 parent 86dde9b commit 25c9097

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

src/librustc_typeck/astconv.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -515,12 +515,13 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o {
515515
// defaults. This will lead to an ICE if we are not
516516
// careful!
517517
if default_needs_object_self(def) {
518-
span_err!(tcx.sess, span, E0393,
519-
"the type parameter `{}` must be explicitly specified \
520-
in an object type because its default value `{}` references \
521-
the type `Self`",
522-
def.name,
523-
default);
518+
struct_span_err!(tcx.sess, span, E0393,
519+
"the type parameter `{}` must be explicitly specified",
520+
def.name)
521+
.span_label(span, &format!("missing reference to `{}`", def.name))
522+
.note(&format!("because of the default `Self` reference, \
523+
type parameters must be specified on object types"))
524+
.emit();
524525
tcx.types.err
525526
} else {
526527
// This is a default type parameter.

src/test/compile-fail/E0393.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010

1111
trait A<T=Self> {}
1212

13-
fn together_we_will_rule_the_galaxy(son: &A) {} //~ ERROR E0393
13+
fn together_we_will_rule_the_galaxy(son: &A) {}
14+
//~^ ERROR E0393
15+
//~| NOTE missing reference to `T`
16+
//~| NOTE because of the default `Self` reference, type parameters must be specified on object types
1417

1518
fn main() {
1619
}

0 commit comments

Comments
 (0)