Skip to content

Commit d9165b2

Browse files
committed
add test for issue 135289
1 parent cd805f0 commit d9165b2

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// Helper for test tests/ui/resolve/const-with-typo-in-pattern-binding-ice-135289.rs
2+
3+
//@ edition: 2018
4+
5+
#[macro_export]
6+
macro_rules! assert_matches {
7+
( $e:expr , $($pat:pat)|+ ) => {
8+
match $e {
9+
$($pat)|+ => (),
10+
_ => (),
11+
}
12+
};
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This is a non-regression test for issue 135289, where the "const with typo in pattern" diagnostic
2+
// caused an ICE when unexpectedly pretty printing a type for unreachable arms via a macro defined
3+
// in a dependency.
4+
5+
#![warn(unreachable_patterns)] // needed to reproduce the ICE described in #135289
6+
7+
//@ check-pass
8+
//@ aux-build: fake_matches.rs
9+
extern crate fake_matches;
10+
11+
const _A: u64 = 0;
12+
pub fn f() -> u64 {
13+
0
14+
}
15+
fn main() {
16+
fake_matches::assert_matches!(f(), _non_existent);
17+
}

0 commit comments

Comments
 (0)