Skip to content

Commit f5f11e1

Browse files
committed
Add regression test
1 parent 6cbf092 commit f5f11e1

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
//! This test demonstrates a bug where we accidentally
2+
//! detected opaque types in struct fields, but only if nested
3+
//! in projections of another opaque type.
4+
//@ check-pass
5+
6+
#![feature(impl_trait_in_assoc_type)]
7+
8+
struct Bar;
9+
10+
trait Trait: Sized {
11+
type Assoc2;
12+
type Assoc;
13+
fn foo() -> Self::Assoc;
14+
}
15+
16+
impl Trait for Bar {
17+
type Assoc2 = impl std::fmt::Debug;
18+
type Assoc = impl Iterator<Item = Foo>;
19+
fn foo() -> Self::Assoc {
20+
vec![Foo { field: () }].into_iter()
21+
}
22+
}
23+
24+
struct Foo {
25+
field: <Bar as Trait>::Assoc2,
26+
}
27+
28+
fn main() {}

0 commit comments

Comments
 (0)