termination_trait: Make error message more helpful

This commit is contained in:
Tyler Mandry 2018-03-21 23:28:48 -05:00
parent b6934c91b2
commit 2b13d95da0
5 changed files with 16 additions and 16 deletions

View file

@ -9,7 +9,8 @@
// except according to those terms.
fn main() -> i32 {
//~^ ERROR `i32: std::process::Termination` is not satisfied
//~| NOTE `main` can only return types that implement std::process::Termination, not `i32`
//~^ ERROR `main` has invalid return type `i32`
//~| NOTE `main` can only return types that implement std::process::Termination
//~| HELP consider using `()`, or a `Result`
0
}

View file

@ -10,6 +10,6 @@
struct ReturnType {}
fn main() -> ReturnType { //~ ERROR `ReturnType: std::process::Termination` is not satisfied
fn main() -> ReturnType { //~ ERROR `main` has invalid return type `ReturnType`
ReturnType {}
}

View file

@ -1,8 +1,8 @@
error[E0277]: the trait bound `char: std::process::Termination` is not satisfied
error[E0277]: `main` has invalid return type `char`
--> $DIR/termination-trait-main-wrong-type.rs:11:14
|
LL | fn main() -> char { //~ ERROR
| ^^^^ `main` can only return types that implement std::process::Termination, not `char`
| ^^^^ `main` can only return types that implement std::process::Termination
|
= help: consider using `()`, or a `Result`