Skip to content

Commit f536a06

Browse files
committed
add test for ice expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.stderr
Fixes #113776
1 parent 27338f2 commit f536a06

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// issue: rust-lang/rust#113776
2+
// ice: expected type of closure body to be a closure or coroutine
3+
//@ edition: 2021
4+
#![allow(incomplete_features)]
5+
#![feature(generic_const_exprs)]
6+
7+
use core::ops::SubAssign;
8+
9+
fn f<T>(
10+
data: &[(); {
11+
let f: F = async { 1 };
12+
//~^ ERROR cannot find type `F` in this scope
13+
14+
1
15+
}],
16+
) -> impl Iterator<Item = SubAssign> {
17+
//~^ ERROR the type parameter `Rhs` must be explicitly specified
18+
//~| ERROR `()` is not an iterator
19+
//~| ERROR trait objects must include the `dyn` keyword
20+
//~| ERROR the type parameter `Rhs` must be explicitly specified [E0393]
21+
}
22+
23+
pub fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
error[E0412]: cannot find type `F` in this scope
2+
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:11:17
3+
|
4+
LL | let f: F = async { 1 };
5+
| ^
6+
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
7+
|
8+
= note: similarly named trait `Fn` defined here
9+
|
10+
help: a trait with a similar name exists
11+
|
12+
LL | let f: Fn = async { 1 };
13+
| ~~
14+
help: you might be missing a type parameter
15+
|
16+
LL | fn f<T, F>(
17+
| +++
18+
19+
error[E0393]: the type parameter `Rhs` must be explicitly specified
20+
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
21+
|
22+
LL | ) -> impl Iterator<Item = SubAssign> {
23+
| ^^^^^^^^^ help: set the type parameter to the desired type: `SubAssign<Rhs>`
24+
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
25+
|
26+
= note: type parameter `Rhs` must be specified for this
27+
|
28+
= note: because of the default `Self` reference, type parameters must be specified on object types
29+
30+
error[E0393]: the type parameter `Rhs` must be explicitly specified
31+
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
32+
|
33+
LL | ) -> impl Iterator<Item = SubAssign> {
34+
| ^^^^^^^^^ help: set the type parameter to the desired type: `SubAssign<Rhs>`
35+
--> $SRC_DIR/core/src/ops/arith.rs:LL:COL
36+
|
37+
= note: type parameter `Rhs` must be specified for this
38+
|
39+
= note: because of the default `Self` reference, type parameters must be specified on object types
40+
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
41+
42+
error[E0277]: `()` is not an iterator
43+
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:6
44+
|
45+
LL | ) -> impl Iterator<Item = SubAssign> {
46+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `()` is not an iterator
47+
|
48+
= help: the trait `Iterator` is not implemented for `()`
49+
50+
error[E0782]: trait objects must include the `dyn` keyword
51+
--> $DIR/expected-type-of-closure-body-to-be-a-closure-or-coroutine-ice-113776.rs:16:27
52+
|
53+
LL | ) -> impl Iterator<Item = SubAssign> {
54+
| ^^^^^^^^^
55+
|
56+
help: add `dyn` keyword before this trait
57+
|
58+
LL | ) -> impl Iterator<Item = dyn SubAssign> {
59+
| +++
60+
help: you might have meant to write a bound here
61+
|
62+
LL | ) -> impl Iterator<Item: SubAssign> {
63+
| ~
64+
65+
error: aborting due to 5 previous errors
66+
67+
Some errors have detailed explanations: E0277, E0393, E0412, E0782.
68+
For more information about an error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)