Skip to content

Commit

Permalink
Update error message
Browse files Browse the repository at this point in the history
  • Loading branch information
rcoh committed Apr 13, 2018
1 parent f3186df commit a227414
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
4 changes: 1 addition & 3 deletions src/libsyntax/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,7 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
BadTestSignature::NoArgumentsAllowed =>
diag.span_err(i.span, "functions used as tests can not have any arguments"),
BadTestSignature::ShouldPanicOnlyWithNoArgs =>
diag.span_err(i.span,
"functions used as tests returning Result<_, _> must \
not use #[should_panic]"),
diag.span_err(i.span, "functions using `#[should_panic]` must return `()`"),
}
false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use test::Bencher;
#[test]
#[should_panic]
fn not_a_num() -> Result<(), ParseIntError> {
//~^ ERROR functions used as tests returning Result<_, _> must not use #[should_panic]
//~^ ERROR functions using `#[should_panic]` must return `()`
let _: u32 = "abc".parse()?;
Ok(())
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: functions used as tests returning Result<_, _> must not use #[should_panic]
error: functions using `#[should_panic]` must return `()`
--> $DIR/termination-trait-in-test-should-panic.rs:22:1
|
LL | / fn not_a_num() -> Result<(), ParseIntError> {
LL | | //~^ ERROR functions used as tests returning Result<_, _> must not use #[should_panic]
LL | | //~^ ERROR functions using `#[should_panic]` must return `()`
LL | | let _: u32 = "abc".parse()?;
LL | | Ok(())
LL | | }
Expand Down

0 comments on commit a227414

Please sign in to comment.