# Idea: rustc & cargo should warn on unspecified edition

**URL:** <https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309>\
**Category:** tools and infrastructure\
**Created:** [February 11, 2024, 10:24pm UTC](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309 "2024-02-11T22:24:56Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![zackw](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/zackw/32/2071_2.png) [@zackw](https://internals.rust-lang.org/u/zackw)\
**Post date:** [February 15, 2024, 1:30pm UTC](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309/17 "2024-02-15T13:30:24Z")

</div>

> [@bjorn3](#):
>
> This use case will be fixed by cargo scripts, right?

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.

> [@bjorn3](#):
>
> for this use case you almost certainly don't want to use the 2015 edition

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
#![rust_edition(2021)]

```

at the top of the crate root.

---

_[View the full topic](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309)._
