Skip to content

NLL ICE: "unresolved inference variable in outlives" #52057

Closed

Description

@nikomatsakis

The crater run turned up a number of crates encountering an ICE with a message like "unresolved inference variable in outlives" (see list in #52054). I'm not sure what is the problem yet but I'm filing this bug to track the issue.

A good representative is combine-language-2.0.0-beta4, which failed with this log.

Activity

  1. added
    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-NLLArea: Non-lexical lifetimes (NLL)
    on Jul 4, 2018
  2. matthewjasper commented on Jul 11, 2018

    @matthewjasper
    Contributor

    Self contained example. Related to #51649?

    // Delayed ICE:
    // error: internal compiler error: unresolved inference variable in outlives: _#0t
    #![feature(nll)]
    
    pub trait Parser {
        type Input;
    
        #[inline(always)]
        fn parse_first(input: &mut Self::Input);
    }
    
    impl<'a, I, P: ?Sized> Parser for &'a mut P
    where
        P: Parser<Input = I>,
    {
        type Input = I;
    
        fn parse_first(_: &mut Self::Input) {}
    }
    
    fn main() {}
  3. self-assigned this
    on Jul 17, 2018
  4. pnkfelix commented on Jul 24, 2018

    @pnkfelix
    Contributor

    triage re-assigning to self

  5. nikomatsakis commented on Jul 25, 2018

    @nikomatsakis
    ContributorAuthor

    I think this may have been fixed by #51959. At least @matthewjasper's example no longer reproduces. I'll have to try the original crate.

  6. nikomatsakis commented on Jul 25, 2018

    @nikomatsakis
    ContributorAuthor

    OK wait. @matthewjasper's example now fails to build, whereas it builds without nll. It no longer ICEs though.

  7. nikomatsakis commented on Jul 25, 2018

    @nikomatsakis
    ContributorAuthor

    Ah, I see the problem. It arises because we don't normalize types before computing the implied bounds in the universal regions code:

    // Add the implied bounds from inputs and outputs.
    for ty in inputs_and_output {
    debug!("build: input_or_output={:?}", ty);
    self.add_implied_bounds(&indices, ty);
    }

    even though we just "liberated" late-bound regions:

    let inputs_and_output = self.infcx.replace_bound_regions_with_nll_infer_vars(
    FR,
    self.mir_def_id,
    &bound_inputs_and_output,
    &mut indices,
    );

  8. nikomatsakis commented on Jul 25, 2018

    @nikomatsakis
    ContributorAuthor

    It's a bit tricky -- we don't just want to insert a random call to normalize until we've finished generating all the "free regions". That call could produce outlives obligations we have to propagate to the right place. It's not that big a deal, in fact at this point we have generated all the free regions:

    let num_universals = self.infcx.num_region_vars();

    but we still need to route the resulting outlives obligations to the right place. This will take a touch of reorganization in the code.

  9. nikomatsakis commented on Jul 26, 2018

    @nikomatsakis
    ContributorAuthor

    I'm working on this. It's non-trivial.

  10. nikomatsakis commented on Jul 26, 2018

    @nikomatsakis
    ContributorAuthor

    But I'm getting there =)

  11. self-assigned this
    on Jul 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️NLL-completeWorking towards the "valid code works" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions