about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-15 12:46:01 +0100
committerGitHub <noreply@github.com>2022-12-15 12:46:01 +0100
commita2c9f2a5e02b36c177e183e3d0a63a2722c3aef0 (patch)
treec55b0ab71fcb9651355c2a6cfdbb6d1d65ee58e3 /src
parent5d24760245567ccf9f938a063c2f13ea527bef9c (diff)
parentcfa6a93a36d3cbb8e392f5d820e9e139f66c8a5a (diff)
downloadrust-a2c9f2a5e02b36c177e183e3d0a63a2722c3aef0.tar.gz
rust-a2c9f2a5e02b36c177e183e3d0a63a2722c3aef0.zip
Rollup merge of #105627 - compiler-errors:dyn-auto-suggestable, r=davidtwco
Auto traits in `dyn Trait + Auto` are suggestable

Not  sure why I had made the `IsSuggestableVisitor` have that rule to not consider `dyn Trait + Auto` to be suggestable.

It's possible that this was done because of the fact that we don't print the right parentheses for `&(dyn Trait + Auto)`, but that's a problem with printing these types in general that we probably have tracked somewhere else...
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/argument-suggestions/display-is-suggestable.rs8
-rw-r--r--src/test/ui/argument-suggestions/display-is-suggestable.stderr19
2 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/argument-suggestions/display-is-suggestable.rs b/src/test/ui/argument-suggestions/display-is-suggestable.rs
new file mode 100644
index 00000000000..d765bc4f74d
--- /dev/null
+++ b/src/test/ui/argument-suggestions/display-is-suggestable.rs
@@ -0,0 +1,8 @@
+use std::fmt::Display;
+
+fn foo(x: &(dyn Display + Send)) {}
+
+fn main() {
+    foo();
+    //~^ ERROR this function takes 1 argument but 0 arguments were supplied
+}
diff --git a/src/test/ui/argument-suggestions/display-is-suggestable.stderr b/src/test/ui/argument-suggestions/display-is-suggestable.stderr
new file mode 100644
index 00000000000..edd72b53eb3
--- /dev/null
+++ b/src/test/ui/argument-suggestions/display-is-suggestable.stderr
@@ -0,0 +1,19 @@
+error[E0061]: this function takes 1 argument but 0 arguments were supplied
+  --> $DIR/display-is-suggestable.rs:6:5
+   |
+LL |     foo();
+   |     ^^^-- an argument of type `&dyn std::fmt::Display + Send` is missing
+   |
+note: function defined here
+  --> $DIR/display-is-suggestable.rs:3:4
+   |
+LL | fn foo(x: &(dyn Display + Send)) {}
+   |    ^^^ ------------------------
+help: provide the argument
+   |
+LL |     foo(/* &dyn std::fmt::Display + Send */);
+   |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0061`.