Skip to content

Commit 837fe7b

Browse files
committed
Regression test.
1 parent 50840ee commit 837fe7b

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
trait T0<'a, A> {
2+
type O;
3+
}
4+
5+
struct L<T> {
6+
f: T,
7+
}
8+
9+
// explicitly named variants of what one would normally denote by the
10+
// unit type `()`. Why do this? So that we can differentiate them in
11+
// the diagnostic output.
12+
struct Unit1;
13+
struct Unit2;
14+
struct Unit3;
15+
struct Unit4;
16+
17+
impl<'a, A, T> T0<'a, A> for L<T>
18+
where
19+
T: FnMut(A) -> Unit3,
20+
{
21+
type O = T::Output;
22+
}
23+
24+
trait T1: for<'r> Ty<'r> {
25+
fn m<'a, B: Ty<'a>, F>(&self, f: F) -> Unit1
26+
where
27+
F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
28+
{
29+
unimplemented!();
30+
}
31+
}
32+
33+
trait Ty<'a> {
34+
type V;
35+
}
36+
37+
fn main() {
38+
let v = Unit2.m(
39+
//~^ ERROR type mismatch
40+
//~| ERROR type mismatch
41+
L {
42+
f : |x| { drop(x); Unit4 }
43+
});
44+
}
45+
46+
impl<'a> Ty<'a> for Unit2 {
47+
type V = &'a u8;
48+
}
49+
50+
impl T1 for Unit2 {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]> as T0<'r, (<Unit2 as Ty<'r>>::V,)>>::O == <_ as Ty<'r>>::V`
2+
--> $DIR/issue-62203-hrtb-ice.rs:38:19
3+
|
4+
LL | let v = Unit2.m(
5+
| ^ expected struct `Unit4`, found associated type
6+
|
7+
= note: expected type `Unit4`
8+
found type `<_ as Ty<'_>>::V`
9+
10+
error[E0271]: type mismatch resolving `<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39] as std::ops::FnOnce<((&u8,),)>>::Output == Unit3`
11+
--> $DIR/issue-62203-hrtb-ice.rs:38:19
12+
|
13+
LL | let v = Unit2.m(
14+
| ^ expected struct `Unit4`, found struct `Unit3`
15+
|
16+
= note: expected type `Unit4`
17+
found type `Unit3`
18+
= note: required because of the requirements on the impl of `for<'r> T0<'r, (<Unit2 as Ty<'r>>::V,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:39]>`
19+
20+
error: aborting due to 2 previous errors
21+
22+
For more information about this error, try `rustc --explain E0271`.

0 commit comments

Comments
 (0)