Skip to content

NLL type-checking ICEs on closure recursing on impl Trait-returning enclosing function. #54593

Description

@eddyb

This compiles as expected:

#![feature(nll)]
fn foo() -> impl Copy { || bar(); }
fn bar() -> impl Copy { || foo(); }

This, however, does not, since today (suspecting it's #53542):

#![feature(nll)]
fn foo() -> impl Copy { || foo(); }
fn bar() -> impl Copy { || bar(); }

Each inner closure, because it calls its parent function, causes this ICE: "equate_inputs_and_outputs: impl std::marker::Copy==impl std::marker::Copy failed with NoSolution".
(you only need one of foo or bar, but I left both in for contrast with the first example)

I suspect each impl Copy is instantiated in two different ways, causing inconsistencies.

Originally found through a daily Travis CI build job.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)A-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions