Skip to content

ICE: Rust spins when referencing associated types in where clause #62430

Closed
@andymac-2

Description

@andymac-2

The following code broke the the text editor I was editing it in:

Version

rustc 1.35.0 (3c235d5 2019-05-20)

Minimal test case:

struct MyStruct<'a, 'b, A, B, F>(F, &'a A, &'b B);

trait MyTrait {
    type Input;
    type Output;
}

trait MyOtherTrait<A, B> {};

impl<'a, 'b, A, B, F> MyTrait for MyStruct<'a, 'b, A, B, F> where
    F: MyOtherTrait<Self::Input, Self::Output>
{
    type Input = A;
    type Output = B;
}

fn garbage () {
    This function body can contain garbage.

    We can put anything here as long as we don't write a close brace
    and the program will still try to compile.

    ((((((( [[[[[[[[ {{{{{
}

Output:

rustc will print any errors that occur, but will still try to compile, hanging indefinitely at the build stage and consuming all system memory.

Expected output:

Compilation failure.

Metadata

Metadata

Assignees

Labels

A-parserArea: The lexing & parsing of Rust source code to an ASTC-bugCategory: This is a bug.I-compilememIssue: Problems and improvements with respect to memory usage during compilation.I-hangIssue: The compiler never terminates, due to infinite loops, deadlock, livelock, etc.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions