-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-libtestArea: `#[test]` / the `test` libraryArea: `#[test]` / the `test` libraryC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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`.
shepmaster, nixpulvis, azalutsky, lorenzleutgeb and schneiderfelipe
Metadata
Metadata
Assignees
Labels
A-attributesArea: Attributes (`#[…]`, `#![…]`)Area: Attributes (`#[…]`, `#![…]`)A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-libtestArea: `#[test]` / the `test` libraryArea: `#[test]` / the `test` libraryC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.D-papercutDiagnostics: An error or lint that needs small tweaks.Diagnostics: An error or lint that needs small tweaks.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.