Where does rustc read default edition from?

⚓ Rust    📅 2026-07-17    👤 surdeus    👁️ 1      

surdeus

I'm learning Rust and I don't want to create a full project for every single code snippet I want to play with, so I create standalone files and compile them with rustc.

A copy+pasted snippet from The Book was triggering lots of warnings in my machine, but worked fine in Rust Playground. I eventually figured out that the code requires 2021 edition but my local rustc is using 2018 or older.

How is this default edition configured? I know I can pass --edition 2021 or whatever everytime, but I'd rather just default to latest edition (and I like to know how things work).

I'm using Windows 10 for what it's worth.

3 posts - 3 participants

Read full topic

🏷️ Rust_feed