diff options
| author | Mara Bos <m-ou.se@m-ou.se> | 2021-09-05 10:32:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-09-05 10:32:24 +0200 |
| commit | b4d06bfa8f7c3a836fb124307bdd3ec5007fac73 (patch) | |
| tree | bf8ed52aa1f3310e6be200e545f9913b7c555f2d /src | |
| parent | 5fdc8eb2e8ea8b54fbd83b291ab0db8d0a573a82 (diff) | |
| parent | 486d79f1243135564931c574ce5cfff946ee3867 (diff) | |
| download | rust-b4d06bfa8f7c3a836fb124307bdd3ec5007fac73.tar.gz rust-b4d06bfa8f7c3a836fb124307bdd3ec5007fac73.zip | |
Rollup merge of #88657 - camelid:fix-dyn-sugg, r=m-ou-se
Fix 2021 `dyn` suggestion that used code as label
The arguments to `span_suggestion` were in the wrong order, so the error
looked like this:
error[E0783]: trait objects without an explicit `dyn` are deprecated
--> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5
|
10 | Foo::hi(123);
| ^^^ help: <dyn Foo>: `use `dyn``
Now the error looks like this, as expected:
error[E0783]: trait objects without an explicit `dyn` are deprecated
--> src/test/ui/editions/dyn-trait-sugg-2021.rs:10:5
|
10 | Foo::hi(123);
| ^^^ help: use `dyn`: `<dyn Foo>`
This issue was only present in the 2021 error; the 2018 lint was
correct.
r? `@m-ou-se`
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/editions/dyn-trait-sugg-2021.rs | 12 | ||||
| -rw-r--r-- | src/test/ui/editions/dyn-trait-sugg-2021.stderr | 9 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/editions/dyn-trait-sugg-2021.rs b/src/test/ui/editions/dyn-trait-sugg-2021.rs new file mode 100644 index 00000000000..47c48e7ec9e --- /dev/null +++ b/src/test/ui/editions/dyn-trait-sugg-2021.rs @@ -0,0 +1,12 @@ +// edition:2021 + +trait Foo<T> {} + +impl<T> dyn Foo<T> { + fn hi(_x: T) {} +} + +fn main() { + Foo::hi(123); + //~^ ERROR trait objects without an explicit `dyn` are deprecated +} diff --git a/src/test/ui/editions/dyn-trait-sugg-2021.stderr b/src/test/ui/editions/dyn-trait-sugg-2021.stderr new file mode 100644 index 00000000000..f6e9fa96a15 --- /dev/null +++ b/src/test/ui/editions/dyn-trait-sugg-2021.stderr @@ -0,0 +1,9 @@ +error[E0783]: trait objects without an explicit `dyn` are deprecated + --> $DIR/dyn-trait-sugg-2021.rs:10:5 + | +LL | Foo::hi(123); + | ^^^ help: use `dyn`: `<dyn Foo>` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0783`. |
