Login
You're viewing the discuss.systems public feed.
  • Aug 8, 2026, 3:42 AM

    #rust / #rustlang users of fediverse: (Please retoot for visibility!)

    Say you have a crate that was on an older edition (2015 / 2018 / etc), and you want to update it to the latest edition, which, at time of writing, is edition 2024 for Rust 1.85.0+. How would you do so? (and, if you haven't done such a thing before, how do you _imagine_ you will do it?)

    Edit note: changed wording. This poll is not asking about the *correct* way to do it, but rather *how* you would do it! :)

    Context: This came up in a language design discussion, where we were exploring whether we could make a _meaning change_ across an edition, which does not immediately create a compiler error/breakage in isolation if you bump the crate edition. I don't believe `cargo fix --edition` is something very apparent, so I don't think such a meaning change could happen, but the other side of the argument is that the meaning will be preserved if you _do_ run cargo fix before bumping your edition.

    💬 7🔄 12⭐ 2

Replies

  • Aug 8, 2026, 5:00 AM

    @beef this already happened for disjoint captures, no? I think the solution then was to add a lint

    💬 0🔄 0⭐ 0
  • Aug 8, 2026, 7:46 AM

    @beef Accidentally pressed set edition => fix errors rather than the cargo fix --edition like I actually have done in the past.

    💬 0🔄 0⭐ 0
  • Aug 8, 2026, 7:57 AM

    @beef
    I have done cargo fix --edition at least one time, but I have just updated edition filed in Cargo.toml more often.

    But I also use clippy a lot. So if the meaning change is in something that was discouraged by a lint before the change that would not affect me.

    I don't think changing the meaning of any syntax that is actually used and not discouraged would be good.

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0
  • Aug 8, 2026, 5:04 PM

    @beef the last time i had to go back to an old crate, i prompted a coding agent to update it. i found the transcript, and what i wrote was
    > Please update Tortosa to the latest Rust edition, then switch to idioms like `if let` chains that weren't available in 2023.

    the word machine did execute `cargo fix --edition`. i have no idea whether it would have dealt well with semantic breakage like you're describing - probably only if it was a new enough pretrain or if i pointed it at the release notes.

    💬 0🔄 0⭐ 0
  • Aug 9, 2026, 2:52 PM

    @beef I would try cargo fix first, but want to note that for the 2021 -> 2024 upgrade specifically, I might update Cargo.toml directly for some places in the future because I know what the edition upgrade entails, and for a lot of crates I know that all the if -> match auto-changes will be pointless and reverting them would be more work than fixing all the other things by hand.

    If the next edition doesn't include an annoying autofix like the if to match replacement to avoid changes to temporaries' lifetimes, I see no reason not to use cargo fix.

    💬 0🔄 0⭐ 0
  • 💬 0🔄 0⭐ 0