Skip to content

Tracking issue for the 2018 edition’s prelude #51418

Closed
@SimonSapin

Description

@SimonSapin

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-edition-2018Area: The 2018 editionC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCE-help-wantedCall for participation: Help is requested to fix this issue.F-rust_2018_preview`#![feature(rust_2018_preview)]`T-langRelevant to the language team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.WG-epochWorking group: Epoch (2018) management

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions