Skip to content

higher-ranked opaque type goals are scuffed #242

@lcnr

Description

@lcnr
#![feature(type_alias_impl_trait)]
type Tait<'a> = impl Sized;

fn prove()
where
    for<'a> Tait<'a>: Sized,
{}

#[define_opaque(Tait)]
fn foo<'a>() -> &'a Tait<'a> {
    prove();
    &()
}
fn main() {}

results in

error: internal compiler error: unexpected cyclic definition of `Tait::{opaque#0}`
  --> src/main.rs:11:5
   |
11 |     prove();
   |     ^^^^^^^
   |
note: delayed at compiler/rustc_hir_typeck/src/opaque_types.rs:239:24 - disabled backtrace
  --> src/main.rs:11:5
   |
11 |     prove();
   |     ^^^^^^^

it shouldn't xd

The issue is that each time we prove for<'a> Tait<'a>: Sized we add a new use of Tait<!aN> to the opaque types storage, cc #204 and #220

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    potentially irrelevant

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions