Skip to content

rustc hangs/spins on example involving associated types #63650

Open
@cdisselkoen

Description

@cdisselkoen

The following 5-line example causes rustc to spin:

pub struct Chicken<'a, T: Trait>(&'a Frog<'a, T::Item>);

pub struct Frog<'a, T: Trait>(&'a Chicken<'a, T>);

pub trait Trait {
    type Item;
}

The spin happens with or without the --edition=2018 flag.

This may be the same issue as #62430, just an even simpler reproduction case.

Output of rustc --version --verbose:

rustc 1.36.0 (a53f9df32 2019-07-03)
binary: rustc
commit-hash: a53f9df32fbb0b5f4382caaad8f1a46f36ea887c
commit-date: 2019-07-03
host: x86_64-apple-darwin
release: 1.36.0
LLVM version: 8.0

Using the Playground, I also reproduced the issue with stable Rust 1.37.0, beta Rust 1.38.0-beta.1, and nightly Rust 1.39.0 2019-08-15.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-associated-itemsArea: Associated items (types, constants & functions)A-trait-systemArea: Trait systemC-bugCategory: This is a bug.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.T-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