Rollup merge of #163795 - GuillaumeGomez:note-default-edition, r=notriddle

When documenting without a specified `--edition`, emit a message

Follow-up of rust-lang/rust#158102.

cc @estebank
r? @notriddle
This commit is contained in:
Jonathan Brouwer
2026-10-05 22:21:27 +02:00
committed by GitHub
3 changed files with 8 additions and 8 deletions

View File

@@ -777,9 +777,7 @@ impl Options {
}
}
// We don't want rustdoc invocations to complain about the lack of `--edition`.
let has_input = false;
let edition = config::parse_crate_edition(early_dcx, matches, has_input);
let edition = config::parse_crate_edition(early_dcx, matches, true);
let mut id_map = html::markdown::IdMap::new();
let Some(external_html) = ExternalHtml::load(

View File

@@ -17,17 +17,17 @@ fn main() {
.actual_text("(rustc)", &out)
.run();
// Ensure that we dont mention --edition when running rustdoc.
rustdoc().edition("2015").input("main.rs").run().assert_stderr_not_contains("--edition");
let out = rustdoc().input("main.rs").run().assert_stderr_contains("--edition").stderr_utf8();
diff().expected_file("rustdoc-unspecified-edition.stderr").actual_text("(rustc)", &out).run();
// Ensure that we only mention --edition when documenting.
let out = rustdoc().run_fail().assert_stderr_not_contains("--edition").stderr_utf8();
diff()
.expected_text("(test)", "error: missing file operand\n\n")
.actual_text("(rustc)", &out)
.run();
let out =
rustdoc().input("main.rs").run().assert_stderr_not_contains("--edition").stderr_utf8();
diff().expected_text("(test)", "").actual_text("(rustc)", &out).run();
// Ensure that we don't mention --edition when getting help.
let result = bare_rustc().arg("--help").run();
result.assert_stderr_not_contains("--edition");

View File

@@ -0,0 +1,2 @@
`--edition` is unspecified, defaulting to `2015` while the latest is `2024`; it must be one of: <2015|2018|2021|2024|future>