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

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

Closed
eddyb opened this Issue Sep 26, 2018 · 0 comments

Comments

Projects
None yet
2 participants
@eddyb
Copy link
Member

eddyb commented Sep 26, 2018

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.

@eddyb eddyb changed the title NLL type-checking fails on closure recursing on impl Trait-returning enclosing function. NLL type-checking ICEs on closure recursing on impl Trait-returning enclosing function. Sep 26, 2018

@nikomatsakis nikomatsakis added this to the Edition 2018 RC 2 milestone Sep 26, 2018

bors added a commit that referenced this issue Sep 28, 2018

Auto merge of #54599 - nikomatsakis:issue-54593-impl-Trait, r=eddyb
use closure def-id in returns, but base def-id in locals

The refactorings to  handle `let x: impl Trait`  wound up breaking `impl Trait` in closure return types. I think there are some deeper problems with the code in question, but this a least should make @eddyb's example work.

Fixes #54593

r? @eddyb

bors added a commit that referenced this issue Sep 29, 2018

Auto merge of #54599 - nikomatsakis:issue-54593-impl-Trait, r=eddyb
use closure def-id in returns, but base def-id in locals

The refactorings to  handle `let x: impl Trait`  wound up breaking `impl Trait` in closure return types. I think there are some deeper problems with the code in question, but this a least should make @eddyb's example work.

Fixes #54593

r? @eddyb

@bors bors closed this in #54599 Sep 29, 2018

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