Skip to content

Commit d16804a

Browse files
committed
Update E0138 to new format
1 parent 561c4e1 commit d16804a

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/librustc/middle/entry.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,12 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) {
132132
if ctxt.start_fn.is_none() {
133133
ctxt.start_fn = Some((item.id, item.span));
134134
} else {
135-
span_err!(ctxt.session, item.span, E0138,
136-
"multiple 'start' functions");
135+
struct_span_err!(
136+
ctxt.session, item.span, E0138,
137+
"multiple 'start' functions")
138+
.span_label(ctxt.start_fn.unwrap().1, &format!("previous `start` function here"))
139+
.span_label(item.span, &format!("multiple `start` functions"))
140+
.emit();
137141
}
138142
},
139143
EntryPointType::None => ()

src/test/compile-fail/E0138.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#[start]
1414
fn foo(argc: isize, argv: *const *const u8) -> isize {}
15+
//~^ NOTE previous `start` function here
1516

1617
#[start]
17-
fn f(argc: isize, argv: *const *const u8) -> isize {} //~ ERROR E0138
18+
fn f(argc: isize, argv: *const *const u8) -> isize {}
19+
//~^ ERROR E0138
20+
//~| NOTE multiple `start` functions

0 commit comments

Comments
 (0)