You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Failure to update dyn usage in Rust 2018 to 2021 transition #86751
Run cargo +nightly fix --edition (this updates serde 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 updates serde 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.
For reference, the cause is that cargo is using --force-warns=rust-2021-compatibility and --cap-lints=warn, and serde uses #![allow(bare_trait_objects)] and the interaction seems to be broken by #86009.
Activity
ehuss commentedon Jun 30, 2021
For reference, the cause is that cargo is using
--force-warns=rust-2021-compatibilityand--cap-lints=warn, and serde uses#![allow(bare_trait_objects)]and the interaction seems to be broken by #86009.Auto merge of rust-lang#86572 - rylev:force-warnings-always, r=nikoma…