about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMu001999 <mu001999@outlook.com>2025-08-16 15:01:17 +0800
committerMu001999 <mu001999@outlook.com>2025-08-16 15:01:17 +0800
commit57feb7fc018cd91cc89b7777184cbafc548367b0 (patch)
treeff9a54eec4fc4fecaf4e04ebe14b8ed9169cf3bc
parent3507a749b365aae4eefa96ab700a9315d3280ee7 (diff)
downloadrust-57feb7fc018cd91cc89b7777184cbafc548367b0.tar.gz
rust-57feb7fc018cd91cc89b7777184cbafc548367b0.zip
old testcase output
-rw-r--r--tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed13
-rw-r--r--tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs13
-rw-r--r--tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr22
3 files changed, 48 insertions, 0 deletions
diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed
new file mode 100644
index 00000000000..4d29b9b0b1a
--- /dev/null
+++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.fixed
@@ -0,0 +1,13 @@
+//@ run-rustfix
+
+use std::fmt::Display;
+
+struct S;
+
+impl S {
+    fn call(&self, _: impl Display) {}
+}
+
+fn main() {
+    S.call(|| "hello"()); //~ ERROR [E0277]
+}
diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs
new file mode 100644
index 00000000000..848629a6700
--- /dev/null
+++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.rs
@@ -0,0 +1,13 @@
+//@ run-rustfix
+
+use std::fmt::Display;
+
+struct S;
+
+impl S {
+    fn call(&self, _: impl Display) {}
+}
+
+fn main() {
+    S.call(|| "hello"); //~ ERROR [E0277]
+}
diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr
new file mode 100644
index 00000000000..ee51dbca804
--- /dev/null
+++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr
@@ -0,0 +1,22 @@
+error[E0277]: `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}` doesn't implement `std::fmt::Display`
+  --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12
+   |
+LL |     S.call(|| "hello");
+   |       ---- ^^^^^^^^^^ unsatisfied trait bound
+   |       |
+   |       required by a bound introduced by this call
+   |
+   = 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}`
+note: required by a bound in `S::call`
+  --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:8:28
+   |
+LL |     fn call(&self, _: impl Display) {}
+   |                            ^^^^^^^ required by this bound in `S::call`
+help: use parentheses to call this closure
+   |
+LL |     S.call(|| "hello"());
+   |                      ++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.