We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b24aa7c commit 69c032eCopy full SHA for 69c032e
src/test/ui/consts/const_in_pattern/issue-73431.rs
@@ -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