From e40df1c88f0c3630df70c040ea9b9afc8ce05c5c Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Sun, 7 Aug 2016 23:52:43 +0200 Subject: [PATCH] Fix E0132 error display --- src/librustc_typeck/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/librustc_typeck/lib.rs b/src/librustc_typeck/lib.rs index 6f0892cdcdf16..0fc23995a5ee3 100644 --- a/src/librustc_typeck/lib.rs +++ b/src/librustc_typeck/lib.rs @@ -261,9 +261,10 @@ fn check_start_fn_ty(ccx: &CrateCtxt, match it.node { hir::ItemFn(_,_,_,_,ref ps,_) if ps.is_parameterized() => { - struct_span_err!(tcx.sess, start_span, E0132, + let sp = if let Some(sp) = ps.span() { sp } else { start_span }; + struct_span_err!(tcx.sess, sp, E0132, "start function is not allowed to have type parameters") - .span_label(ps.span().unwrap(), + .span_label(sp, &format!("start function cannot have type parameters")) .emit(); return;