Add regression test

This commit is contained in:
Oli Scherer 2024-03-01 08:47:31 +00:00
parent 6cbf0926d5
commit f5f11e1197

View File

@ -0,0 +1,28 @@
//! This test demonstrates a bug where we accidentally
//! detected opaque types in struct fields, but only if nested
//! in projections of another opaque type.
//@ check-pass
#![feature(impl_trait_in_assoc_type)]
struct Bar;
trait Trait: Sized {
type Assoc2;
type Assoc;
fn foo() -> Self::Assoc;
}
impl Trait for Bar {
type Assoc2 = impl std::fmt::Debug;
type Assoc = impl Iterator<Item = Foo>;
fn foo() -> Self::Assoc {
vec![Foo { field: () }].into_iter()
}
}
struct Foo {
field: <Bar as Trait>::Assoc2,
}
fn main() {}