Skip to content

Commit

Permalink
Add backticks to main not found errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Mar 14, 2018
1 parent b08e6d3 commit 2f1b34c
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/librustc/middle/entry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn configure_main(this: &mut EntryContext, crate_name: &str) {
} else {
// No main function
let mut err = struct_err!(this.session, E0601,
"main function not found in crate {}", crate_name);
"`main` function not found in crate `{}`", crate_name);
if !this.non_main_fns.is_empty() {
// There were some functions named 'main' though. Try to give the user a hint.
err.note("the main function must be defined at the crate level \
Expand All @@ -179,7 +179,7 @@ fn configure_main(this: &mut EntryContext, crate_name: &str) {
this.session.abort_if_errors();
} else {
if let Some(ref filename) = this.session.local_crate_source_file {
err.note(&format!("consider adding a main function to {}", filename.display()));
err.note(&format!("consider adding a `main` function to `{}`", filename.display()));
}
if this.session.teach(&err.get_code().unwrap()) {
err.note("If you don't know the basics of Rust, you can go look to the Rust Book \
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/cfg-attr-cfg-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
//
// error-pattern: main function not found
// error-pattern: `main` function not found
// compile-flags: --cfg foo

// main is conditionally compiled, but the conditional compilation
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/cfg-in-crate-1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:main function not found
// error-pattern: `main` function not found

#![cfg(bar)]
2 changes: 1 addition & 1 deletion src/test/compile-fail/elided-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern: main function not found
// error-pattern: `main` function not found

// Since we're not compiling a test runner this function should be elided
// and the build will fail because main doesn't exist
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/missing-main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern:main function not found
// error-pattern: `main` function not found
fn mian() { }
4 changes: 2 additions & 2 deletions src/test/ui/error-codes/E0601.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error[E0601]: main function not found in crate E0601
error[E0601]: `main` function not found in crate `E0601`
|
= note: consider adding a main function to $DIR/E0601.rs
= note: consider adding a `main` function to `$DIR/E0601.rs`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate/issue-43106-gating-of-bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern: main function not found
// error-pattern: `main` function not found

// At time of authorship, a crate-level #![bench] with no `--test`
// will cause compilation to error unconditionally with "main function
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error[E0601]: main function not found in crate issue_43106_gating_of_bench
error[E0601]: `main` function not found in crate `issue_43106_gating_of_bench`
|
= note: consider adding a main function to $DIR/issue-43106-gating-of-bench.rs
= note: consider adding a `main` function to `$DIR/issue-43106-gating-of-bench.rs`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/feature-gate/issue-43106-gating-of-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// error-pattern: main function not found
// error-pattern: `main` function not found

// At time of authorship, crate-level #[test] attribute with no
// `--test` signals unconditional error complaining of missing main
Expand Down
4 changes: 2 additions & 2 deletions src/test/ui/feature-gate/issue-43106-gating-of-test.stderr
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error[E0601]: main function not found in crate issue_43106_gating_of_test
error[E0601]: `main` function not found in crate `issue_43106_gating_of_test`
|
= note: consider adding a main function to $DIR/issue-43106-gating-of-test.rs
= note: consider adding a `main` function to `$DIR/issue-43106-gating-of-test.rs`

error: aborting due to previous error

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/main-wrong-location.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0601]: main function not found in crate main_wrong_location
error[E0601]: `main` function not found in crate `main_wrong_location`
|
= 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.
note: here is a function named 'main'
Expand Down

0 comments on commit 2f1b34c

Please sign in to comment.