Regression test for rust-lang/rust#53675.
(Includes a couple variations on the theme. I confirmed that the ones in `in_expression_position` and `what_if_we_use_panic_directly_in_expr` both failed back on "rustc 1.30.0-nightly (0f063aef6 2018-09-03)".)
This commit is contained in:
parent
f789b6bd6d
commit
fc6e1ed1e1
36
src/test/ui/issues/issue-53675-a-test-called-panic.rs
Normal file
36
src/test/ui/issues/issue-53675-a-test-called-panic.rs
Normal file
@ -0,0 +1,36 @@
|
||||
// rust-lang/rust#53675: At one point the compiler errored when a test
|
||||
// named `panic` used the `assert!` macro in expression position.
|
||||
|
||||
// compile-pass
|
||||
// compile-flags: --test
|
||||
|
||||
mod in_expression_position {
|
||||
#[test]
|
||||
fn panic() {
|
||||
assert!(true)
|
||||
}
|
||||
}
|
||||
|
||||
mod in_statement_position {
|
||||
#[test]
|
||||
fn panic() {
|
||||
assert!(true);
|
||||
}
|
||||
}
|
||||
|
||||
mod what_if_we_use_panic_directly_in_expr {
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn panic() {
|
||||
panic!("in expr")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mod what_if_we_use_panic_directly_in_stmt {
|
||||
#[test]
|
||||
#[should_panic]
|
||||
fn panic() {
|
||||
panic!("in stmt");
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user