Skip to content

Commit 30bd586

Browse files
committed
Stabilize suggestion applicability field in json output
1 parent 6e6a4b1 commit 30bd586

File tree

4 files changed

+4
-22
lines changed

4 files changed

+4
-22
lines changed

src/librustc/session/config.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,8 +1316,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
13161316
dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED],
13171317
"in dep-info output, omit targets for tracking dependencies of the dep-info files \
13181318
themselves"),
1319-
suggestion_applicability: bool = (false, parse_bool, [UNTRACKED],
1320-
"include machine-applicability of suggestions in JSON output"),
13211319
unpretty: Option<String> = (None, parse_unpretty, [UNTRACKED],
13221320
"Present the input source, unstable (and less-pretty) variants;
13231321
valid types are any of the types for `--pretty`, as well as:

src/librustc/session/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,6 @@ pub fn build_session_with_codemap(
10181018
Some(registry),
10191019
codemap.clone(),
10201020
pretty,
1021-
sopts.debugging_opts.suggestion_applicability,
10221021
).ui_testing(sopts.debugging_opts.ui_testing),
10231022
),
10241023
(config::ErrorOutputType::Json(pretty), Some(dst)) => Box::new(
@@ -1027,7 +1026,6 @@ pub fn build_session_with_codemap(
10271026
Some(registry),
10281027
codemap.clone(),
10291028
pretty,
1030-
sopts.debugging_opts.suggestion_applicability,
10311029
).ui_testing(sopts.debugging_opts.ui_testing),
10321030
),
10331031
(config::ErrorOutputType::Short(color_config), None) => Box::new(

src/librustdoc/core.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ pub fn new_handler(error_format: ErrorOutputType, codemap: Option<Lrc<codemap::C
144144
None,
145145
codemap,
146146
pretty,
147-
sessopts.debugging_opts.suggestion_applicability,
148147
).ui_testing(sessopts.debugging_opts.ui_testing)
149148
)
150149
},

src/libsyntax/json.rs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,43 +38,37 @@ pub struct JsonEmitter {
3838
registry: Option<Registry>,
3939
cm: Lrc<CodeMapper + sync::Send + sync::Sync>,
4040
pretty: bool,
41-
/// Whether "approximate suggestions" are enabled in the config
42-
suggestion_applicability: bool,
4341
ui_testing: bool,
4442
}
4543

4644
impl JsonEmitter {
4745
pub fn stderr(registry: Option<Registry>,
4846
code_map: Lrc<CodeMap>,
49-
pretty: bool,
50-
suggestion_applicability: bool) -> JsonEmitter {
47+
pretty: bool) -> JsonEmitter {
5148
JsonEmitter {
5249
dst: Box::new(io::stderr()),
5350
registry,
5451
cm: code_map,
5552
pretty,
56-
suggestion_applicability,
5753
ui_testing: false,
5854
}
5955
}
6056

6157
pub fn basic(pretty: bool) -> JsonEmitter {
6258
let file_path_mapping = FilePathMapping::empty();
6359
JsonEmitter::stderr(None, Lrc::new(CodeMap::new(file_path_mapping)),
64-
pretty, false)
60+
pretty)
6561
}
6662

6763
pub fn new(dst: Box<Write + Send>,
6864
registry: Option<Registry>,
6965
code_map: Lrc<CodeMap>,
70-
pretty: bool,
71-
suggestion_applicability: bool) -> JsonEmitter {
66+
pretty: bool) -> JsonEmitter {
7267
JsonEmitter {
7368
dst,
7469
registry,
7570
cm: code_map,
7671
pretty,
77-
suggestion_applicability,
7872
ui_testing: false,
7973
}
8074
}
@@ -137,7 +131,6 @@ struct DiagnosticSpan {
137131
/// that should be sliced in atop this span.
138132
suggested_replacement: Option<String>,
139133
/// If the suggestion is approximate
140-
#[rustc_serialize_exclude_null]
141134
suggestion_applicability: Option<Applicability>,
142135
/// Macro invocations that created the code at this span, if any.
143136
expansion: Option<Box<DiagnosticSpanMacroExpansion>>,
@@ -301,12 +294,6 @@ impl DiagnosticSpan {
301294
})
302295
});
303296

304-
let suggestion_applicability = if je.suggestion_applicability {
305-
suggestion.map(|x| x.1)
306-
} else {
307-
None
308-
};
309-
310297
DiagnosticSpan {
311298
file_name: start.file.name.to_string(),
312299
byte_start: span.lo().0 - start.file.start_pos.0,
@@ -318,7 +305,7 @@ impl DiagnosticSpan {
318305
is_primary,
319306
text: DiagnosticSpanLine::from_span(span, je),
320307
suggested_replacement: suggestion.map(|x| x.0.clone()),
321-
suggestion_applicability,
308+
suggestion_applicability: suggestion.map(|x| x.1),
322309
expansion: backtrace_step,
323310
label,
324311
}

0 commit comments

Comments
 (0)