Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
I'll try to write an MCP later (unless someone does it for me). This change was motivated after seeing https://internals.rust-lang.org/t/code-compiles-on-playground-but-fails-when-passed-via-stdin-to-rustc/24393 where the different defaults between cargo, playground and rustc caused people to get confused. |
b923a75 to
2a486d3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
4241536 to
d71c2fa
Compare
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
This comment has been minimized.
This comment has been minimized.
d71c2fa to
a1d6de2
Compare
This comment has been minimized.
This comment has been minimized.
|
|
||
| fn main() { | ||
| rustc().input("foo-prev.rs").run(); | ||
| rustc().edition("2015").input("foo-prev.rs").run(); |
There was a problem hiding this comment.
Remark: we could consider default setting edition but allow overriding, but explicit is fine
…ieyouxu When compiling without a specified `--edition`, emit a note
|
|
This pull request was unapproved. This PR was contained in a rollup (#160481), which was unapproved. |
a1d6de2 to
a25876f
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
As part of notifying users calling bare `rustc` without an explicit edition that they should likely be using the 2024 edition, update cargo tests to not trigger the new user facing note. This change will let rust-lang/rust#158102 to land.
As part of notifying users calling bare `rustc` without an explicit edition that they should likely be using the 2024 edition, update cargo tests to not trigger the new user facing note. This change will let rust-lang/rust#158102 to land.
a25876f to
ed8f499
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
| @@ -0,0 +1,2 @@ | |||
| note: it is advisable to explicitly specify the `--edition` argument (the default implies `2015`); it must be one of: <2015|2018|2021|2024|future> | |||
There was a problem hiding this comment.
Non-blocking: I wonder if we want to filter out future, since you can't really use this successfully 🤔
| let TestProps { mut compile_flags, run_flags, .. } = props; | ||
| // We don't want to pass `--edition=2015` in, which is being set by default by | ||
| // `TestProps::from_file`. | ||
| compile_flags.remove(0); |
There was a problem hiding this comment.
Instead of adding then removing, can we stop presetting Actually I'll look at this later, this has some funky behavior in general.--edition=2015 in TestProps::from_file for rustdoc-gui test mode?
|
Reminder, once the PR becomes ready for a review, use |
| rustc().edition("2015").input("main.rs").run().assert_stderr_not_contains("--edition"); | ||
| let out = rustc().input("main.rs").run().assert_stderr_contains("--edition").stderr_utf8(); | ||
| diff().expected_file("unspecified-edition.stderr").actual_text("(rustc)", &out).run(); |
There was a problem hiding this comment.
- Can we also exercise rustdoc's interface here?
- Could we also add a case for just e.g.
--helpor sth that doesn't have inputs?
| } | ||
|
|
||
| let edition = config::parse_crate_edition(early_dcx, matches); | ||
| let edition = config::parse_crate_edition(early_dcx, matches, true); |
There was a problem hiding this comment.
I think this also fires for rustdoc unconditionally, even if it doesn't have inputs? 🤔 I want to say rustdoc has some fake inputs or something? There's something weird about this being unconditionally true.
| /// We should not be emitting notes during compiles, with the *only* exception of missing | ||
| /// `--crate` when calling `rustc` directly. |
There was a problem hiding this comment.
Wait, this should say --edition not --crate, right?
There was a problem hiding this comment.
Actually, now that I think about it, can we also add a run-make-cargo test for a cargo project that doesn't explicit set an edition? I don't remember if cargo explicitly sets an edition if Cargo.toml doesn't have it 🤔
No description provided.