Closed
Description
Edit: outstanding work is to change the span from pointing at the function body to point at the return type.
#50272 adds a test for the case where a unit test returns a value that does not implement Termination
. The message currently talks about main
and has an ugly multi-line span:
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseIntError>`
--> $DIR/termination-trait-test-wrong-type.rs:18:1
|
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> { //~ ERROR
LL | | "0".parse()
LL | | }
| |_^ `main` can only return types that implement `std::process::Termination`
|
= help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseIntError>`
= note: required by `__test::test::assert_test_result`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0277`.
Metadata
Metadata
Assignees
Labels
Area: Attributes (`#[…]`, `#![…]`)Area: Messages for errors, warnings, and lintsArea: `#[test]` / the `test` libraryCategory: An issue proposing an enhancement or a PR with one.Diagnostics: An error or lint that needs small tweaks.Relevant to the compiler team, which will review and decide on the PR/issue.