Closed
Description
To reproduce:
- Clone
serde
. - Run
cargo +nightly fix --edition
(this updatesserde
from Rust 2015 to Rust 2018). - Add the edition field to the Cargo.toml with "2018" and commit changes.
- Run
cargo +nightly fix --edition
(this updatesserde
from Rust 2018 to Rust 2021). - Change the edition field to "2021" (ensure
cargo-features = ["edition2021"]
is present at the top of the Cargo.toml file)
This produces an error because some uses of bare trait objects were not updated:
error[E0782]: trait objects must include the `dyn` keyword
--> serde/src/private/de.rs:1725:37
|
1725 | fn invalid_type(self, exp: &Expected) -> E {
| ^^^^^^^^
|
help: add `dyn` keyword before this trait
Running cargo +nightly rustc -- -Zunstable-options --force-warns rust_2021_compatibility
produces the proper warnings, but these are not picked up by cargo fix.
warning: trait objects without an explicit `dyn` are deprecated
--> serde/src/private/de.rs:1725:37
|
1725 | fn invalid_type(self, exp: &Expected) -> E {
| ^^^^^^^^ help: use `dyn`: `dyn Expected`
|
= warning: this is accepted in the current edition (Rust 2018) but is a hard error in Rust 2021!
= note: for more information, see issue #80165 <https://github.com/rust-lang/rust/issues/80165>
I'm filing this in rust-lang/rust instead of in rust-lang/cargo, because I have a feeling this is a rustc issue.
Meta
rustc +nightly --version --verbose
:
rustc 1.55.0-nightly (6d820866a 2021-06-29)
binary: rustc
commit-hash: 6d820866a27b1949e237be79b9c8c0145fe728b7
commit-date: 2021-06-29
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1