Skip to content

Commit 2f1b34c

Browse files
committed
Add backticks to main not found errors.
1 parent b08e6d3 commit 2f1b34c

11 files changed

+15
-15
lines changed

src/librustc/middle/entry.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ fn configure_main(this: &mut EntryContext, crate_name: &str) {
165165
} else {
166166
// No main function
167167
let mut err = struct_err!(this.session, E0601,
168-
"main function not found in crate {}", crate_name);
168+
"`main` function not found in crate `{}`", crate_name);
169169
if !this.non_main_fns.is_empty() {
170170
// There were some functions named 'main' though. Try to give the user a hint.
171171
err.note("the main function must be defined at the crate level \
@@ -179,7 +179,7 @@ fn configure_main(this: &mut EntryContext, crate_name: &str) {
179179
this.session.abort_if_errors();
180180
} else {
181181
if let Some(ref filename) = this.session.local_crate_source_file {
182-
err.note(&format!("consider adding a main function to {}", filename.display()));
182+
err.note(&format!("consider adding a `main` function to `{}`", filename.display()));
183183
}
184184
if this.session.teach(&err.get_code().unwrap()) {
185185
err.note("If you don't know the basics of Rust, you can go look to the Rust Book \

src/test/compile-fail/cfg-attr-cfg-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010
//
11-
// error-pattern: main function not found
11+
// error-pattern: `main` function not found
1212
// compile-flags: --cfg foo
1313

1414
// main is conditionally compiled, but the conditional compilation

src/test/compile-fail/cfg-in-crate-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:main function not found
11+
// error-pattern: `main` function not found
1212

1313
#![cfg(bar)]

src/test/compile-fail/elided-test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: main function not found
11+
// error-pattern: `main` function not found
1212

1313
// Since we're not compiling a test runner this function should be elided
1414
// and the build will fail because main doesn't exist

src/test/compile-fail/missing-main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern:main function not found
11+
// error-pattern: `main` function not found
1212
fn mian() { }

src/test/ui/error-codes/E0601.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
error[E0601]: main function not found in crate E0601
1+
error[E0601]: `main` function not found in crate `E0601`
22
|
3-
= note: consider adding a main function to $DIR/E0601.rs
3+
= note: consider adding a `main` function to `$DIR/E0601.rs`
44

55
error: aborting due to previous error
66

src/test/ui/feature-gate/issue-43106-gating-of-bench.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: main function not found
11+
// error-pattern: `main` function not found
1212

1313
// At time of authorship, a crate-level #![bench] with no `--test`
1414
// will cause compilation to error unconditionally with "main function

src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
error[E0601]: main function not found in crate issue_43106_gating_of_bench
1+
error[E0601]: `main` function not found in crate `issue_43106_gating_of_bench`
22
|
3-
= note: consider adding a main function to $DIR/issue-43106-gating-of-bench.rs
3+
= note: consider adding a `main` function to `$DIR/issue-43106-gating-of-bench.rs`
44

55
error: aborting due to previous error
66

src/test/ui/feature-gate/issue-43106-gating-of-test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// error-pattern: main function not found
11+
// error-pattern: `main` function not found
1212

1313
// At time of authorship, crate-level #[test] attribute with no
1414
// `--test` signals unconditional error complaining of missing main

src/test/ui/feature-gate/issue-43106-gating-of-test.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
error[E0601]: main function not found in crate issue_43106_gating_of_test
1+
error[E0601]: `main` function not found in crate `issue_43106_gating_of_test`
22
|
3-
= note: consider adding a main function to $DIR/issue-43106-gating-of-test.rs
3+
= note: consider adding a `main` function to `$DIR/issue-43106-gating-of-test.rs`
44

55
error: aborting due to previous error
66

src/test/ui/main-wrong-location.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0601]: main function not found in crate main_wrong_location
1+
error[E0601]: `main` function not found in crate `main_wrong_location`
22
|
33
= 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.
44
note: here is a function named 'main'

0 commit comments

Comments
 (0)