Rollup merge of #91535 - Aaron1011:stabilize-future-incompat, r=nagisa

Stabilize `-Z emit-future-incompat` as `--json future-incompat`

The FCP was completed in https://github.com/rust-lang/rust/issues/71249
This commit is contained in:
Matthias Krüger 2021-12-05 15:04:22 +01:00 committed by GitHub
commit 068b30420a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 8 deletions

View File

@ -651,7 +651,6 @@ macro_rules! untracked {
untracked!(dump_mir_dir, String::from("abc")); untracked!(dump_mir_dir, String::from("abc"));
untracked!(dump_mir_exclude_pass_number, true); untracked!(dump_mir_exclude_pass_number, true);
untracked!(dump_mir_graphviz, true); untracked!(dump_mir_graphviz, true);
untracked!(emit_future_incompat_report, true);
untracked!(emit_stack_sizes, true); untracked!(emit_stack_sizes, true);
untracked!(future_incompat_test, true); untracked!(future_incompat_test, true);
untracked!(hir_stats, true); untracked!(hir_stats, true);

View File

@ -746,6 +746,7 @@ fn default() -> Options {
edition: DEFAULT_EDITION, edition: DEFAULT_EDITION,
json_artifact_notifications: false, json_artifact_notifications: false,
json_unused_externs: false, json_unused_externs: false,
json_future_incompat: false,
pretty: None, pretty: None,
working_dir: RealFileName::LocalPath(std::env::current_dir().unwrap()), working_dir: RealFileName::LocalPath(std::env::current_dir().unwrap()),
} }
@ -1257,6 +1258,7 @@ pub struct JsonConfig {
pub json_rendered: HumanReadableErrorType, pub json_rendered: HumanReadableErrorType,
pub json_artifact_notifications: bool, pub json_artifact_notifications: bool,
pub json_unused_externs: bool, pub json_unused_externs: bool,
pub json_future_incompat: bool,
} }
/// Parse the `--json` flag. /// Parse the `--json` flag.
@ -1269,6 +1271,7 @@ pub fn parse_json(matches: &getopts::Matches) -> JsonConfig {
let mut json_color = ColorConfig::Never; let mut json_color = ColorConfig::Never;
let mut json_artifact_notifications = false; let mut json_artifact_notifications = false;
let mut json_unused_externs = false; let mut json_unused_externs = false;
let mut json_future_incompat = false;
for option in matches.opt_strs("json") { for option in matches.opt_strs("json") {
// For now conservatively forbid `--color` with `--json` since `--json` // For now conservatively forbid `--color` with `--json` since `--json`
// won't actually be emitting any colors and anything colorized is // won't actually be emitting any colors and anything colorized is
@ -1286,6 +1289,7 @@ pub fn parse_json(matches: &getopts::Matches) -> JsonConfig {
"diagnostic-rendered-ansi" => json_color = ColorConfig::Always, "diagnostic-rendered-ansi" => json_color = ColorConfig::Always,
"artifacts" => json_artifact_notifications = true, "artifacts" => json_artifact_notifications = true,
"unused-externs" => json_unused_externs = true, "unused-externs" => json_unused_externs = true,
"future-incompat" => json_future_incompat = true,
s => early_error( s => early_error(
ErrorOutputType::default(), ErrorOutputType::default(),
&format!("unknown `--json` option `{}`", s), &format!("unknown `--json` option `{}`", s),
@ -1298,6 +1302,7 @@ pub fn parse_json(matches: &getopts::Matches) -> JsonConfig {
json_rendered: json_rendered(json_color), json_rendered: json_rendered(json_color),
json_artifact_notifications, json_artifact_notifications,
json_unused_externs, json_unused_externs,
json_future_incompat,
} }
} }
@ -2011,8 +2016,12 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
let edition = parse_crate_edition(matches); let edition = parse_crate_edition(matches);
let JsonConfig { json_rendered, json_artifact_notifications, json_unused_externs } = let JsonConfig {
parse_json(matches); json_rendered,
json_artifact_notifications,
json_unused_externs,
json_future_incompat,
} = parse_json(matches);
let error_format = parse_error_format(matches, color, json_rendered); let error_format = parse_error_format(matches, color, json_rendered);
@ -2248,6 +2257,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
edition, edition,
json_artifact_notifications, json_artifact_notifications,
json_unused_externs, json_unused_externs,
json_future_incompat,
pretty, pretty,
working_dir, working_dir,
} }

View File

@ -228,6 +228,9 @@ pub struct Options {
/// `true` if we're emitting a JSON blob containing the unused externs /// `true` if we're emitting a JSON blob containing the unused externs
json_unused_externs: bool [UNTRACKED], json_unused_externs: bool [UNTRACKED],
/// `true` if we're emitting a JSON job containg a future-incompat report for lints
json_future_incompat: bool [TRACKED],
pretty: Option<PpMode> [UNTRACKED], pretty: Option<PpMode> [UNTRACKED],
/// The (potentially remapped) working directory /// The (potentially remapped) working directory
@ -1147,8 +1150,6 @@ mod parse {
computed `block` spans (one span encompassing a block's terminator and \ computed `block` spans (one span encompassing a block's terminator and \
all statements). If `-Z instrument-coverage` is also enabled, create \ all statements). If `-Z instrument-coverage` is also enabled, create \
an additional `.html` file showing the computed coverage spans."), an additional `.html` file showing the computed coverage spans."),
emit_future_incompat_report: bool = (false, parse_bool, [UNTRACKED],
"emits a future-incompatibility report for lints (RFC 2834)"),
emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED], emit_stack_sizes: bool = (false, parse_bool, [UNTRACKED],
"emit a section containing stack size metadata (default: no)"), "emit a section containing stack size metadata (default: no)"),
fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED], fewer_names: Option<bool> = (None, parse_opt_bool, [TRACKED],

View File

@ -280,7 +280,7 @@ pub fn finish_diagnostics(&self, registry: &Registry) {
} }
fn emit_future_breakage(&self) { fn emit_future_breakage(&self) {
if !self.opts.debugging_opts.emit_future_incompat_report { if !self.opts.json_future_incompat {
return; return;
} }

View File

@ -1,4 +1,4 @@
// compile-flags: -Zfuture-incompat-test -Zemit-future-incompat-report // compile-flags: -Zfuture-incompat-test
// check-pass // check-pass
// The `-Zfuture-incompat-test flag causes any normal warning to be included // The `-Zfuture-incompat-test flag causes any normal warning to be included

View File

@ -1802,6 +1802,7 @@ fn make_compile_args(
// patterns still match the raw compiler output. // patterns still match the raw compiler output.
if self.props.error_patterns.is_empty() { if self.props.error_patterns.is_empty() {
rustc.args(&["--error-format", "json"]); rustc.args(&["--error-format", "json"]);
rustc.args(&["--json", "future-incompat"]);
} }
rustc.arg("-Zui-testing"); rustc.arg("-Zui-testing");
rustc.arg("-Zdeduplicate-diagnostics=no"); rustc.arg("-Zdeduplicate-diagnostics=no");
@ -1809,11 +1810,11 @@ fn make_compile_args(
Ui => { Ui => {
if !self.props.compile_flags.iter().any(|s| s.starts_with("--error-format")) { if !self.props.compile_flags.iter().any(|s| s.starts_with("--error-format")) {
rustc.args(&["--error-format", "json"]); rustc.args(&["--error-format", "json"]);
rustc.args(&["--json", "future-incompat"]);
} }
rustc.arg("-Ccodegen-units=1"); rustc.arg("-Ccodegen-units=1");
rustc.arg("-Zui-testing"); rustc.arg("-Zui-testing");
rustc.arg("-Zdeduplicate-diagnostics=no"); rustc.arg("-Zdeduplicate-diagnostics=no");
rustc.arg("-Zemit-future-incompat-report");
} }
MirOpt => { MirOpt => {
rustc.args(&[ rustc.args(&[