diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 6228598ab61..a5ef4038885 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -5360,8 +5360,15 @@ impl<'a> Parser<'a> { // Parse type argument. let ty_param = self.parse_ty()?; if seen_binding { - self.span_err(ty_param.span, - "type parameters must be declared prior to associated type bindings"); + self.struct_span_err( + ty_param.span, + "type parameters must be declared prior to associated type bindings" + ) + .span_label( + ty_param.span, + "must be declared prior to associated type bindings", + ) + .emit(); } args.push(GenericArg::Type(ty_param)); seen_type = true; diff --git a/src/test/ui/parser/issue-32214.stderr b/src/test/ui/parser/issue-32214.stderr index a01517d016d..a889513eaee 100644 --- a/src/test/ui/parser/issue-32214.stderr +++ b/src/test/ui/parser/issue-32214.stderr @@ -2,7 +2,7 @@ error: type parameters must be declared prior to associated type bindings --> $DIR/issue-32214.rs:5:34 | LL | pub fn test >() {} - | ^ + | ^ must be declared prior to associated type bindings error: aborting due to previous error