Skip to content

Commit 69c032e

Browse files
ecstatic-morseMark-Simulacrum
authored andcommitted
Add regression test for rust-lang#73431
1 parent b24aa7c commit 69c032e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// run-pass
2+
3+
// Regression test for https://github.com/rust-lang/rust/issues/73431.
4+
5+
pub trait Zero {
6+
const ZERO: Self;
7+
}
8+
9+
impl Zero for usize {
10+
const ZERO: Self = 0;
11+
}
12+
13+
impl<T: Zero> Zero for Wrapper<T> {
14+
const ZERO: Self = Wrapper(T::ZERO);
15+
}
16+
17+
#[derive(Debug, PartialEq, Eq)]
18+
pub struct Wrapper<T>(T);
19+
20+
fn is_zero(x: Wrapper<usize>) -> bool {
21+
match x {
22+
Zero::ZERO => true,
23+
_ => false,
24+
}
25+
}
26+
27+
fn main() {
28+
let _ = is_zero(Wrapper(42));
29+
}

0 commit comments

Comments
 (0)