-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ICE: unexpected concrete region in borrowck: ReEarlyBound(0, 'a) #83190
Comments
Yes, this is a newly added test that I wanted to add as a test that will pass when that issue is fixed. |
you added this delay_span_bug, but from the PR and the documentation on the function I can't tell what the correct way forward is. I presume this was built without type-alias-impl-trait in mind, as now lifetimes from the surrounding impl block can end up in the opaque type. The specific code emitting the delay span bug is I don't know enough about lifetime inference to judge how to proceed (removing the delay span bug makes the test pass, but... that doesn't sound like a good approach for something this subtle) |
Issue: rust-lang/rust#83190
After a discussion with Niko about this and assigning to myself we saw that there's already a PR. Unassigning myself then :). |
Just saw this in https://github.com/palfrey/bioyino/runs/3273000488?check_suite_focus=true with |
Also seen in crater for bioyino, cc #87749 @rustbot label regression-from-stable-to-beta |
Perhaps related also to #87455? In that issue a comment mentions a backport for #87483 could fix that one. |
Assigning priority as discussed in the Zulip thread of the Prioritization Working Group. @rustbot label -I-prioritize +P-high |
Hey Cleanup Crew ICE-breakers! This bug has been identified as a good cc @AminArria @camelid @chrissimpkins @contrun @DutchGhost @elshize @h-michael @HallerPatrick @hdhoang @hellow554 @henryboisdequin @imtsuki @JamesPatrickGill @kanru @KarlK90 @MAdrianMattocks @matheus-consoli @mental32 @nmccarty @Noah-Kennedy @pard68 @PeytonT @pierreN @Redblueflame @RobbieClarken @RobertoSnap @robjtede @SarthakSingh31 @shekohex @sinato @smmalis37 @steffahn @Stupremee @tamuhey @turboladen @woshilapin @yerke |
This is my current MCVE: use combine::parser::range::take_while1;
use combine::stream::RangeStream;
use combine::{choice, Parser, StreamOnce};
pub fn metric_stream_parser<'a, I, F>(
) -> impl Parser<I, Output = (), PartialState = impl Default + 'a>
where
I: 'a + StreamOnce<Token = u8, Range = &'a [u8], Position = usize> + RangeStream,
{
let val = take_while1(|_: u8| false);
let sampling = take_while1(|_: u8| false);
let metric = (val, choice((sampling,))).map(|_| todo!());
choice(((metric).map(|_: F| ()),))
} combine is 4.0 try to reduce it further later or tomorrow (: |
@hellow554 great if you come up with a standalone repro, please open a PR and feel free to assign it to me. |
use std::marker::PhantomData;
pub trait StreamError: Sized {}
pub trait ParseError: Sized + PartialEq {
type StreamError: StreamError;
}
pub trait StreamOnce {
type Token: Clone;
type Range: Clone;
type Error: ParseError;
}
pub trait Stream: StreamOnce {}
pub struct Map<P, F>(P, F);
impl<Input, A, B, P, F> Parser<Input> for Map<P, F>
where
Input: Stream,
P: Parser<Input, Output = A>,
F: FnMut(A) -> B,
{
type Output = B;
type PartialState = P::PartialState;
}
struct TakeWhile1<Input, F>(F, PhantomData<fn(Input) -> Input>);
impl<Input, F> Parser<Input> for TakeWhile1<Input, F>
where
Input: Stream,
F: FnMut(Input::Token) -> bool,
{
type Output = Input::Range;
type PartialState = usize;
}
fn take_while1<Input, F>(_f: F) -> TakeWhile1<Input, F>
where
Input: Stream,
F: FnMut(Input::Token) -> bool,
{
unimplemented!()
}
pub struct SequenceState<T, U>(PhantomData<(T, U)>);
impl<T, U: Default> Default for SequenceState<T, U> {
fn default() -> Self {
unimplemented!()
}
}
#[derive(Default)]
pub struct PartialState1<A> {
_marker: PhantomData<(A,)>,
}
impl<Input: Stream, A> Parser<Input> for (A,)
where
Input: Stream,
Input::Error: ParseError,
A: Parser<Input>,
{
type Output = (A::Output,);
type PartialState = PartialState1<SequenceState<A::Output, A::PartialState>>;
}
pub trait Parser<Input: Stream> {
type Output;
type PartialState: Default;
fn map<F, B>(self, _f: F) -> Map<Self, F>
where
Self: Sized,
F: FnMut(Self::Output) -> B,
{
unimplemented!()
}
}
pub fn metric_stream_parser<'a, I>() -> impl Parser<I, Output = (), PartialState = impl Default + 'a>
where
I: 'a + StreamOnce<Token = u8, Range = &'a [u8]> + Stream,
{
let val = take_while1(|_: u8| false);
let metric = (val,).map(|_| todo!());
metric
} |
Sub 50 lines, almost there: pub trait Any {}
impl<T> Any for T {}
pub trait StreamOnce {
type Range;
}
pub trait Parser<Input>: Sized {
type Output;
type PartialState;
fn map(self) -> Map<Self> {
todo!()
}
}
pub struct Map<P>(P);
impl<I, P: Parser<I, Output = ()>> Parser<I> for Map<P> {
type Output = ();
type PartialState = P::PartialState;
}
struct TakeWhile1<Input>(Input);
impl<I: StreamOnce> Parser<I> for TakeWhile1<I> {
type Output = I::Range;
type PartialState = ();
}
impl<I> TakeWhile1<I> {
fn new() -> Self {
todo!()
}
}
impl<I, A: Parser<I>> Parser<I> for (A,) {
type Output = ();
type PartialState = Map<A::Output>;
}
pub fn metric_stream_parser<'a, I>() -> impl Parser<I, Output = (), PartialState = impl Any + 'a>
where
I: StreamOnce<Range = &'a [()]>,
{
(TakeWhile1::new(),).map()
}
fn main() {} |
Add regression test for issue 83190 Reduced from `bioyino-metric` by `@hellow554` and myself. Closes rust-lang#83190. r? `@spastorino`
Add regression test for issue 83190 Reduced from `bioyino-metric` by ``@hellow554`` and myself. Closes rust-lang#83190. r? ``@spastorino``
Add regression test for issue 83190 Reduced from `bioyino-metric` by ```@hellow554``` and myself. Closes rust-lang#83190. r? ```@spastorino```
Should this be reopened to track beta backport or has it already been backported? |
…ulacrum [beta] backports This PR backports: * Concrete regions can show up in mir borrowck if the originated from there rust-lang#88533 (fixes rust-lang#83190) * Fix loading large rlibs rust-lang#88506 (fixes rust-lang#88351) * Display associated types of implementors rust-lang#88490 (fixes rust-lang#86631) * Tracking issue for UNSUPPORTED_CALLING_CONVENTIONS rust-lang#88397 r? `@Mark-Simulacrum`
Closing - backported in #88641 |
Code
code is from
./src/test/ui/type-alias-impl-trait/associated-type-lifetime-ice.rs
Meta
Seems to have been introduced by #82898 / 195ad48
cc @oli-obk ?
Error output
Backtrace
The text was updated successfully, but these errors were encountered: