Skip to content

Commit 57feb7f

Browse files
committed
old testcase output
1 parent 3507a74 commit 57feb7f

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ run-rustfix
2+
3+
use std::fmt::Display;
4+
5+
struct S;
6+
7+
impl S {
8+
fn call(&self, _: impl Display) {}
9+
}
10+
11+
fn main() {
12+
S.call(|| "hello"()); //~ ERROR [E0277]
13+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//@ run-rustfix
2+
3+
use std::fmt::Display;
4+
5+
struct S;
6+
7+
impl S {
8+
fn call(&self, _: impl Display) {}
9+
}
10+
11+
fn main() {
12+
S.call(|| "hello"); //~ ERROR [E0277]
13+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
error[E0277]: `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}` doesn't implement `std::fmt::Display`
2+
--> $DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12
3+
|
4+
LL | S.call(|| "hello");
5+
| ---- ^^^^^^^^^^ unsatisfied trait bound
6+
| |
7+
| required by a bound introduced by this call
8+
|
9+
= help: the trait `std::fmt::Display` is not implemented for closure `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}`
10+
note: required by a bound in `S::call`
11+
--> $DIR/use-parentheses-to-call-closure-issue-145404.rs:8:28
12+
|
13+
LL | fn call(&self, _: impl Display) {}
14+
| ^^^^^^^ required by this bound in `S::call`
15+
help: use parentheses to call this closure
16+
|
17+
LL | S.call(|| "hello"());
18+
| ++
19+
20+
error: aborting due to 1 previous error
21+
22+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)