Skip to content

Commit 5b4e707

Browse files
committed
Add ICEing regression tests
1 parent 39d2f2a commit 5b4e707

File tree

2 files changed

+71
-0
lines changed

2 files changed

+71
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
use std::iter;
2+
3+
mod either {
4+
pub enum Either<L, R> {
5+
Left(L),
6+
Right(R),
7+
}
8+
9+
impl<L: Iterator, R: Iterator<Item = L::Item>> Iterator for Either<L, R> {
10+
type Item = L::Item;
11+
fn next(&mut self) -> Option<Self::Item> {
12+
todo!()
13+
}
14+
}
15+
pub use self::Either::{Left, Right};
16+
}
17+
18+
pub enum BabeConsensusLogRef<'a> {
19+
NextEpochData(BabeNextEpochRef<'a>),
20+
NextConfigData,
21+
}
22+
23+
impl<'a> BabeConsensusLogRef<'a> {
24+
pub fn scale_encoding(
25+
&self,
26+
) -> impl Iterator<Item = impl AsRef<[u8]> + Clone + 'a> + Clone + 'a {
27+
match self {
28+
BabeConsensusLogRef::NextEpochData(digest) => either::Left(either::Left(
29+
digest.scale_encoding().map(either::Left).map(either::Left),
30+
)),
31+
BabeConsensusLogRef::NextConfigData => either::Right(
32+
iter::once(either::Right(either::Left([1])))
33+
.chain(std::iter::once([1]).map(either::Right).map(either::Right)),
34+
),
35+
}
36+
}
37+
}
38+
39+
pub struct BabeNextEpochRef<'a>(&'a ());
40+
41+
impl<'a> BabeNextEpochRef<'a> {
42+
pub fn scale_encoding(
43+
&self,
44+
) -> impl Iterator<Item = impl AsRef<[u8]> + Clone + 'a> + Clone + 'a {
45+
std::iter::once([1])
46+
}
47+
}
48+
49+
fn main() {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#![feature(type_alias_impl_trait)]
2+
3+
type Tait = impl FnOnce() -> ();
4+
5+
fn reify_as_tait() -> Thunk<Tait> {
6+
Thunk::new(|cont| cont)
7+
}
8+
9+
struct Thunk<F>(F);
10+
11+
impl<F> Thunk<F> {
12+
fn new(f: F)
13+
where
14+
F: ContFn,
15+
{
16+
todo!();
17+
}
18+
}
19+
20+
trait ContFn {}
21+
22+
impl<F: FnOnce(Tait) -> ()> ContFn for F {}

0 commit comments

Comments
 (0)