Skip to content

Commit 5e06da2

Browse files
author
Jakub Hlusička
committed
E0131 updated to new format
1 parent 444ff9f commit 5e06da2

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/librustc_typeck/lib.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,15 @@ fn check_main_fn_ty(ccx: &CrateCtxt,
211211
match tcx.map.find(main_id) {
212212
Some(hir_map::NodeItem(it)) => {
213213
match it.node {
214-
hir::ItemFn(_, _, _, _, ref ps, _)
215-
if ps.is_parameterized() => {
216-
span_err!(ccx.tcx.sess, main_span, E0131,
217-
"main function is not allowed to have type parameters");
218-
return;
214+
hir::ItemFn(_, _, _, _, ref generics, _) => {
215+
if let Some(gen_span) = generics.span() {
216+
struct_span_err!(ccx.tcx.sess, gen_span, E0131,
217+
"main function is not allowed to have type parameters")
218+
.span_label(gen_span,
219+
&format!("main cannot have type parameters"))
220+
.emit();
221+
return;
222+
}
219223
}
220224
_ => ()
221225
}

src/test/compile-fail/E0131.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
fn main<T>() { //~ ERROR E0131
11+
fn main<T>() {
12+
//~^ ERROR E0131
13+
//~| NOTE main cannot have type parameters
1214
}

0 commit comments

Comments
 (0)