From b4b7ccbd1ce1d794f4f9718ec0182b15591b73fa Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 3 Mar 2018 12:26:18 -0800 Subject: Add crate name to "main function not found" error message. Fixes #44798 and rust-lang/cargo#4948. --- src/test/ui/error-codes/E0522.stderr | 2 +- src/test/ui/feature-gate-i128_type2.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-test.stderr | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr | 2 +- src/test/ui/generator/yield-in-const.stderr | 2 +- src/test/ui/generator/yield-in-static.stderr | 2 +- src/test/ui/imports/macro-paths.stderr | 2 +- src/test/ui/imports/macros.stderr | 2 +- src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr | 2 +- src/test/ui/issue-47706-trait.stderr | 2 +- src/test/ui/main-wrong-location.stderr | 2 +- src/test/ui/missing-items/m2.stderr | 2 +- src/test/ui/resolve/issue-14254.stderr | 2 +- src/test/ui/resolve/issue-21221-2.stderr | 2 +- src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr | 2 +- src/test/ui/span/issue-35987.stderr | 2 +- src/test/ui/token/issue-10636-2.stderr | 2 +- src/test/ui/token/issue-41155.stderr | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src/test') diff --git a/src/test/ui/error-codes/E0522.stderr b/src/test/ui/error-codes/E0522.stderr index 5a6331bca0b..31898312133 100644 --- a/src/test/ui/error-codes/E0522.stderr +++ b/src/test/ui/error-codes/E0522.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate E0522 error[E0522]: definition of an unknown language item: `cookie` --> $DIR/E0522.rs:13:1 diff --git a/src/test/ui/feature-gate-i128_type2.stderr b/src/test/ui/feature-gate-i128_type2.stderr index 2348e7fe2c5..89b17ddbf00 100644 --- a/src/test/ui/feature-gate-i128_type2.stderr +++ b/src/test/ui/feature-gate-i128_type2.stderr @@ -30,7 +30,7 @@ LL | let x: u128 = 0; //~ ERROR 128-bit type is unstable | = help: add #![feature(i128_type)] to the crate attributes to enable -error[E0601]: main function not found +error[E0601]: main function not found in crate feature_gate_i128_type2 error[E0658]: repr with 128-bit type is unstable (see issue #35118) --> $DIR/feature-gate-i128_type2.rs:30:1 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr index f9f1cce91f1..27bf9c99652 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_bench error: aborting due to previous error diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr index 36320be1dc8..68f3099ff7e 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_inline error[E0518]: attribute should be applied to function --> $DIR/issue-43106-gating-of-inline.rs:21:1 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr index d1d37720a55..f8c1d9204af 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr @@ -6,7 +6,7 @@ LL | #![macro_escape] | = help: consider an outer attribute, #[macro_use] mod ... -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_macro_escape error: aborting due to previous error diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr index c7654a3f258..de4ef084e4f 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr @@ -34,7 +34,7 @@ error: the `#[proc_macro_derive]` attribute may only be used on bare functions LL | #[proc_macro_derive = "2500"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_proc_macro_derive error: aborting due to 7 previous errors diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr index 5a1dd706ff3..af1e659d48c 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_rustc_deprecated error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:17:1 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr index bee9b8e9682..ebdaecc0878 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_stable error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:17:1 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr index f9f1cce91f1..0d35be76d92 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_test error: aborting due to previous error diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr index 970cc2f2a34..3da5f0cec92 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_43106_gating_of_unstable error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:17:1 diff --git a/src/test/ui/generator/yield-in-const.stderr b/src/test/ui/generator/yield-in-const.stderr index 41a20893f5c..f37a881a451 100644 --- a/src/test/ui/generator/yield-in-const.stderr +++ b/src/test/ui/generator/yield-in-const.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate yield_in_const error[E0627]: yield statement outside of generator literal --> $DIR/yield-in-const.rs:13:17 diff --git a/src/test/ui/generator/yield-in-static.stderr b/src/test/ui/generator/yield-in-static.stderr index 71ebc189035..0ade7a20cac 100644 --- a/src/test/ui/generator/yield-in-static.stderr +++ b/src/test/ui/generator/yield-in-static.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate yield_in_static error[E0627]: yield statement outside of generator literal --> $DIR/yield-in-static.rs:13:18 diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr index 1422fb0904d..bf33bfaaf1f 100644 --- a/src/test/ui/imports/macro-paths.stderr +++ b/src/test/ui/imports/macro-paths.stderr @@ -36,7 +36,7 @@ LL | | } | |_^ = note: macro-expanded items do not shadow when used in a macro invocation path -error[E0601]: main function not found +error[E0601]: main function not found in crate macro_paths error: aborting due to 3 previous errors diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr index d74020ecab2..c7a89df2a97 100644 --- a/src/test/ui/imports/macros.stderr +++ b/src/test/ui/imports/macros.stderr @@ -51,7 +51,7 @@ LL | use two_macros::m; | ^^^^^^^^^^^^^ = note: macro-expanded macro imports do not shadow -error[E0601]: main function not found +error[E0601]: main function not found in crate macros error: aborting due to 4 previous errors diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr index a3d05e72ed9..816a27086cc 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate mismatched_trait_impl_2 error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in generic type due to conflicting requirements --> $DIR/mismatched_trait_impl-2.rs:18:5 diff --git a/src/test/ui/issue-47706-trait.stderr b/src/test/ui/issue-47706-trait.stderr index 542ba501780..069ae9994a1 100644 --- a/src/test/ui/issue-47706-trait.stderr +++ b/src/test/ui/issue-47706-trait.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_47706_trait error[E0593]: function is expected to take a single 0-tuple as argument, but it takes 2 distinct arguments --> $DIR/issue-47706-trait.rs:13:20 diff --git a/src/test/ui/main-wrong-location.stderr b/src/test/ui/main-wrong-location.stderr index aad68de9ec7..c5affade5e2 100644 --- a/src/test/ui/main-wrong-location.stderr +++ b/src/test/ui/main-wrong-location.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +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' diff --git a/src/test/ui/missing-items/m2.stderr b/src/test/ui/missing-items/m2.stderr index 1e4b47b44fa..3b611518283 100644 --- a/src/test/ui/missing-items/m2.stderr +++ b/src/test/ui/missing-items/m2.stderr @@ -1,4 +1,4 @@ -error[E0601]: main function not found +error[E0601]: main function not found in crate m2 error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method` --> $DIR/m2.rs:19:1 diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr index 325e8850845..395ca412f35 100644 --- a/src/test/ui/resolve/issue-14254.stderr +++ b/src/test/ui/resolve/issue-14254.stderr @@ -142,7 +142,7 @@ error[E0425]: cannot find value `bah` in this scope LL | bah; | ^^^ help: try: `Self::bah` -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_14254 error: aborting due to 25 previous errors diff --git a/src/test/ui/resolve/issue-21221-2.stderr b/src/test/ui/resolve/issue-21221-2.stderr index 50781d43792..fdafb509268 100644 --- a/src/test/ui/resolve/issue-21221-2.stderr +++ b/src/test/ui/resolve/issue-21221-2.stderr @@ -8,7 +8,7 @@ help: possible candidate is found in another module, you can import it into scop LL | use foo::bar::T; | -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_21221_2 error: cannot continue compilation due to previous error diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index 263319f2ffa..e1a205e7b3e 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -72,7 +72,7 @@ LL | a::b() | | | did you mean `I`? -error[E0601]: main function not found +error[E0601]: main function not found in crate suggest_path_instead_of_mod_dot_item error: aborting due to 10 previous errors diff --git a/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr index d3267d0cc15..09d34f3d1af 100644 --- a/src/test/ui/span/issue-35987.stderr +++ b/src/test/ui/span/issue-35987.stderr @@ -8,7 +8,7 @@ help: possible better candidate is found in another module, you can import it in LL | use std::ops::Add; | -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_35987 error: cannot continue compilation due to previous error diff --git a/src/test/ui/token/issue-10636-2.stderr b/src/test/ui/token/issue-10636-2.stderr index 4b672f31d38..273cabb0474 100644 --- a/src/test/ui/token/issue-10636-2.stderr +++ b/src/test/ui/token/issue-10636-2.stderr @@ -22,7 +22,7 @@ error: expected expression, found `)` LL | } //~ ERROR: incorrect close delimiter | ^ expected expression -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_10636_2 error: aborting due to 4 previous errors diff --git a/src/test/ui/token/issue-41155.stderr b/src/test/ui/token/issue-41155.stderr index 00155cc2873..80a4d43116f 100644 --- a/src/test/ui/token/issue-41155.stderr +++ b/src/test/ui/token/issue-41155.stderr @@ -12,7 +12,7 @@ error[E0412]: cannot find type `S` in this scope LL | impl S { //~ ERROR cannot find type | ^ not found in this scope -error[E0601]: main function not found +error[E0601]: main function not found in crate issue_41155 error: aborting due to 3 previous errors -- cgit 1.4.1-3-g733a5 From 6aa4dcb9cf615ca4dd01b5f732d171103028c78b Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 12 Mar 2018 13:21:43 -0700 Subject: Add empty main() to tests where it is missing. --- src/test/ui/error-codes/E0522.rs | 2 ++ src/test/ui/error-codes/E0522.stderr | 7 ++----- src/test/ui/feature-gate-i128_type2.rs | 2 ++ src/test/ui/feature-gate-i128_type2.stderr | 7 ++----- src/test/ui/feature-gate/issue-43106-gating-of-inline.rs | 2 ++ src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr | 7 ++----- src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs | 4 ++++ src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr | 7 +------ .../ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs | 2 ++ .../ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr | 5 +---- src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs | 1 + .../ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr | 5 +---- src/test/ui/feature-gate/issue-43106-gating-of-stable.rs | 2 ++ src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr | 5 +---- src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs | 2 ++ src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr | 5 +---- src/test/ui/generator/yield-in-const.rs | 2 ++ src/test/ui/generator/yield-in-const.stderr | 7 ++----- src/test/ui/generator/yield-in-static.rs | 2 ++ src/test/ui/generator/yield-in-static.stderr | 7 ++----- src/test/ui/imports/macro-paths.rs | 2 ++ src/test/ui/imports/macro-paths.stderr | 7 ++----- src/test/ui/imports/macros.rs | 2 ++ src/test/ui/imports/macros.stderr | 7 ++----- src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs | 2 ++ src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr | 7 ++----- src/test/ui/issue-47706-trait.rs | 2 ++ src/test/ui/issue-47706-trait.stderr | 7 ++----- src/test/ui/missing-items/m2.rs | 2 ++ src/test/ui/missing-items/m2.stderr | 7 ++----- src/test/ui/resolve/issue-14254.rs | 2 ++ src/test/ui/resolve/issue-14254.stderr | 7 ++----- src/test/ui/resolve/issue-21221-2.rs | 2 ++ src/test/ui/resolve/issue-21221-2.stderr | 2 -- src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs | 2 ++ src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr | 7 ++----- src/test/ui/span/issue-35987.rs | 2 ++ src/test/ui/span/issue-35987.stderr | 2 -- src/test/ui/token/issue-10636-2.rs | 2 ++ src/test/ui/token/issue-10636-2.stderr | 5 +---- src/test/ui/token/issue-41155.rs | 2 ++ src/test/ui/token/issue-41155.stderr | 7 ++----- 42 files changed, 75 insertions(+), 95 deletions(-) (limited to 'src/test') diff --git a/src/test/ui/error-codes/E0522.rs b/src/test/ui/error-codes/E0522.rs index 3d437785346..c50cb759e05 100644 --- a/src/test/ui/error-codes/E0522.rs +++ b/src/test/ui/error-codes/E0522.rs @@ -15,3 +15,5 @@ fn cookie() -> ! { //~^^ ERROR definition of an unknown language item: `cookie` [E0522] loop {} } + +fn main() {} diff --git a/src/test/ui/error-codes/E0522.stderr b/src/test/ui/error-codes/E0522.stderr index 31898312133..9f3f8968d73 100644 --- a/src/test/ui/error-codes/E0522.stderr +++ b/src/test/ui/error-codes/E0522.stderr @@ -1,12 +1,9 @@ -error[E0601]: main function not found in crate E0522 - error[E0522]: definition of an unknown language item: `cookie` --> $DIR/E0522.rs:13:1 | LL | #[lang = "cookie"] | ^^^^^^^^^^^^^^^^^^ definition of unknown language item `cookie` -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0522, E0601. -For more information about an error, try `rustc --explain E0522`. +For more information about this error, try `rustc --explain E0522`. diff --git a/src/test/ui/feature-gate-i128_type2.rs b/src/test/ui/feature-gate-i128_type2.rs index d3bd810ceb2..8a7d316ed83 100644 --- a/src/test/ui/feature-gate-i128_type2.rs +++ b/src/test/ui/feature-gate-i128_type2.rs @@ -30,3 +30,5 @@ fn test3_2() { enum A { //~ ERROR 128-bit type is unstable A(u64) } + +fn main() {} diff --git a/src/test/ui/feature-gate-i128_type2.stderr b/src/test/ui/feature-gate-i128_type2.stderr index 89b17ddbf00..23d4d6c98d9 100644 --- a/src/test/ui/feature-gate-i128_type2.stderr +++ b/src/test/ui/feature-gate-i128_type2.stderr @@ -30,8 +30,6 @@ LL | let x: u128 = 0; //~ ERROR 128-bit type is unstable | = help: add #![feature(i128_type)] to the crate attributes to enable -error[E0601]: main function not found in crate feature_gate_i128_type2 - error[E0658]: repr with 128-bit type is unstable (see issue #35118) --> $DIR/feature-gate-i128_type2.rs:30:1 | @@ -42,7 +40,6 @@ LL | | } | = help: add #![feature(repr128)] to the crate attributes to enable -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors -Some errors occurred: E0601, E0658. -For more information about an error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs index 24e77bf60a8..410f960e655 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.rs @@ -35,3 +35,5 @@ mod inline { #[inline = "2100"] impl S { } //~^ ERROR attribute should be applied to function } + +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr index 68f3099ff7e..d67d78e31a9 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-inline.stderr @@ -1,5 +1,3 @@ -error[E0601]: main function not found in crate issue_43106_gating_of_inline - error[E0518]: attribute should be applied to function --> $DIR/issue-43106-gating-of-inline.rs:21:1 | @@ -39,7 +37,6 @@ error[E0518]: attribute should be applied to function LL | #[inline = "2100"] impl S { } | ^^^^^^^^^^^^^^^^^^ ---------- not a function -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors -Some errors occurred: E0518, E0601. -For more information about an error, try `rustc --explain E0518`. +For more information about this error, try `rustc --explain E0518`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs index 3b2dbdefeba..ec3c97beab0 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.rs @@ -13,5 +13,9 @@ // `#![macro_escape]` is incompatible with crate-level `#![macro_use]` // already present in issue-43106-gating-of-builtin-attrs. +// must-compile-successfully + #![macro_escape] //~^ WARN macro_escape is a deprecated synonym for macro_use + +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr index f8c1d9204af..d19720397e6 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-macro_escape.stderr @@ -1,13 +1,8 @@ warning: macro_escape is a deprecated synonym for macro_use - --> $DIR/issue-43106-gating-of-macro_escape.rs:16:1 + --> $DIR/issue-43106-gating-of-macro_escape.rs:18:1 | LL | #![macro_escape] | ^^^^^^^^^^^^^^^^ | = help: consider an outer attribute, #[macro_use] mod ... -error[E0601]: main function not found in crate issue_43106_gating_of_macro_escape - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs index 133f70e0f3b..5bb8bb024ed 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.rs @@ -40,3 +40,5 @@ mod proc_macro_derive2 { #[proc_macro_derive = "2500"] impl S { } //~^ ERROR the `#[proc_macro_derive]` attribute may only be used on bare functions } + +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr index de4ef084e4f..419efb6825a 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-proc_macro_derive.stderr @@ -34,8 +34,5 @@ error: the `#[proc_macro_derive]` attribute may only be used on bare functions LL | #[proc_macro_derive = "2500"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0601]: main function not found in crate issue_43106_gating_of_proc_macro_derive +error: aborting due to 6 previous errors -error: aborting due to 7 previous errors - -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs index 10c13986349..0c6cfb5da56 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.rs @@ -36,3 +36,4 @@ mod rustc_deprecated { //~^ ERROR stability attributes may not be used outside of the standard library } +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr index af1e659d48c..35c15cb6b1e 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-rustc_deprecated.stderr @@ -1,5 +1,3 @@ -error[E0601]: main function not found in crate issue_43106_gating_of_rustc_deprecated - error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-rustc_deprecated.rs:17:1 | @@ -42,6 +40,5 @@ error: stability attributes may not be used outside of the standard library LL | #[rustc_deprecated = "1500"] impl S { } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs index a6eaabf7a38..6415243d087 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.rs @@ -35,3 +35,5 @@ mod stable { #[stable = "1300"] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } + +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr index ebdaecc0878..21543d1b20a 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-stable.stderr @@ -1,5 +1,3 @@ -error[E0601]: main function not found in crate issue_43106_gating_of_stable - error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-stable.rs:17:1 | @@ -42,6 +40,5 @@ error: stability attributes may not be used outside of the standard library LL | #[stable = "1300"] impl S { } | ^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs index ff0600deb19..140474d82c8 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.rs @@ -35,3 +35,5 @@ mod unstable { #[unstable = "1200"] impl S { } //~^ ERROR stability attributes may not be used outside of the standard library } + +fn main() {} diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr index 3da5f0cec92..6124e16f418 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-unstable.stderr @@ -1,5 +1,3 @@ -error[E0601]: main function not found in crate issue_43106_gating_of_unstable - error: stability attributes may not be used outside of the standard library --> $DIR/issue-43106-gating-of-unstable.rs:17:1 | @@ -42,6 +40,5 @@ error: stability attributes may not be used outside of the standard library LL | #[unstable = "1200"] impl S { } | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 8 previous errors +error: aborting due to 7 previous errors -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/generator/yield-in-const.rs b/src/test/ui/generator/yield-in-const.rs index e166d265159..8636a66ae00 100644 --- a/src/test/ui/generator/yield-in-const.rs +++ b/src/test/ui/generator/yield-in-const.rs @@ -12,3 +12,5 @@ const A: u8 = { yield 3u8; 3u8}; //~^ ERROR yield statement outside + +fn main() {} diff --git a/src/test/ui/generator/yield-in-const.stderr b/src/test/ui/generator/yield-in-const.stderr index f37a881a451..874edce5931 100644 --- a/src/test/ui/generator/yield-in-const.stderr +++ b/src/test/ui/generator/yield-in-const.stderr @@ -1,12 +1,9 @@ -error[E0601]: main function not found in crate yield_in_const - error[E0627]: yield statement outside of generator literal --> $DIR/yield-in-const.rs:13:17 | LL | const A: u8 = { yield 3u8; 3u8}; | ^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0601, E0627. -For more information about an error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0627`. diff --git a/src/test/ui/generator/yield-in-static.rs b/src/test/ui/generator/yield-in-static.rs index 823a2aa425e..21601f47f67 100644 --- a/src/test/ui/generator/yield-in-static.rs +++ b/src/test/ui/generator/yield-in-static.rs @@ -12,3 +12,5 @@ static B: u8 = { yield 3u8; 3u8}; //~^ ERROR yield statement outside + +fn main() {} diff --git a/src/test/ui/generator/yield-in-static.stderr b/src/test/ui/generator/yield-in-static.stderr index 0ade7a20cac..35d1ebaabdc 100644 --- a/src/test/ui/generator/yield-in-static.stderr +++ b/src/test/ui/generator/yield-in-static.stderr @@ -1,12 +1,9 @@ -error[E0601]: main function not found in crate yield_in_static - error[E0627]: yield statement outside of generator literal --> $DIR/yield-in-static.rs:13:18 | LL | static B: u8 = { yield 3u8; 3u8}; | ^^^^^^^^^ -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0601, E0627. -For more information about an error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0627`. diff --git a/src/test/ui/imports/macro-paths.rs b/src/test/ui/imports/macro-paths.rs index 88a6e1c0d92..e709eeee14a 100644 --- a/src/test/ui/imports/macro-paths.rs +++ b/src/test/ui/imports/macro-paths.rs @@ -36,3 +36,5 @@ fn g() { mod baz { pub use two_macros::m; } } } + +fn main() {} diff --git a/src/test/ui/imports/macro-paths.stderr b/src/test/ui/imports/macro-paths.stderr index bf33bfaaf1f..799e7f97246 100644 --- a/src/test/ui/imports/macro-paths.stderr +++ b/src/test/ui/imports/macro-paths.stderr @@ -36,9 +36,6 @@ LL | | } | |_^ = note: macro-expanded items do not shadow when used in a macro invocation path -error[E0601]: main function not found in crate macro_paths +error: aborting due to 2 previous errors -error: aborting due to 3 previous errors - -Some errors occurred: E0601, E0659. -For more information about an error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/imports/macros.rs b/src/test/ui/imports/macros.rs index 98577d73ee0..5d6a1191384 100644 --- a/src/test/ui/imports/macros.rs +++ b/src/test/ui/imports/macros.rs @@ -49,3 +49,5 @@ mod m4 { use two_macros::m; m!(); //~ ERROR ambiguous } + +fn main() {} diff --git a/src/test/ui/imports/macros.stderr b/src/test/ui/imports/macros.stderr index c7a89df2a97..f91987cd9f3 100644 --- a/src/test/ui/imports/macros.stderr +++ b/src/test/ui/imports/macros.stderr @@ -51,9 +51,6 @@ LL | use two_macros::m; | ^^^^^^^^^^^^^ = note: macro-expanded macro imports do not shadow -error[E0601]: main function not found in crate macros +error: aborting due to 3 previous errors -error: aborting due to 4 previous errors - -Some errors occurred: E0601, E0659. -For more information about an error, try `rustc --explain E0601`. +For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs index f845762cefd..ff04cfe99c0 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs @@ -20,3 +20,5 @@ impl Deref for Struct { } } //~^^^^ ERROR cannot infer an appropriate lifetime for lifetime parameter + +fn main() {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr index 816a27086cc..37b586e1e3b 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr @@ -1,5 +1,3 @@ -error[E0601]: main function not found in crate mismatched_trait_impl_2 - error[E0495]: cannot infer an appropriate lifetime for lifetime parameter in generic type due to conflicting requirements --> $DIR/mismatched_trait_impl-2.rs:18:5 | @@ -18,7 +16,6 @@ LL | | } expected fn(&Struct) -> &Trait + 'static found fn(&Struct) -> &Trait -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0495, E0601. -For more information about an error, try `rustc --explain E0495`. +For more information about this error, try `rustc --explain E0495`. diff --git a/src/test/ui/issue-47706-trait.rs b/src/test/ui/issue-47706-trait.rs index 86a9da49a05..4ce653547da 100644 --- a/src/test/ui/issue-47706-trait.rs +++ b/src/test/ui/issue-47706-trait.rs @@ -14,3 +14,5 @@ trait T { } //~^^ ERROR function is expected to take a single 0-tuple as argument } + +fn main() {} diff --git a/src/test/ui/issue-47706-trait.stderr b/src/test/ui/issue-47706-trait.stderr index 069ae9994a1..717b3eb0b56 100644 --- a/src/test/ui/issue-47706-trait.stderr +++ b/src/test/ui/issue-47706-trait.stderr @@ -1,5 +1,3 @@ -error[E0601]: main function not found in crate issue_47706_trait - error[E0593]: function is expected to take a single 0-tuple as argument, but it takes 2 distinct arguments --> $DIR/issue-47706-trait.rs:13:20 | @@ -8,7 +6,6 @@ LL | fn f(&self, _: ()) { LL | None::<()>.map(Self::f); | ^^^ expected function that takes a single 0-tuple as argument -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0593, E0601. -For more information about an error, try `rustc --explain E0593`. +For more information about this error, try `rustc --explain E0593`. diff --git a/src/test/ui/missing-items/m2.rs b/src/test/ui/missing-items/m2.rs index 9f195452691..f655047f6f5 100644 --- a/src/test/ui/missing-items/m2.rs +++ b/src/test/ui/missing-items/m2.rs @@ -18,3 +18,5 @@ struct X { impl m1::X for X { //~ ERROR not all trait items implemented } + +fn main() {} diff --git a/src/test/ui/missing-items/m2.stderr b/src/test/ui/missing-items/m2.stderr index 3b611518283..3f7a4039eb7 100644 --- a/src/test/ui/missing-items/m2.stderr +++ b/src/test/ui/missing-items/m2.stderr @@ -1,5 +1,3 @@ -error[E0601]: main function not found in crate m2 - error[E0046]: not all trait items implemented, missing: `CONSTANT`, `Type`, `method` --> $DIR/m2.rs:19:1 | @@ -10,7 +8,6 @@ LL | impl m1::X for X { //~ ERROR not all trait items implemented = note: `Type` from trait: `type Type;` = note: `method` from trait: `fn(&Self, std::string::String) -> ::Type` -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0046, E0601. -For more information about an error, try `rustc --explain E0046`. +For more information about this error, try `rustc --explain E0046`. diff --git a/src/test/ui/resolve/issue-14254.rs b/src/test/ui/resolve/issue-14254.rs index 896085329ab..eab500de255 100644 --- a/src/test/ui/resolve/issue-14254.rs +++ b/src/test/ui/resolve/issue-14254.rs @@ -111,3 +111,5 @@ impl Foo for Box { //~^ ERROR cannot find value `bah` } } + +fn main() {} diff --git a/src/test/ui/resolve/issue-14254.stderr b/src/test/ui/resolve/issue-14254.stderr index 395ca412f35..055cbb2d579 100644 --- a/src/test/ui/resolve/issue-14254.stderr +++ b/src/test/ui/resolve/issue-14254.stderr @@ -142,9 +142,6 @@ error[E0425]: cannot find value `bah` in this scope LL | bah; | ^^^ help: try: `Self::bah` -error[E0601]: main function not found in crate issue_14254 +error: aborting due to 24 previous errors -error: aborting due to 25 previous errors - -Some errors occurred: E0425, E0601. -For more information about an error, try `rustc --explain E0425`. +For more information about this error, try `rustc --explain E0425`. diff --git a/src/test/ui/resolve/issue-21221-2.rs b/src/test/ui/resolve/issue-21221-2.rs index 4ddb4d669fc..361e8caf744 100644 --- a/src/test/ui/resolve/issue-21221-2.rs +++ b/src/test/ui/resolve/issue-21221-2.rs @@ -27,3 +27,5 @@ pub mod baz { struct Foo; impl T for Foo { } //~^ ERROR cannot find trait `T` + +fn main() {} diff --git a/src/test/ui/resolve/issue-21221-2.stderr b/src/test/ui/resolve/issue-21221-2.stderr index fdafb509268..c61ffe3b33e 100644 --- a/src/test/ui/resolve/issue-21221-2.stderr +++ b/src/test/ui/resolve/issue-21221-2.stderr @@ -8,7 +8,5 @@ help: possible candidate is found in another module, you can import it into scop LL | use foo::bar::T; | -error[E0601]: main function not found in crate issue_21221_2 - error: cannot continue compilation due to previous error diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs index 981a853a040..d24fced5d31 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.rs @@ -65,3 +65,5 @@ fn h8() -> i32 { a::b() //~^ ERROR expected function, found module `a::b` } + +fn main() {} diff --git a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr index e1a205e7b3e..9216c0b3219 100644 --- a/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr +++ b/src/test/ui/resolve/suggest-path-instead-of-mod-dot-item.stderr @@ -72,9 +72,6 @@ LL | a::b() | | | did you mean `I`? -error[E0601]: main function not found in crate suggest_path_instead_of_mod_dot_item +error: aborting due to 9 previous errors -error: aborting due to 10 previous errors - -Some errors occurred: E0423, E0601. -For more information about an error, try `rustc --explain E0423`. +For more information about this error, try `rustc --explain E0423`. diff --git a/src/test/ui/span/issue-35987.rs b/src/test/ui/span/issue-35987.rs index fa0410686c2..19e05f33825 100644 --- a/src/test/ui/span/issue-35987.rs +++ b/src/test/ui/span/issue-35987.rs @@ -20,3 +20,5 @@ impl Add for Foo { unimplemented!(); } } + +fn main() {} diff --git a/src/test/ui/span/issue-35987.stderr b/src/test/ui/span/issue-35987.stderr index 09d34f3d1af..2d4a7cc72f5 100644 --- a/src/test/ui/span/issue-35987.stderr +++ b/src/test/ui/span/issue-35987.stderr @@ -8,7 +8,5 @@ help: possible better candidate is found in another module, you can import it in LL | use std::ops::Add; | -error[E0601]: main function not found in crate issue_35987 - error: cannot continue compilation due to previous error diff --git a/src/test/ui/token/issue-10636-2.rs b/src/test/ui/token/issue-10636-2.rs index 4aa41270193..71180375440 100644 --- a/src/test/ui/token/issue-10636-2.rs +++ b/src/test/ui/token/issue-10636-2.rs @@ -17,3 +17,5 @@ pub fn trace_option(option: Option) { } //~ ERROR: incorrect close delimiter //~^ ERROR: expected expression, found `)` + +fn main() {} diff --git a/src/test/ui/token/issue-10636-2.stderr b/src/test/ui/token/issue-10636-2.stderr index 273cabb0474..56a30423171 100644 --- a/src/test/ui/token/issue-10636-2.stderr +++ b/src/test/ui/token/issue-10636-2.stderr @@ -22,8 +22,5 @@ error: expected expression, found `)` LL | } //~ ERROR: incorrect close delimiter | ^ expected expression -error[E0601]: main function not found in crate issue_10636_2 +error: aborting due to 3 previous errors -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/token/issue-41155.rs b/src/test/ui/token/issue-41155.rs index 550a90fc6af..7bd8506af90 100644 --- a/src/test/ui/token/issue-41155.rs +++ b/src/test/ui/token/issue-41155.rs @@ -11,3 +11,5 @@ impl S { //~ ERROR cannot find type pub } //~ ERROR expected one of + +fn main() {} diff --git a/src/test/ui/token/issue-41155.stderr b/src/test/ui/token/issue-41155.stderr index 80a4d43116f..b56b95a8aaf 100644 --- a/src/test/ui/token/issue-41155.stderr +++ b/src/test/ui/token/issue-41155.stderr @@ -12,9 +12,6 @@ error[E0412]: cannot find type `S` in this scope LL | impl S { //~ ERROR cannot find type | ^ not found in this scope -error[E0601]: main function not found in crate issue_41155 +error: aborting due to 2 previous errors -error: aborting due to 3 previous errors - -Some errors occurred: E0412, E0601. -For more information about an error, try `rustc --explain E0412`. +For more information about this error, try `rustc --explain E0412`. -- cgit 1.4.1-3-g733a5 From b08e6d305f8366c8fa7e08d829bb0c6939124759 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Mon, 12 Mar 2018 13:23:12 -0700 Subject: Add suggestion where to add main function. --- src/librustc/middle/entry.rs | 3 +++ src/test/ui/error-codes/E0601.rs | 11 +++++++++++ src/test/ui/error-codes/E0601.stderr | 7 +++++++ src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr | 2 ++ src/test/ui/feature-gate/issue-43106-gating-of-test.stderr | 2 ++ 5 files changed, 25 insertions(+) create mode 100644 src/test/ui/error-codes/E0601.rs create mode 100644 src/test/ui/error-codes/E0601.stderr (limited to 'src/test') diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index 3473923c411..8193aad7627 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -178,6 +178,9 @@ fn configure_main(this: &mut EntryContext, crate_name: &str) { err.emit(); 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())); + } 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 \ to get started: https://doc.rust-lang.org/book/"); diff --git a/src/test/ui/error-codes/E0601.rs b/src/test/ui/error-codes/E0601.rs new file mode 100644 index 00000000000..37b3f523475 --- /dev/null +++ b/src/test/ui/error-codes/E0601.rs @@ -0,0 +1,11 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test for main function not found. diff --git a/src/test/ui/error-codes/E0601.stderr b/src/test/ui/error-codes/E0601.stderr new file mode 100644 index 00000000000..eff0a329902 --- /dev/null +++ b/src/test/ui/error-codes/E0601.stderr @@ -0,0 +1,7 @@ +error[E0601]: main function not found in crate E0601 + | + = note: consider adding a main function to $DIR/E0601.rs + +error: aborting due to previous error + +If you want more information on this error, try using "rustc --explain E0601" diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr index 27bf9c99652..32ee8026197 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr @@ -1,4 +1,6 @@ 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 error: aborting due to previous error diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr index 0d35be76d92..b86dd834d9a 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr @@ -1,4 +1,6 @@ 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 error: aborting due to previous error -- cgit 1.4.1-3-g733a5 From 2f1b34cc15d9ce8daecfb7855957a36e6e10f2e5 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 13 Mar 2018 11:22:43 -0700 Subject: Add backticks to `main` not found errors. --- src/librustc/middle/entry.rs | 4 ++-- src/test/compile-fail/cfg-attr-cfg-2.rs | 2 +- src/test/compile-fail/cfg-in-crate-1.rs | 2 +- src/test/compile-fail/elided-test.rs | 2 +- src/test/compile-fail/missing-main.rs | 2 +- src/test/ui/error-codes/E0601.stderr | 4 ++-- src/test/ui/feature-gate/issue-43106-gating-of-bench.rs | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr | 4 ++-- src/test/ui/feature-gate/issue-43106-gating-of-test.rs | 2 +- src/test/ui/feature-gate/issue-43106-gating-of-test.stderr | 4 ++-- src/test/ui/main-wrong-location.stderr | 2 +- 11 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src/test') diff --git a/src/librustc/middle/entry.rs b/src/librustc/middle/entry.rs index 8193aad7627..37d79f408f3 100644 --- a/src/librustc/middle/entry.rs +++ b/src/librustc/middle/entry.rs @@ -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 \ @@ -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 \ diff --git a/src/test/compile-fail/cfg-attr-cfg-2.rs b/src/test/compile-fail/cfg-attr-cfg-2.rs index b71a3be5dce..58a62d45ea5 100644 --- a/src/test/compile-fail/cfg-attr-cfg-2.rs +++ b/src/test/compile-fail/cfg-attr-cfg-2.rs @@ -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 diff --git a/src/test/compile-fail/cfg-in-crate-1.rs b/src/test/compile-fail/cfg-in-crate-1.rs index 94ae8d89b4f..bbccf2bcd0f 100644 --- a/src/test/compile-fail/cfg-in-crate-1.rs +++ b/src/test/compile-fail/cfg-in-crate-1.rs @@ -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)] diff --git a/src/test/compile-fail/elided-test.rs b/src/test/compile-fail/elided-test.rs index b62214b12f9..0cdd0010a74 100644 --- a/src/test/compile-fail/elided-test.rs +++ b/src/test/compile-fail/elided-test.rs @@ -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 diff --git a/src/test/compile-fail/missing-main.rs b/src/test/compile-fail/missing-main.rs index 4bfdaf69480..2788a5c2d58 100644 --- a/src/test/compile-fail/missing-main.rs +++ b/src/test/compile-fail/missing-main.rs @@ -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() { } diff --git a/src/test/ui/error-codes/E0601.stderr b/src/test/ui/error-codes/E0601.stderr index eff0a329902..6fe05d2dc8e 100644 --- a/src/test/ui/error-codes/E0601.stderr +++ b/src/test/ui/error-codes/E0601.stderr @@ -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 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs b/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs index a34f98f0355..6c226799338 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-bench.rs @@ -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 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr index 32ee8026197..503ef020d96 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-bench.stderr @@ -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 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-test.rs b/src/test/ui/feature-gate/issue-43106-gating-of-test.rs index adcbfe77280..06632396249 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-test.rs +++ b/src/test/ui/feature-gate/issue-43106-gating-of-test.rs @@ -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 diff --git a/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr index b86dd834d9a..2ab35be43c5 100644 --- a/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr +++ b/src/test/ui/feature-gate/issue-43106-gating-of-test.stderr @@ -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 diff --git a/src/test/ui/main-wrong-location.stderr b/src/test/ui/main-wrong-location.stderr index c5affade5e2..a5ef92f14bb 100644 --- a/src/test/ui/main-wrong-location.stderr +++ b/src/test/ui/main-wrong-location.stderr @@ -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' -- cgit 1.4.1-3-g733a5 From 525727529492f30ef9d68467d5b8a7f18f65d743 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Wed, 14 Mar 2018 13:04:24 -0700 Subject: Update E0601 test for new message format. --- src/test/ui/error-codes/E0601.stderr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test') diff --git a/src/test/ui/error-codes/E0601.stderr b/src/test/ui/error-codes/E0601.stderr index 6fe05d2dc8e..cbc20db35da 100644 --- a/src/test/ui/error-codes/E0601.stderr +++ b/src/test/ui/error-codes/E0601.stderr @@ -4,4 +4,4 @@ error[E0601]: `main` function not found in crate `E0601` error: aborting due to previous error -If you want more information on this error, try using "rustc --explain E0601" +For more information about this error, try `rustc --explain E0601`. -- cgit 1.4.1-3-g733a5