diff options
| author | Vincent Prouillet <vincent@wearewizards.io> | 2016-08-04 20:27:11 +0100 |
|---|---|---|
| committer | Vincent Prouillet <vincent@wearewizards.io> | 2016-08-04 20:27:11 +0100 |
| commit | df726a45e18a9e760931f867b995f642131180ad (patch) | |
| tree | 9c13806f706619b47eee6a1fae821951d01573be | |
| parent | 271d048523b6c1b0e773d9e5cc76bbb997cc180c (diff) | |
| download | rust-df726a45e18a9e760931f867b995f642131180ad.tar.gz rust-df726a45e18a9e760931f867b995f642131180ad.zip | |
Update error format for E0137
| -rw-r--r-- | src/librustc/middle/entry.rs | 7 | ||||
| -rw-r--r-- | src/test/compile-fail/E0137.rs | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index 23a261400ed..0a363fddd53 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -121,8 +121,11 @@ fn find_item(item: &Item, ctxt: &mut EntryContext, at_root: bool) { if ctxt.attr_main_fn.is_none() { ctxt.attr_main_fn = Some((item.id, item.span)); } else { - span_err!(ctxt.session, item.span, E0137, - "multiple functions with a #[main] attribute"); + struct_span_err!(ctxt.session, item.span, E0137, + "multiple functions with a #[main] attribute") + .span_label(item.span, &format!("additional #[main] function")) + .span_label(ctxt.attr_main_fn.unwrap().1, &format!("first #[main] function")) + .emit(); } }, EntryPointType::Start => { diff --git a/src/test/compile-fail/E0137.rs b/src/test/compile-fail/E0137.rs index 695ce7995a9..f45afc9f37b 100644 --- a/src/test/compile-fail/E0137.rs +++ b/src/test/compile-fail/E0137.rs @@ -11,7 +11,9 @@ #![feature(main)] #[main] -fn foo() {} +fn foo() {} //~ NOTE first #[main] function #[main] -fn f() {} //~ ERROR E0137 +fn f() {} +//~^ ERROR E0137 +//~| NOTE additional #[main] function |
