External Publication
Visit Post

Code compiles on playground but fails when passed via stdin to rustc

Rust Internals [Unofficial] June 20, 2026
Source

ekuber:

Would someone have the energy to write the MCP for merging this change?

There exists some prior discussion with similar ideas by the way:

Idea: rustc & cargo should warn on unspecified edition tools and infrastructure

A moderately common source of beginner confusion is that they encounter unexpected behavior due to not specifying a language edition, and getting the default 2015 edition. This can be either due to calling rustc instead of cargo and not specifying any options, or writing a Cargo.toml from scratch (that is, not using cargo new) without remembering to include the edition field. Users in this position encounter various surprising behaviors, such as needing extern crate to use dependencies, and not…


kpreid:

It does. It used to be conditional, but that was 5 years ago.

cargo/src/cargo/core/compiler/mod.rs at master · rust-lang/cargo · GitHub

Judging by the PR linked from the abovementioned discussion

github.com/rust-lang/cargo

fix(rustc): Always pass --edition to rustc (#13499)

masterepage:always-edition

opened 09:38PM - 28 Feb 24 UTC

        epage
      

+299 -288

On Internals, the idea came up for warning on unset Edition. I am working on the cargo warning but if rustc ever wants to do so, they'd be blocked on cargo ensuring --edition is always set. Hence this change.

it sounds the relevant change is more like ~2 years ago? (And explicitly for the purpose of enabling what this thread now suggests.

In other words, the coordination with cargo already happened

Discussion in the ATmosphere

Loading comments...