Skip to content

Commit a227414

Browse files
committed
Update error message
1 parent f3186df commit a227414

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

src/libsyntax/test.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,7 @@ fn is_test_fn(cx: &TestCtxt, i: &ast::Item) -> bool {
379379
BadTestSignature::NoArgumentsAllowed =>
380380
diag.span_err(i.span, "functions used as tests can not have any arguments"),
381381
BadTestSignature::ShouldPanicOnlyWithNoArgs =>
382-
diag.span_err(i.span,
383-
"functions used as tests returning Result<_, _> must \
384-
not use #[should_panic]"),
382+
diag.span_err(i.span, "functions using `#[should_panic]` must return `()`"),
385383
}
386384
false
387385
}

src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use test::Bencher;
2020
#[test]
2121
#[should_panic]
2222
fn not_a_num() -> Result<(), ParseIntError> {
23-
//~^ ERROR functions used as tests returning Result<_, _> must not use #[should_panic]
23+
//~^ ERROR functions using `#[should_panic]` must return `()`
2424
let _: u32 = "abc".parse()?;
2525
Ok(())
2626
}

src/test/ui/rfc-1937-termination-trait/termination-trait-in-test-should-panic.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error: functions used as tests returning Result<_, _> must not use #[should_panic]
1+
error: functions using `#[should_panic]` must return `()`
22
--> $DIR/termination-trait-in-test-should-panic.rs:22:1
33
|
44
LL | / fn not_a_num() -> Result<(), ParseIntError> {
5-
LL | | //~^ ERROR functions used as tests returning Result<_, _> must not use #[should_panic]
5+
LL | | //~^ ERROR functions using `#[should_panic]` must return `()`
66
LL | | let _: u32 = "abc".parse()?;
77
LL | | Ok(())
88
LL | | }

0 commit comments

Comments
 (0)