Skip to content

Commit 4900585

Browse files
committed
Unify E0109, E0110 and E0111 errors
1 parent c745708 commit 4900585

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

src/librustc_typeck/astconv.rs

+13-16
Original file line numberDiff line numberDiff line change
@@ -1486,37 +1486,34 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx> + 'o {
14861486
segment.with_generic_args(|generic_args| {
14871487
let (mut err_for_lt, mut err_for_ty, mut err_for_ct) = (false, false, false);
14881488
for arg in &generic_args.args {
1489-
let (mut span_err, span, kind) = match arg {
1490-
// FIXME(varkor): unify E0109, E0110 and E0111.
1489+
let (span, kind) = match arg {
14911490
hir::GenericArg::Lifetime(lt) => {
14921491
if err_for_lt { continue }
14931492
err_for_lt = true;
14941493
has_err = true;
1495-
(struct_span_err!(self.tcx().sess, lt.span, E0110,
1496-
"lifetime arguments are not allowed on this entity"),
1497-
lt.span,
1498-
"lifetime")
1494+
(lt.span, "lifetime")
14991495
}
15001496
hir::GenericArg::Type(ty) => {
15011497
if err_for_ty { continue }
15021498
err_for_ty = true;
15031499
has_err = true;
1504-
(struct_span_err!(self.tcx().sess, ty.span, E0109,
1505-
"type arguments are not allowed on this entity"),
1506-
ty.span,
1507-
"type")
1500+
(ty.span, "type")
15081501
}
15091502
hir::GenericArg::Const(ct) => {
15101503
if err_for_ct { continue }
15111504
err_for_ct = true;
1512-
(struct_span_err!(self.tcx().sess, ct.span, E0111,
1513-
"const parameters are not allowed on this type"),
1514-
ct.span,
1515-
"const")
1505+
(ct.span, "const")
15161506
}
15171507
};
1518-
span_err.span_label(span, format!("{} argument not allowed", kind))
1519-
.emit();
1508+
let mut err = struct_span_err!(
1509+
self.tcx().sess,
1510+
span,
1511+
E0109,
1512+
"{} arguments are not allowed for this type",
1513+
kind,
1514+
);
1515+
err.span_label(span, format!("{} argument not allowed", kind));
1516+
err.emit();
15201517
if err_for_lt && err_for_ty && err_for_ct {
15211518
break;
15221519
}

0 commit comments

Comments
 (0)