mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-09 05:23:07 +00:00
Add suggestion where to add main function.
This commit is contained in:
parent
6aa4dcb9cf
commit
b08e6d305f
@ -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/");
|
||||
|
11
src/test/ui/error-codes/E0601.rs
Normal file
11
src/test/ui/error-codes/E0601.rs
Normal file
@ -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 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// Test for main function not found.
|
7
src/test/ui/error-codes/E0601.stderr
Normal file
7
src/test/ui/error-codes/E0601.stderr
Normal file
@ -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"
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user