diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2021-02-17 20:38:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-02-17 20:38:07 +0100 |
| commit | f97e1121a7b7716ab020f93963d162fb9d703e36 (patch) | |
| tree | 5c83167b1c1afd613fb86a9eb7a1b9232371a736 | |
| parent | 086342c7806f63f7e3293196a64738db1b2d3ba3 (diff) | |
| parent | ee0e841a2e949cba1dcf3a2fb04e9a673681e4fd (diff) | |
Rollup merge of #82207 - ehuss:rustdoc-2021, r=jyn514
rustdoc: treat edition 2021 as unstable This ensures that `--edition=2021` requires `-Z unstable-options` in rustdoc.
| -rw-r--r-- | compiler/rustc_session/src/config.rs | 2 | ||||
| -rw-r--r-- | src/librustdoc/config.rs | 14 |
2 files changed, 3 insertions, 13 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index 210dbb0ee99..4533b37f10b 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -1350,7 +1350,7 @@ pub fn parse_error_format( error_format } -fn parse_crate_edition(matches: &getopts::Matches) -> Edition { +pub fn parse_crate_edition(matches: &getopts::Matches) -> Edition { let edition = match matches.opt_str("edition") { Some(arg) => Edition::from_str(&arg).unwrap_or_else(|_| { early_error( diff --git a/src/librustdoc/config.rs b/src/librustdoc/config.rs index 63a25e5dbfb..1478437cefa 100644 --- a/src/librustdoc/config.rs +++ b/src/librustdoc/config.rs @@ -16,7 +16,7 @@ use rustc_session::config::{CodegenOptions, DebuggingOptions, ErrorOutputType, E use rustc_session::getopts; use rustc_session::lint::Level; use rustc_session::search_paths::SearchPath; -use rustc_span::edition::{Edition, DEFAULT_EDITION}; +use rustc_span::edition::Edition; use rustc_target::spec::TargetTriple; use crate::core::new_handler; @@ -469,17 +469,7 @@ impl Options { } } - let edition = if let Some(e) = matches.opt_str("edition") { - match e.parse() { - Ok(e) => e, - Err(_) => { - diag.struct_err("could not parse edition").emit(); - return Err(1); - } - } - } else { - DEFAULT_EDITION - }; + let edition = config::parse_crate_edition(&matches); let mut id_map = html::markdown::IdMap::new(); id_map.populate(&html::render::INITIAL_IDS); |
