rust-lang/rust

TAIT crash: stack overflow in `check_for_opaque_ty`

Closed this issue · 0 comments

Found by mutating src/test/ui/lint/lint-ctypes-73251-2.rs with a modified fuzz-rustc

Code

Compared to the original test, this modifies the definition of AliasB by removing <Assoc = AliasA>.

#![feature(type_alias_impl_trait)]

pub trait TraitA {
    type Assoc;
}

impl TraitA for u32 {
    type Assoc = u32;
}

pub trait TraitB {
    type Assoc;
}

impl<T> TraitB for T
where
    T: TraitA,
{
    type Assoc = <T as TraitA>::Assoc;
}

type AliasA = impl TraitA<Assoc = u32>;

type AliasB = impl TraitB;

fn use_of_a() -> AliasA {
    3
}

fn use_of_b() -> AliasB {
    3
}

extern "C" {
    fn lint_me() -> <AliasB as TraitB>::Assoc;
}

fn main() {}

Regression

Regression in nightly-2020-06-22, presumably due to the same PR that added the mutated test: #73287 (@davidtwco)

Version

rustc 1.67.0-nightly (e75aab045 2022-11-09)
binary: rustc
commit-hash: e75aab045fc476f176a58c408f6b06f0e275c6e1
commit-date: 2022-11-09
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4

@rustbot label +I-crash +T-compiler +F-type_alias_impl_trait