Skip to content

Commit 6203ebe

Browse files
committed
add test for ICE with associated_const_equality #108220
Fixes #108220
1 parent b151e06 commit 6203ebe

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// ICE assertion failed: matches!(self.def_kind(ct.def.did), DefKind :: AnonConst)
2+
// issue: rust-lang/rust#108220
3+
//@ check-pass
4+
5+
#![feature(associated_const_equality)]
6+
#![allow(unused)]
7+
8+
use std::marker::PhantomData;
9+
10+
pub struct NoPin;
11+
12+
pub trait SetAlternate<const A: u8> {}
13+
14+
impl SetAlternate<0> for NoPin {}
15+
16+
pub trait PinA<PER> {
17+
const A: u8;
18+
}
19+
20+
impl<PER> PinA<PER> for NoPin {
21+
const A: u8 = 0;
22+
}
23+
24+
pub trait Pins<USART> {}
25+
26+
impl<USART, T, const TA: u8> Pins<USART> for T where
27+
T: PinA<USART, A = { TA }> + SetAlternate<TA>
28+
{
29+
}
30+
31+
struct Serial<USART>(PhantomData<USART>);
32+
33+
impl<USART> Serial<USART> where NoPin: Pins<USART> {}
34+
35+
fn main() {}

0 commit comments

Comments
 (0)