Skip to content

Commit fa4f18b

Browse files
committed
Add test for issue 30472
1 parent b27c22d commit fa4f18b

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
//@ check-pass
2+
//! Tests that associated type projections normalize properly in the presence of HRTBs.
3+
//! Original issue: <https://github.com/rust-lang/rust/issues/30472>
4+
5+
6+
pub trait MyFrom<T> {}
7+
impl<T> MyFrom<T> for T {}
8+
9+
pub trait MyInto<T> {}
10+
impl<T, U> MyInto<U> for T where U: MyFrom<T> {}
11+
12+
13+
pub trait A<'self_> {
14+
type T;
15+
}
16+
pub trait B: for<'self_> A<'self_> {
17+
// Originally caused the `type U = usize` example below to fail with a type mismatch error
18+
type U: for<'self_> MyFrom<<Self as A<'self_>>::T>;
19+
}
20+
21+
22+
pub struct M;
23+
impl<'self_> A<'self_> for M {
24+
type T = usize;
25+
}
26+
27+
impl B for M {
28+
type U = usize;
29+
}
30+
31+
32+
fn main() {}

0 commit comments

Comments
 (0)