-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test for ICE with associated_const_equality #108220
Fixes #108220
- Loading branch information
1 parent
b151e06
commit 6203ebe
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
tests/ui/generic-const-items/assoc-const-AnonConst-ice-108220.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// ICE assertion failed: matches!(self.def_kind(ct.def.did), DefKind :: AnonConst) | ||
// issue: rust-lang/rust#108220 | ||
//@ check-pass | ||
|
||
#![feature(associated_const_equality)] | ||
#![allow(unused)] | ||
|
||
use std::marker::PhantomData; | ||
|
||
pub struct NoPin; | ||
|
||
pub trait SetAlternate<const A: u8> {} | ||
|
||
impl SetAlternate<0> for NoPin {} | ||
|
||
pub trait PinA<PER> { | ||
const A: u8; | ||
} | ||
|
||
impl<PER> PinA<PER> for NoPin { | ||
const A: u8 = 0; | ||
} | ||
|
||
pub trait Pins<USART> {} | ||
|
||
impl<USART, T, const TA: u8> Pins<USART> for T where | ||
T: PinA<USART, A = { TA }> + SetAlternate<TA> | ||
{ | ||
} | ||
|
||
struct Serial<USART>(PhantomData<USART>); | ||
|
||
impl<USART> Serial<USART> where NoPin: Pins<USART> {} | ||
|
||
fn main() {} |