Description
Currently, every module has something like use std::prelude::v1::*;
implicitly inserted into it by default.
In #49305 we added the TryFrom
and TryInto
traits to the prelude, and reverted that in #49518 because that a breaking change for a significant number on crates that had their own TryFrom
or TryInto
traits. (Ironically, identical to the std
ones and duplicated because those were still unstable.)
Consensus is that we’d still like to have those traits in the prelude, but to avoid breakage we need to make that opt-in. The upcoming 2018 edition seems to be a good opportunity for that. For modules in crates that opt into the 2018 edition, we could replace v1
in that inserted code with edition2018
and create src/libstd/prelude/edition2018.rs
and src/libcore/prelude/edition2018.rs
like so:
pub use super::v1::*;
pub use convert::{TryFrom, TryInto};
Are there more items we considered adding to the prelude but didn’t because of breakage or breakage risk?
Update: implemented in #51434.