Skip to content
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

regression: ICE failing to normalize #109743

Closed
Mark-Simulacrum opened this issue Mar 30, 2023 · 8 comments · Fixed by #109938
Closed

regression: ICE failing to normalize #109743

Mark-Simulacrum opened this issue Mar 30, 2023 · 8 comments · Fixed by #109938
Assignees
Labels
P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue
Milestone

Comments

@Mark-Simulacrum
Copy link
Member

https://crater-reports.s3.amazonaws.com/beta-1.69-3/beta-2023-03-18/gh/jwiegley.motoko_parse/log.txt

[INFO] [stdout] error: internal compiler error: compiler/rustc_middle/src/ty/normalize_erasing_regions.rs:195:90: Failed to normalize fn() -> <impl combine::Parser<combine::easy::Stream<&str>, Output = std::string::String> as combine::Parser<combine::easy::Stream<&str>>>::PartialState {<<impl combine::Parser<combine::easy::Stream<&str>, Output = std::string::String> as combine::Parser<combine::easy::Stream<&str>>>::PartialState as std::default::Default>::default}, maybe try to call `try_normalize_erasing_regions` instead
@Mark-Simulacrum Mark-Simulacrum added the regression-from-stable-to-beta Performance or correctness regression from stable to beta. label Mar 30, 2023
@Mark-Simulacrum Mark-Simulacrum added this to the 1.69.0 milestone Mar 30, 2023
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Mar 30, 2023
@compiler-errors compiler-errors added the E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc label Mar 30, 2023
@lukas-code
Copy link
Contributor

searched nightlies: from nightly-2023-01-24 to nightly-2023-03-30
regressed nightly: nightly-2023-02-05
searched commit range: 658fad6...50d3ba5
regressed commit: 9dee4e4

bisected with cargo-bisect-rustc v0.6.5

Host triple: x86_64-unknown-linux-gnu
Reproduce with:

cargo bisect-rustc --regress=ice -- build 

This looks related to #107678, but wasn't fixed by #107688.

@lqd
Copy link
Member

lqd commented Mar 30, 2023

Let's notify the people involved in that bisection, it's #107267 cc author @cjgillot and reviewer @oli-obk.

A minimization would be helpful.

@lqd lqd added E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example and removed E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc labels Mar 30, 2023
@lqd
Copy link
Member

lqd commented Mar 30, 2023

#107267 probably just allowed another existing bug to show up, like the other projection issues.

I've reduced the motoko_parse regression to this

use combine::parser::char::spaces;
use combine::Parser;
use combine::{easy, error, stream};

fn mk_type_parser<'a>() -> impl Parser<easy::Stream<&'a str>, Output = ()> {
    mk_inner_type_parser().skip(spaces())
}

struct TypeParser<'a>(&'a ());
fn mk_inner_type_parser<'a>() -> TypeParser<'a> {
    unimplemented!()
}

impl<'a> Parser<easy::Stream<&'a str>> for TypeParser<'a>
where
    easy::Stream<&'a str>: stream::Stream,
{
    type Output = ();
    type PartialState = ();
    fn add_committed_expected_error(
        &mut self,
        _errors: &mut error::Tracked<<easy::Stream<&'a str> as stream::StreamOnce>::Error>,
    ) {
        let mut parser = mk_type_parser();
        let _: &mut dyn Parser<_, Output = _, PartialState = _> = &mut parser;
    }
}

it still depends on combine, if anyone has the time to also remove that.

@apiraino
Copy link
Contributor

apiraino commented Apr 3, 2023

WG-prioritization assigning priority (Zulip discussion).

@rustbot label -I-prioritize +P-medium

@rustbot rustbot added P-medium Medium priority and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Apr 3, 2023
@lukas-code
Copy link
Contributor

This seems to have disappeared in nightly. Bisect points to #108821. Maybe fixed by #108750?

@lqd
Copy link
Member

lqd commented Apr 3, 2023

Wasn't that PR already present in your previous bisection up to nightly-2023-03-30 ?

@lukas-code
Copy link
Contributor

Ah, looks like the MCVE is fixed in #108821, but not the original code.

@lukas-code
Copy link
Contributor

lukas-code commented Apr 3, 2023

new mcve

use std::marker::PhantomData;

pub trait StreamOnce {
    type Token;
}

impl StreamOnce for &str {
    type Token = ();
}

pub trait Parser<Input: StreamOnce> {
    type PartialState: Default;
    fn parse_mode(&self, _state: &Self::PartialState) {}
    fn parse_mode_impl() {}
}

pub fn parse_bool<'a>() -> impl Parser<&'a str> {
    pub struct TokensCmp<C, Input>
    where
        Input: StreamOnce,
    {
        _cmp: C,
        _marker: PhantomData<Input>,
    }

    impl<Input, C> Parser<Input> for TokensCmp<C, Input>
    where
        C: FnMut(Input::Token),
        Input: StreamOnce,
    {
        type PartialState = ();
    }

    TokensCmp {
        _cmp: |_| (),
        _marker: PhantomData,
    }
}

pub struct ParseBool;

impl<'a> Parser<&'a str> for ParseBool
where
    &'a str: StreamOnce,
{
    type PartialState = ();

    fn parse_mode_impl() {
        parse_bool().parse_mode(&Default::default())
    }
}

@rustbot label -E-needs-mcve +S-has-mcve

@rustbot rustbot added S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue and removed E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example labels Apr 3, 2023
@oli-obk oli-obk self-assigned this Apr 4, 2023
@bors bors closed this as completed in b0483e8 Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-medium Medium priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. S-has-mcve Status: A Minimal Complete and Verifiable Example has been found for this issue
Projects
None yet
7 participants