Idea: rustc & cargo should warn on unspecified edition

No, because at least two-thirds of the time, if I'm messing with an isolated snippet, I'm about to file a bug report on something, and I want to know whether the problem changes or disappears if I take cargo out of the loop.

I might want cargo to tell me the options I need to give rustc to make some already-built dependency crate available to the test program, but that's it.

Indeed. In the context of test snippets, I wouldn't mind it being an error not to specify an edition.


Come to think of it, why can't I specify the edition in the code? Like

#![rust_edition(2021)]

at the top of the crate root.

7 Likes