Skip to content

Commit a33f4eb

Browse files
authored
Rollup merge of rust-lang#106037 - JohnTitor:issue-94293, r=lcnr
Add regression test for rust-lang#94293 Closes rust-lang#94293 r? `@lcnr` Signed-off-by: Yuki Okushi <[email protected]>
2 parents 49ba6ae + 34ae968 commit a33f4eb

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// check-pass
2+
3+
#![feature(generic_const_exprs)]
4+
#![allow(incomplete_features)]
5+
#![deny(const_evaluatable_unchecked)]
6+
7+
pub struct If<const CONDITION: bool>;
8+
pub trait True {}
9+
impl True for If<true> {}
10+
11+
pub struct FixedI8<const FRAC: u32> {
12+
pub bits: i8,
13+
}
14+
15+
impl<const FRAC_LHS: u32, const FRAC_RHS: u32> PartialEq<FixedI8<FRAC_RHS>> for FixedI8<FRAC_LHS>
16+
where
17+
If<{ FRAC_RHS <= 8 }>: True,
18+
{
19+
fn eq(&self, _rhs: &FixedI8<FRAC_RHS>) -> bool {
20+
unimplemented!()
21+
}
22+
}
23+
24+
impl<const FRAC: u32> PartialEq<i8> for FixedI8<FRAC> {
25+
fn eq(&self, rhs: &i8) -> bool {
26+
let rhs_as_fixed = FixedI8::<0> { bits: *rhs };
27+
PartialEq::eq(self, &rhs_as_fixed)
28+
}
29+
}
30+
31+
fn main() {}

0 commit comments

Comments
 (0)