Skip to content

Commit 44174c3

Browse files
committed
Fix test case and issue number
1 parent f86c44f commit 44174c3

File tree

4 files changed

+30
-60
lines changed

4 files changed

+30
-60
lines changed

src/test/ui/unboxed-closures/issue-30904.rs

-36
This file was deleted.

src/test/ui/unboxed-closures/issue-30904.stderr

-24
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![feature(fn_traits, unboxed_closures)]
2+
3+
fn test<F: for<'x> FnOnce<(&'x str,)>>(_: F) {}
4+
5+
struct Compose<F,G>(F,G);
6+
impl<T,F,G> FnOnce<(T,)> for Compose<F,G>
7+
where F: FnOnce<(T,)>, G: FnOnce<(F::Output,)> {
8+
type Output = G::Output;
9+
extern "rust-call" fn call_once(self, (x,): (T,)) -> G::Output {
10+
(self.1)((self.0)(x))
11+
}
12+
}
13+
14+
fn bad<T>(f: fn(&'static str) -> T) {
15+
test(Compose(f, |_| {})); //~ ERROR: mismatched types
16+
}
17+
18+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/issue-30906.rs:15:5
3+
|
4+
LL | test(Compose(f, |_| {}));
5+
| ^^^^ one type is more general than the other
6+
|
7+
= note: expected type `std::ops::FnOnce<(&'x str,)>`
8+
found type `std::ops::FnOnce<(&str,)>`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)