Skip to content

impl Trait ICE returning a recursive type #36792

@durka

Description

@durka
Contributor

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

Activity

aturon

aturon commented on Sep 27, 2016

@aturon
Member
eddyb

eddyb commented on Sep 27, 2016

@eddyb
Member

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

changed the title [-]`impl Trait` ICE returning a function[/-] [+]`impl Trait` ICE returning a recursive type[/+] on Sep 28, 2016
added
I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
on Sep 29, 2016
topecongiro

topecongiro commented on Dec 27, 2017

@topecongiro
Contributor

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

added a commit that references this issue on Jan 11, 2018
9649c4a
added 4 commits that reference this issue on Jan 11, 2018
4551f3a
5bd7d69
f589482
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

    C-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @durka@eddyb@Aatch@aturon@Mark-Simulacrum

        Issue actions

          `impl Trait` ICE returning a recursive type · Issue #36792 · rust-lang/rust