Skip to content

Rustc overflow its stack when using impl Trait and the struct containing the function itself #69096

Description

@lszxb

I tried this code:

fn main() {
    test();
}

fn test() -> impl P {
    Lazy { f: test }
}

trait P {}

struct Lazy<F> {
    f: F
}

impl<F> P for Lazy<F> {}

Then I got thread 'rustc' has overflowed its stack.

Meta

rustc --version --verbose:

rustc 1.43.0-nightly (07a34df18 2020-02-08)
binary: rustc
commit-hash: 07a34df18b437319a7ff510077bbab95cf7ec6bc
commit-date: 2020-02-08
host: x86_64-pc-windows-gnu
release: 1.43.0-nightly
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-impl-traitArea: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions