Skip to content

Commit f230145

Browse files
Rollup merge of #88565 - lqd:issue-83190, r=spastorino
Add regression test for issue 83190 Reduced from `bioyino-metric` by `@hellow554` and myself. Closes #83190. r? `@spastorino`
2 parents 66ef9cc + a5fd955 commit f230145

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

Diff for: src/test/ui/issues/issue-83190.rs

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// check-pass
2+
3+
// Regression test for issue #83190, triggering an ICE in borrowck.
4+
5+
pub trait Any {}
6+
impl<T> Any for T {}
7+
8+
pub trait StreamOnce {
9+
type Range;
10+
}
11+
12+
pub trait Parser<Input>: Sized {
13+
type Output;
14+
type PartialState;
15+
fn map(self) -> Map<Self> {
16+
todo!()
17+
}
18+
}
19+
20+
pub struct Map<P>(P);
21+
impl<I, P: Parser<I, Output = ()>> Parser<I> for Map<P> {
22+
type Output = ();
23+
type PartialState = P::PartialState;
24+
}
25+
26+
struct TakeWhile1<Input>(Input);
27+
impl<I: StreamOnce> Parser<I> for TakeWhile1<I> {
28+
type Output = I::Range;
29+
type PartialState = ();
30+
}
31+
impl<I> TakeWhile1<I> {
32+
fn new() -> Self {
33+
todo!()
34+
}
35+
}
36+
37+
impl<I, A: Parser<I>> Parser<I> for (A,) {
38+
type Output = ();
39+
type PartialState = Map<A::Output>;
40+
}
41+
42+
pub fn metric_stream_parser<'a, I>() -> impl Parser<I, Output = (), PartialState = impl Any + 'a>
43+
where
44+
I: StreamOnce<Range = &'a [()]>,
45+
{
46+
(TakeWhile1::new(),).map()
47+
}
48+
49+
fn main() {}

0 commit comments

Comments
 (0)