rust/src/test/ui/parser/issue-2354.rs
Mark Rousskov b7f20d06ea Provide a span if main function is not present in crate
Unfortunately, the diagnotic machinery does not cope well with an empty
span which can happen if the crate is empty, in which case we merely set
a spanless note.
2019-09-14 11:27:45 -04:00

18 lines
542 B
Rust

fn foo() { //~ NOTE un-closed delimiter
//~^ ERROR `main` function not found
//~^^ NOTE main function must be defined
//~^^^ NOTE you have one or more functions
match Some(10) {
//~^ NOTE this delimiter might not be properly closed...
Some(y) => { panic!(); }
None => { panic!(); }
}
//~^ NOTE ...as it matches this but it has different indentation
fn bar() {
let mut i = 0;
while (i < 1000) {}
}
fn main() {} //~ NOTE here is a function named `main`
//~ ERROR this file contains an un-closed delimiter