# Specifying the edition in the source file

**URL:** <https://internals.rust-lang.org/t/specifying-the-edition-in-the-source-file/20337>\
**Category:** language design\
**Created:** [February 15, 2024, 6:59pm UTC](https://internals.rust-lang.org/t/specifying-the-edition-in-the-source-file/20337 "2024-02-15T18:59:16Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![notriddle](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/notriddle/32/14082_2.png) [@notriddle](https://internals.rust-lang.org/u/notriddle)\
**Post date:** [February 15, 2024, 6:56pm UTC](https://internals.rust-lang.org/t/specifying-the-edition-in-the-source-file/20337/4 "2024-02-15T18:56:04Z")

</div>

> [@Idea: rustc & cargo should warn on unspecified edition](https://internals.rust-lang.org/t/idea-rustc-cargo-should-warn-on-unspecified-edition/20309/17):
>
> Come to think of it, why can't I specify the edition in the _code_?

The edition is allowed to affect tokenization, and you need to tokenize in order to get at the attributes. Requiring attributes in order to determine the edition would cause a chicken-and-egg problem.

**Moderator note** : Also, this has been split into a separate topic.

---

_[View the full topic](https://internals.rust-lang.org/t/specifying-the-edition-in-the-source-file/20337)._
