Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove needless error in test
  • Loading branch information
estebank committed Apr 22, 2019
commit 2dc5d52a0414e6b65e060b98b767e95e55569a3b
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// compile-flags: --test

use std::num::ParseIntError;
use std::num::ParseFloatError;

#[test]
fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> { //~ ERROR
"0".parse() //~ ERROR type mismatch resolving
fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> { //~ ERROR
"0".parse()
}
Original file line number Diff line number Diff line change
@@ -1,24 +1,14 @@
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseIntError>`
error[E0277]: `main` has invalid return type `std::result::Result<f32, std::num::ParseFloatError>`
--> $DIR/termination-trait-test-wrong-type.rs:6:1
|
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseIntError> {
LL | / fn can_parse_zero_as_f32() -> Result<f32, ParseFloatError> {
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>`
= help: the trait `std::process::Termination` is not implemented for `std::result::Result<f32, std::num::ParseFloatError>`
= note: required by `test::assert_test_result`

error[E0271]: type mismatch resolving `<f32 as std::str::FromStr>::Err == std::num::ParseIntError`
--> $DIR/termination-trait-test-wrong-type.rs:7:9
|
LL | "0".parse()
| ^^^^^ expected struct `std::num::ParseFloatError`, found struct `std::num::ParseIntError`
|
= note: expected type `std::num::ParseFloatError`
found type `std::num::ParseIntError`

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors have detailed explanations: E0271, E0277.
For more information about an error, try `rustc --explain E0271`.
For more information about this error, try `rustc --explain E0277`.