Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Right. 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.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: