Stabilize suggestion applicability field in json output
This commit is contained in:
parent
6e6a4b1957
commit
30bd586bec
4 changed files with 4 additions and 22 deletions
|
@ -1316,8 +1316,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
|
||||||
dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
|
dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
|
||||||
"in dep-info output, omit targets for tracking dependencies of the dep-info files \
|
"in dep-info output, omit targets for tracking dependencies of the dep-info files \
|
||||||
themselves"),
|
themselves"),
|
||||||
suggestion_applicability: bool = (false, parse_bool, [UNTRACKED],
|
|
||||||
"include machine-applicability of suggestions in JSON output"),
|
|
||||||
unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
|
unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
|
||||||
"Present the input source, unstable (and less-pretty) variants;
|
"Present the input source, unstable (and less-pretty) variants;
|
||||||
valid types are any of the types for `--pretty`, as well as:
|
valid types are any of the types for `--pretty`, as well as:
|
||||||
|
|
|
@ -1018,7 +1018,6 @@ pub fn build_session_with_codemap(
|
||||||
Some(registry),
|
Some(registry),
|
||||||
codemap.clone(),
|
codemap.clone(),
|
||||||
pretty,
|
pretty,
|
||||||
sopts.debugging_opts.suggestion_applicability,
|
|
||||||
).ui_testing(sopts.debugging_opts.ui_testing),
|
).ui_testing(sopts.debugging_opts.ui_testing),
|
||||||
),
|
),
|
||||||
(config::ErrorOutputType::Json(pretty), Some(dst)) => Box::new(
|
(config::ErrorOutputType::Json(pretty), Some(dst)) => Box::new(
|
||||||
|
@ -1027,7 +1026,6 @@ pub fn build_session_with_codemap(
|
||||||
Some(registry),
|
Some(registry),
|
||||||
codemap.clone(),
|
codemap.clone(),
|
||||||
pretty,
|
pretty,
|
||||||
sopts.debugging_opts.suggestion_applicability,
|
|
||||||
).ui_testing(sopts.debugging_opts.ui_testing),
|
).ui_testing(sopts.debugging_opts.ui_testing),
|
||||||
),
|
),
|
||||||
(config::ErrorOutputType::Short(color_config), None) => Box::new(
|
(config::ErrorOutputType::Short(color_config), None) => Box::new(
|
||||||
|
|
|
@ -144,7 +144,6 @@ pub fn new_handler(error_format: ErrorOutputType, codemap: Option<Lrc<codemap::C
|
||||||
None,
|
None,
|
||||||
codemap,
|
codemap,
|
||||||
pretty,
|
pretty,
|
||||||
sessopts.debugging_opts.suggestion_applicability,
|
|
||||||
).ui_testing(sessopts.debugging_opts.ui_testing)
|
).ui_testing(sessopts.debugging_opts.ui_testing)
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
|
|
@ -38,22 +38,18 @@ pub struct JsonEmitter {
|
||||||
registry: Option<Registry>,
|
registry: Option<Registry>,
|
||||||
cm: Lrc<CodeMapper + sync::Send + sync::Sync>,
|
cm: Lrc<CodeMapper + sync::Send + sync::Sync>,
|
||||||
pretty: bool,
|
pretty: bool,
|
||||||
/// Whether "approximate suggestions" are enabled in the config
|
|
||||||
suggestion_applicability: bool,
|
|
||||||
ui_testing: bool,
|
ui_testing: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl JsonEmitter {
|
impl JsonEmitter {
|
||||||
pub fn stderr(registry: Option<Registry>,
|
pub fn stderr(registry: Option<Registry>,
|
||||||
code_map: Lrc<CodeMap>,
|
code_map: Lrc<CodeMap>,
|
||||||
pretty: bool,
|
pretty: bool) -> JsonEmitter {
|
||||||
suggestion_applicability: bool) -> JsonEmitter {
|
|
||||||
JsonEmitter {
|
JsonEmitter {
|
||||||
dst: Box::new(io::stderr()),
|
dst: Box::new(io::stderr()),
|
||||||
registry,
|
registry,
|
||||||
cm: code_map,
|
cm: code_map,
|
||||||
pretty,
|
pretty,
|
||||||
suggestion_applicability,
|
|
||||||
ui_testing: false,
|
ui_testing: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,20 +57,18 @@ impl JsonEmitter {
|
||||||
pub fn basic(pretty: bool) -> JsonEmitter {
|
pub fn basic(pretty: bool) -> JsonEmitter {
|
||||||
let file_path_mapping = FilePathMapping::empty();
|
let file_path_mapping = FilePathMapping::empty();
|
||||||
JsonEmitter::stderr(None, Lrc::new(CodeMap::new(file_path_mapping)),
|
JsonEmitter::stderr(None, Lrc::new(CodeMap::new(file_path_mapping)),
|
||||||
pretty, false)
|
pretty)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(dst: Box<Write + Send>,
|
pub fn new(dst: Box<Write + Send>,
|
||||||
registry: Option<Registry>,
|
registry: Option<Registry>,
|
||||||
code_map: Lrc<CodeMap>,
|
code_map: Lrc<CodeMap>,
|
||||||
pretty: bool,
|
pretty: bool) -> JsonEmitter {
|
||||||
suggestion_applicability: bool) -> JsonEmitter {
|
|
||||||
JsonEmitter {
|
JsonEmitter {
|
||||||
dst,
|
dst,
|
||||||
registry,
|
registry,
|
||||||
cm: code_map,
|
cm: code_map,
|
||||||
pretty,
|
pretty,
|
||||||
suggestion_applicability,
|
|
||||||
ui_testing: false,
|
ui_testing: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -137,7 +131,6 @@ struct DiagnosticSpan {
|
||||||
/// that should be sliced in atop this span.
|
/// that should be sliced in atop this span.
|
||||||
suggested_replacement: Option<String>,
|
suggested_replacement: Option<String>,
|
||||||
/// If the suggestion is approximate
|
/// If the suggestion is approximate
|
||||||
#[rustc_serialize_exclude_null]
|
|
||||||
suggestion_applicability: Option<Applicability>,
|
suggestion_applicability: Option<Applicability>,
|
||||||
/// Macro invocations that created the code at this span, if any.
|
/// Macro invocations that created the code at this span, if any.
|
||||||
expansion: Option<Box<DiagnosticSpanMacroExpansion>>,
|
expansion: Option<Box<DiagnosticSpanMacroExpansion>>,
|
||||||
|
@ -301,12 +294,6 @@ impl DiagnosticSpan {
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
let suggestion_applicability = if je.suggestion_applicability {
|
|
||||||
suggestion.map(|x| x.1)
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
|
|
||||||
DiagnosticSpan {
|
DiagnosticSpan {
|
||||||
file_name: start.file.name.to_string(),
|
file_name: start.file.name.to_string(),
|
||||||
byte_start: span.lo().0 - start.file.start_pos.0,
|
byte_start: span.lo().0 - start.file.start_pos.0,
|
||||||
|
@ -318,7 +305,7 @@ impl DiagnosticSpan {
|
||||||
is_primary,
|
is_primary,
|
||||||
text: DiagnosticSpanLine::from_span(span, je),
|
text: DiagnosticSpanLine::from_span(span, je),
|
||||||
suggested_replacement: suggestion.map(|x| x.0.clone()),
|
suggested_replacement: suggestion.map(|x| x.0.clone()),
|
||||||
suggestion_applicability,
|
suggestion_applicability: suggestion.map(|x| x.1),
|
||||||
expansion: backtrace_step,
|
expansion: backtrace_step,
|
||||||
label,
|
label,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue