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

rustc hangs/spins on example involving associated types #63650

Open
cdisselkoen opened this issue Aug 17, 2019 · 2 comments
Open

rustc hangs/spins on example involving associated types #63650

cdisselkoen opened this issue Aug 17, 2019 · 2 comments
Labels
A-associated-items Area: Associated items (types, constants & functions) A-trait-system Area: Trait system C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@cdisselkoen
Copy link

cdisselkoen commented Aug 17, 2019

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.

@Centril Centril added I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-trait-system Area: Trait system labels Aug 17, 2019
@Centril
Copy link
Contributor

Centril commented Aug 17, 2019

Reduced:

struct Chicken<'a, T> where T: Trait { f: &'a Frog<'a, T::Item> }

struct Frog<'a, T> where T: Trait  { f: &'a Chicken<'a, T> }

trait Trait {
    type Item;
}

cc @nagisa

@jonas-schievink jonas-schievink added A-associated-items Area: Associated items (types, constants & functions) C-bug Category: This is a bug. labels Aug 17, 2019
@estebank
Copy link
Contributor

Triage, no change. It seems like we get stuck evaluating the following over and over again:

├─  7s  DEBUG rustc_infer::infer::outlives::components components(Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [T/#1], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })) = [Alias(AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [Alias(Projection, AliasTy { args: [T/#1], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })], def_id: DefId(0:12 ~ f79[dbd1]::Trait::Item) })]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items (types, constants & functions) A-trait-system Area: Trait system C-bug Category: This is a bug. I-hang Issue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants