4 ms·
As long as the compiler is new enough to handle 2024 code (i.e., you're not using a 2021 version of the compiler itself), 2021 code can use 2024 code.
by bobbylarrybobby 9mo ago
As long as the compiler is new enough to handle 2024 code (i.e., you're not using a 2021 version of the compiler itself), 2021 code can use 2024 code.
- tialaramex 9mo agoRight. A good mental model would be to imagine every crate of Rust source has an associated Edition and there's a sort of "pre-processing" step where we translate that into the latest version of Rust seamlessly, preserving its exact meaning. So e.g. 2018 Edition said r# at the start of an identifier now marks a "raw" identifier. Keywords promise never to start this way, so r#foo is the same as foo but r#foo even works if some lunatic makes foo a keyword whereas just foo would become a keyword if that happened. As a result if you write let async = 5; ... in Rust 1.0 that translator treats it exactly as though you'd written let r#async = 5; ... in a modern Rust edition because these days the keyword async exists.