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

impl Trait ICE returning a recursive type #36792

Closed
durka opened this issue Sep 27, 2016 · 3 comments
Closed

impl Trait ICE returning a recursive type #36792

durka opened this issue Sep 27, 2016 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@durka
Copy link
Contributor

durka commented Sep 27, 2016

We were trying to make a function that returns itself.

#![feature(conservative_impl_trait)]
fn foo() -> impl Copy {
    foo
}

rustc overflows its stack.

cc @aturon

@aturon
Copy link
Member

aturon commented Sep 27, 2016

cc @eddyb

@eddyb
Copy link
Member

eddyb commented Sep 27, 2016

Well, you've sort of succeeded: what trans sees is fn foo() -> typeof foo (an infinitely recursive type).

However, I would've expected traits::project to catch this via the recursion limit, as the backtrace repeats traits::project::AssociatedTypeNormalizer::fold_ty. cc @nikomatsakis

@durka durka changed the title impl Trait ICE returning a function impl Trait ICE returning a recursive type Sep 28, 2016
@Aatch Aatch added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 29, 2016
@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 22, 2017
@topecongiro
Copy link
Contributor

rustc does not overflow its stack on rustc 1.24.0-nightly (cddc4a62d 2017-12-26).

topecongiro added a commit to topecongiro/rust that referenced this issue Jan 11, 2018
kennytm added a commit to kennytm/rust that referenced this issue Jan 11, 2018
kennytm added a commit to kennytm/rust that referenced this issue Jan 11, 2018
kennytm added a commit to kennytm/rust that referenced this issue Jan 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants