Update E0138 to new format

This commit is contained in:
Chiu-Hsiang Hsu 2016-08-11 00:38:12 +08:00
parent 561c4e1dd3
commit 92f7e85b30
2 changed files with 11 additions and 3 deletions

View file

@ -132,8 +132,13 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
if ctxt.start_fn.is_none() {
ctxt.start_fn = Some((item.id, item.span));
} else {
span_err!(ctxt.session, item.span, E0138,
"multiple 'start' functions");
struct_span_err!(
ctxt.session, item.span, E0138,
"multiple 'start' functions")
.span_label(ctxt.start_fn.unwrap().1,
&format!("previous `start` function here"))
.span_label(item.span, &format!("multiple `start` functions"))
.emit();
}
},
EntryPointType::None => ()

View file

@ -12,6 +12,9 @@
#[start]
fn foo(argc: isize, argv: *const *const u8) -> isize {}
//~^ NOTE previous `start` function here
#[start]
fn f(argc: isize, argv: *const *const u8) -> isize {} //~ ERROR E0138
fn f(argc: isize, argv: *const *const u8) -> isize {}
//~^ ERROR E0138
//~| NOTE multiple `start` functions