mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Rollup merge of #35319 - Keats:err-137, r=jonathandturner
Update error format for E0137 Fixes #35265 as part of #35233. r? @jonathandturner
This commit is contained in:
commit
a7b443fd85
@ -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 => {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user