HackMD
  • Beta
    Beta  Get a sneak peek of HackMD’s new design
    Turn on the feature preview and give us feedback.
    Go → Got it
      • Create new note
      • Create a note from template
    • Beta  Get a sneak peek of HackMD’s new design
      Beta  Get a sneak peek of HackMD’s new design
      Turn on the feature preview and give us feedback.
      Go → Got it
      • Sharing Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • More (Comment, Invitee)
      • Publishing
        Please check the box to agree to the Community Guidelines.
        Everyone on the web can find and read all notes of this public team.
        After the note is published, everyone on the web can find and read this note.
        See all published notes on profile page.
      • Commenting Enable
        Disabled Forbidden Owners Signed-in users Everyone
      • Permission
        • Forbidden
        • Owners
        • Signed-in users
        • Everyone
      • Invitee
      • No invitee
      • Options
      • Versions and GitHub Sync
      • Transfer ownership
      • Delete this note
      • Template
      • Save as template
      • Insert from template
      • Export
      • Dropbox
      • Google Drive Export to Google Drive
      • Gist
      • Import
      • Dropbox
      • Google Drive Import from Google Drive
      • Gist
      • Clipboard
      • Download
      • Markdown
      • HTML
      • Raw HTML
    Menu Sharing Create Help
    Create Create new note Create a note from template
    Menu
    Options
    Versions and GitHub Sync Transfer ownership Delete this note
    Export
    Dropbox Google Drive Export to Google Drive Gist
    Import
    Dropbox Google Drive Import from Google Drive Gist Clipboard
    Download
    Markdown HTML Raw HTML
    Back
    Sharing
    Sharing Link copied
    /edit
    View mode
    • Edit mode
    • View mode
    • Book mode
    • Slide mode
    Edit mode View mode Book mode Slide mode
    Note Permission
    Read
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    Write
    Only me
    • Only me
    • Signed-in users
    • Everyone
    Only me Signed-in users Everyone
    More (Comment, Invitee)
    Publishing
    Please check the box to agree to the Community Guidelines.
    Everyone on the web can find and read all notes of this public team.
    After the note is published, everyone on the web can find and read this note.
    See all published notes on profile page.
    More (Comment, Invitee)
    Commenting Enable
    Disabled Forbidden Owners Signed-in users Everyone
    Permission
    Owners
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Invitee
    No invitee
       owned this note    owned this note      
    Published Linked with GitHub
    Like BookmarkBookmarked
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # :fireworks: Rust Edition 2021 This document will be turned into tracking issues and an RFC for more structure at some point. For now, we'll try to collect everything here. Please also add ideas that are not very concrete yet, just so we don't miss anything. --- **Discussion: [`#edition` on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition)** --- ## :motorway: Milestone planning **December 2020:** - [x] :pencil2: Start this document. - [x] :incoming_envelope: Ask teams to check this document and add things. - [x] :calendar: Preliminary roadmap with rough dates. - [x] :fireworks: Add unstable `rustc --edition=2021`: [#79576](https://github.com/rust-lang/rust/pull/79576) **January 2021:** - [x] :point_up: Make sure all relevant teams have brought attention to the 2021 edition in one of their meetings. - [x] compiler - [x] lang - [x] libs - [x] rustdoc - [x] cargo - [x] :gear: Add initial support for edition 2021 to all tools. (Just to make them aware of the new edition. Any edition-specific changes will be added later as part of that edition change itself.) - [x] :package: Add `edition = "2021"` to `cargo`: [cargo#8922](https://github.com/rust-lang/cargo/pull/8922) - [x] 🧹 Add edition 2021 to `rustfmt`: [rustfmt#4618](https://github.com/rust-lang/rustfmt/pull/4618) - [x] :symbols: Add edition 2021 to `rls`: [rls#1709](https://github.com/rust-lang/rls/pull/1709) - [x] :racing_car: Add edition 2021 to `racer`: [racer#1152](https://github.com/racer-rust/racer/pull/1152) - [x] :paperclip: Add edition 2021 to `clippy`: [rust-clippy#6530](https://github.com/rust-lang/rust-clippy/pull/6530) - [x] :mag: Add edition 2021 to `rust-analyzer`: [rust-analyzer#7123](https://github.com/rust-analyzer/rust-analyzer/pull/7123) - [x] ~~:book: Add `edition2021` to `rustdoc`~~: No change required. - [ ] :speech_balloon: Make sure the relevant teams discuss each of the proposed changes. - [ ] compiler - [ ] lang - [ ] libs - [ ] rustdoc - [ ] cargo **February 2021:** - [ ] :scroll: Final list of changes. All proposed changes have: - [ ] An approved RFC - [ ] Migration+idiom lint plan - [ ] Partial implementation or plan for implementation **March 2021:** **April 2021:** **May 2021:** - [ ] :computer: All proposed changes implemented and available in nightly. **June 2021:** - [ ] :warning: All lints implemented on nightly and tested on crater. **July 2021:** - [ ] :busts_in_silhouette: Announce start of public testing. **August 2021:** - [ ] :loudspeaker: Finish marketing materials, docs, etc. - [ ] Blog post(s) - [ ] Edition guide **September 2021:** - [x] :tada: Stabilize `--edition=2021` on nightly (1.56). **October 2021:** - [x] :checkered_flag: `--edition=2021` available on stable in Rust 1.56. --- ## :bookmark_tabs: Edition Changes <!-- Empty template: ### :question: Title | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `libs`, `lang` | Incomplete idea | None (yet?) | None yet | ? | --> ### :heavy_check_mark: Unify `std::panic` and `core::panic` | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `libs`, `lang` | RFC accepted | [RFC 3007](https://github.com/rust-lang/rfcs/pull/3007) | [#80162](https://github.com/rust-lang/rust/issues/80162) | Mara | This makes `panic!()` consistent with `print!()`: `panic!("{}")` becomes an error, and `panic!("{x}")` will format `x` once implicit formatting arguments are stabilized. To do: - Implement things. See tracking issue. ### :pencil: Promote 2018 warn lints to deny | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `compiler` | - | - | [#80165](https://github.com/rust-lang/rust/issues/80165) | Ryan Levick | To do: - Decide on final list of promotions - Implementation ### :question: Forbid `bare_trait_objects` | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `lang` | Not yet decided | None (yet?) | [lang-team#65](https://github.com/rust-lang/lang-team/issues/65) | t-lang | - Context: [this Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/bare_trait_objects.202021). To do: - Make decision - Implementation ### :hammer_and_wrench: Change Cargo's feature resolver to `resolver = "2"` by default for edition 2021 | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `cargo` | Accepted | - | [cargo#9048](https://github.com/rust-lang/cargo/issues/9048) | ? | ### :pencil: Edition specific or-patterns | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `lang` | Team consensus | [RFC 2535](https://github.com/rust-lang/rfcs/pull/2535) | [#54883](https://github.com/rust-lang/rust/issues/54883) | mark-i-m | - Consensus from t-lang: [comment on #54883](https://github.com/rust-lang/rust/issues/54883#issuecomment-745509090) - Implementation: [#80100](https://github.com/rust-lang/rust/pull/80100) - Stabilization FCP: [#79278](https://github.com/rust-lang/rust/pull/79278#issuecomment-773032487) ### :question: Disjoint captures in closures | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `lang` | ? | [RFC 2229](https://github.com/rust-lang/rfcs/pull/2229) | [#53488](https://github.com/rust-lang/rust/issues/53488) | ? | - Migrations needed for changes in drop order and around auto traits - Update: https://hackmd.io/wPs-tHJZR1Cj9j_vwsxwbw?view - Implentation Status: [Github Project Board](https://github.com/rust-lang/project-rfc-2229/projects/1) ### :heavy_check_mark: Fix `cargo fix --edition` for edition 2021 | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `cargo` | Implemented | N/A | [cargo#9047](https://github.com/rust-lang/cargo/issues/9047) | ? | ### :pencil: Prelude changes | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `libs`, `lang` | Incomplete idea | [RFC 3090](https://github.com/rust-lang/rfcs/pull/3090) | [#65512](https://github.com/rust-lang/rust/issues/65512/) | t-libs? | - Add `TryFrom` / `TryInto` - Add other things? - Needs a compatibility warning (See [Zulip](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/Prelude.202021/near/221214002)) - Prioritization of glob import method resolution the same as item resolution (language change) - Doesn't need to be edition-specific: - :thought_balloon: Add `std::iter`? ([#80216](https://github.com/rust-lang/rust/issues/80216)) - Might not need to be edition-specific: (but have potential breakage from trait method conflicts, so would probably need at least a crater run) - :thought_balloon: Add `ops::Not`? ([thread on Internals](https://internals.rust-lang.org/t/the-is-not-empty-method-as-more-clearly-alternative-for-is-empty/10612/8)) - :thought_balloon: Add `Debug` and `Display` ([#80360](https://github.com/rust-lang/rust/issues/80360) and [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/Edition.202021/near/220445708)) - :thought_balloon: Add `Hash` ([#80361](https://github.com/rust-lang/rust/issues/80361) and [Zulip discussion](https://rust-lang.zulipchat.com/#narrow/stream/268952-edition/topic/Edition.202021/near/220527514)) To do: - Complete the list of changes (see tracking issue) - Implement glob and prelude import changes in compiler? Compatibility warning? (RFC/MCP first?) - Implement new prelude ### :question: Removing ``#[macro_export]`` | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `lang` | Not yet decided | - | None yet | petrochenkov? | To do: - Support `pub` on `macro_rules!`: [#78166](https://github.com/rust-lang/rust/pull/78166) - Remove `#[macro_export]` - Could also be just a deprecation warning. ### :question: `IntoIterator` for `[T; N]` | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `libs` | Incomplete idea | None (yet?) | None yet | Mara | - Context: [this comment](https://github.com/rust-lang/rust/pull/65819#issuecomment-700131423) and a few more after that one. ### :question: Replace `#[rustc_args_required_const(..)]` with const generics | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `libs`, `lang` | Incomplete idea | None (yet?) | None yet | Amanieu | - Context: [this comment](https://github.com/rust-lang/stdarch/issues/248#issuecomment-756240852), and also the rest of that issue. - Could also be a warning on all editions. (So, not deny on 2021.) ### :pencil: Reserve new keywords | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `lang` | Incomplete idea | None | None | t-lang? | To do: - List keywords to reserve - Implement it ### :thought_balloon: New/fixed range types (make `a..b` Copy) | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `libs`, `lang` | Incomplete idea | None | None | t-libs? sfackler? | To do: - Investigate alternative solutions, see [rfcs#2848](https://github.com/rust-lang/rfcs/issues/2848) - Decide on the best solution - Implement it ### :pencil: Change rustdoc lints to have a tool prefix and make changing the names deny-by-default | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `rustdoc` | waiting on FCP (see [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/What.20is.20the.20policy.20for.20new.20lints.3F)) | - | - | Joshua Nelson | To do: - Add `rustdoc::` lints and suggest changing builtin rustdoc lints to use `rustdoc::` prefix ([#80527](https://github.com/rust-lang/rust/pull/80527)) - Add a deny-by-default lint to rename the old lints - Cohesive lints suggests all tools should be namespacing lints, is this true? Does this actually need to be deny by default? Warn-by-default seems good enough; it wouldn't allow simplifying code since the compiler has to support all editions. ### :question: Run doctests in a single binary? | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `rustdoc` | Incomplete idea | - | [#75341](https://github.com/rust-lang/rust/issues/75341) | - | It's unclear whether we should do this. Preferably we could find a smaller hammer to throw at this that still gives performance gains. ### :question: Separate compile-time from run-time working directory for doctests? | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `rustdoc` | Incomplete idea | - | [#8993](https://github.com/rust-lang/cargo/issues/8993) | - | Similar to doctests in a single binary, I would prefer to find a smaller hammer that doesn't require breaking changes. ### :question: Change Rustdoc's URL structure? | Team(s) | Status | RFC | Tracking issue | Who | | ------- | ------ | --- | -------------- | ------ | | `rustdoc` | Incomplete idea | [rfcs#2988](https://github.com/rust-lang/rfcs/pull/2988) | [#25879](https://github.com/rust-lang/rust/issues/25879), [#80504](https://github.com/rust-lang/rust/issues/80504), [docs.rs#1055](https://github.com/rust-lang/docs.rs/issues/1055), [#55160](https://github.com/rust-lang/rust/issues/55160), [#71912](https://github.com/rust-lang/rust/issues/71912) | Joshua Nelson | This change might be too big even for an edition. It also needs better planning of what the end result is - if we're changing URLs anyway, it probably makes sense to solve the case-insensitive files issue at the same time. --- ## Notes .. ## Links - [Project Board: Edition 2021](https://github.com/orgs/rust-lang/projects/7) - [RFC 2052: Editions](https://github.com/rust-lang/rfcs/blob/master/text/2052-epochs.md) - [RFC 2966: Edition 2021 and Beyond (Closed)](https://github.com/rust-lang/rfcs/pull/2966)

    Import from clipboard

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lost their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template is not available.


    Upgrade

    All
    • All
    • Team
    No template found.

    Create custom template


    Upgrade

    Delete template

    Do you really want to delete this template?

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Tutorials

    Book Mode Tutorial

    Slide Mode Tutorial

    YAML Metadata

    Contacts

    Facebook

    Twitter

    Feedback

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions

    Versions and GitHub Sync

    Sign in to link this note to GitHub Learn more
    This note is not linked with GitHub Learn more
     
    Add badge Pull Push GitHub Link Settings
    Upgrade now

    Version named by    

    More Less
    • Edit
    • Delete

    Note content is identical to the latest version.
    Compare with
      Choose a version
      No search result
      Version not found

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub

        Please sign in to GitHub and install the HackMD app on your GitHub repo. Learn more

         Sign in to GitHub

        HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Available push count

        Upgrade

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Upgrade

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully