Skip to content

Commit 642ee70

Browse files
committedAug 8, 2019
Add test for issue-43623
1 parent 2d1a551 commit 642ee70

File tree

2 files changed

+61
-0
lines changed

2 files changed

+61
-0
lines changed
 

‎src/test/ui/issues/issue-43623.rs

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
pub trait Trait<'a> {
2+
type Assoc;
3+
}
4+
5+
pub struct Type;
6+
7+
impl<'a> Trait<'a> for Type {
8+
type Assoc = ();
9+
}
10+
11+
pub fn break_me<T, F>(f: F)
12+
where T: for<'b> Trait<'b>,
13+
F: for<'b> FnMut(<T as Trait<'b>>::Assoc) {
14+
break_me::<Type, fn(_)>;
15+
//~^ ERROR: type mismatch in function arguments
16+
//~| ERROR: type mismatch resolving
17+
}
18+
19+
fn main() {}

‎src/test/ui/issues/issue-43623.stderr

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
error[E0631]: type mismatch in function arguments
2+
--> $DIR/issue-43623.rs:14:5
3+
|
4+
LL | break_me::<Type, fn(_)>;
5+
| ^^^^^^^^^^^^^^^^^^^^^^^
6+
| |
7+
| expected signature of `for<'b> fn(<Type as Trait<'b>>::Assoc) -> _`
8+
| found signature of `fn(_) -> _`
9+
|
10+
note: required by `break_me`
11+
--> $DIR/issue-43623.rs:11:1
12+
|
13+
LL | / pub fn break_me<T, F>(f: F)
14+
LL | | where T: for<'b> Trait<'b>,
15+
LL | | F: for<'b> FnMut(<T as Trait<'b>>::Assoc) {
16+
LL | | break_me::<Type, fn(_)>;
17+
LL | |
18+
LL | |
19+
LL | | }
20+
| |_^
21+
22+
error[E0271]: type mismatch resolving `for<'b> <fn(_) as std::ops::FnOnce<(<Type as Trait<'b>>::Assoc,)>>::Output == ()`
23+
--> $DIR/issue-43623.rs:14:5
24+
|
25+
LL | break_me::<Type, fn(_)>;
26+
| ^^^^^^^^^^^^^^^^^^^^^^^ expected bound lifetime parameter 'b, found concrete lifetime
27+
|
28+
note: required by `break_me`
29+
--> $DIR/issue-43623.rs:11:1
30+
|
31+
LL | / pub fn break_me<T, F>(f: F)
32+
LL | | where T: for<'b> Trait<'b>,
33+
LL | | F: for<'b> FnMut(<T as Trait<'b>>::Assoc) {
34+
LL | | break_me::<Type, fn(_)>;
35+
LL | |
36+
LL | |
37+
LL | | }
38+
| |_^
39+
40+
error: aborting due to 2 previous errors
41+
42+
For more information about this error, try `rustc --explain E0271`.

0 commit comments

Comments
 (0)