Skip to content

Commit c54d4fe

Browse files
committed
Test ui suggestion fn trait notation
1 parent 5a813b6 commit c54d4fe

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// run-rustfix
2+
fn e0658<F, G, H>(f: F, g: G, h: H) -> i32
3+
where
4+
F: Fn(i32) -> i32, //~ ERROR E0658
5+
G: Fn(i32, i32) -> (i32, i32), //~ ERROR E0658
6+
H: Fn(i32) -> i32, //~ ERROR E0658
7+
{
8+
f(3);
9+
g(3, 4);
10+
h(3)
11+
}
12+
13+
fn main() {
14+
e0658(
15+
|a| a,
16+
|a, b| (b, a),
17+
|a| a,
18+
);
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// run-rustfix
2+
fn e0658<F, G, H>(f: F, g: G, h: H) -> i32
3+
where
4+
F: Fn<i32, Output = i32>, //~ ERROR E0658
5+
G: Fn<(i32, i32, ), Output = (i32, i32)>, //~ ERROR E0658
6+
H: Fn<(i32,), Output = i32>, //~ ERROR E0658
7+
{
8+
f(3);
9+
g(3, 4);
10+
h(3)
11+
}
12+
13+
fn main() {
14+
e0658(
15+
|a| a,
16+
|a, b| (b, a),
17+
|a| a,
18+
);
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
2+
--> $DIR/fn-trait-notation.rs:4:8
3+
|
4+
LL | F: Fn<i32, Output = i32>,
5+
| ^^^^^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(i32) -> i32`
6+
|
7+
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
8+
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
9+
10+
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
11+
--> $DIR/fn-trait-notation.rs:5:8
12+
|
13+
LL | G: Fn<(i32, i32, ), Output = (i32, i32)>,
14+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(i32, i32) -> (i32, i32)`
15+
|
16+
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
17+
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
18+
19+
error[E0658]: the precise format of `Fn`-family traits' type parameters is subject to change
20+
--> $DIR/fn-trait-notation.rs:6:8
21+
|
22+
LL | H: Fn<(i32,), Output = i32>,
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: use parenthetical notation instead: `Fn(i32) -> i32`
24+
|
25+
= note: see issue #29625 <https://github.com/rust-lang/rust/issues/29625> for more information
26+
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
27+
28+
error: aborting due to 3 previous errors
29+
30+
For more information about this error, try `rustc --explain E0658`.

0 commit comments

Comments
 (0)