Skip to content

Stall from overflow caused by for<'a> F: FnOnce(Self::Gat<'a>) #87758

Open
@hlb8122

Description

@hlb8122

I tried this code:

#![feature(generic_associated_types)]

pub struct Structure<F> {
    f: F,
}

pub trait Trait {
    type Gat<'a>;
}

impl<F> Trait for Structure<F>
where
    for<'a> F: FnOnce(Self::Gat<'a>),
{
    type Gat<'a> = String;
}

https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=fbd726c1f1bd90e514358a91016581ec

Given that
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=f889ed7bfeffb6a6f3179bf6d94f438c
causes an overflow evaluating the requirement Structure<F>: Trait I would expect the problem code to give a similar message.

Instead, rustc stalls indefinitely.

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (a6ece5615 2021-08-03)
Backtrace

No backtrace produced due to stall.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-GATsArea: Generic associated types (GATs)GATs-triagedIssues using the `generic_associated_types` feature that have been triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions