From fc6e1ed1e1cce232a654f7c585aec09e143cb46e Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Fri, 14 Sep 2018 14:06:05 +0200 Subject: [PATCH] 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)".) --- .../issues/issue-53675-a-test-called-panic.rs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/test/ui/issues/issue-53675-a-test-called-panic.rs diff --git a/src/test/ui/issues/issue-53675-a-test-called-panic.rs b/src/test/ui/issues/issue-53675-a-test-called-panic.rs new file mode 100644 index 0000000000000..8a35b36d46d64 --- /dev/null +++ b/src/test/ui/issues/issue-53675-a-test-called-panic.rs @@ -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"); + } +}