this.session.entry_type.set(Some(config::EntryMain));
} else {
// No main function
- this.session.err("main function not found");
+ let mut err = this.session.struct_err("main function not found");
if !this.non_main_fns.is_empty() {
// There were some functions named 'main' though. Try to give the user a hint.
- this.session.note("the main function must be defined at the crate level \
- but you have one or more functions named 'main' that are not \
- defined at the crate level. Either move the definition or \
- attach the `#[main]` attribute to override this behavior.");
+ err.note("the main function must be defined at the crate level \
+ but you have one or more functions named 'main' that are not \
+ defined at the crate level. Either move the definition or \
+ attach the `#[main]` attribute to override this behavior.");
for &(_, span) in &this.non_main_fns {
- this.session.span_note(span, "here is a function named 'main'");
+ err.span_note(span, "here is a function named 'main'");
}
+ err.emit();
this.session.abort_if_errors();
+ } else {
+ err.emit();
}
}
}