diff --git a/src/librustc/session/config.rs b/src/librustc/session/config.rs index e0c0fdd2a01fe..960bbfdd1ef71 100644 --- a/src/librustc/session/config.rs +++ b/src/librustc/session/config.rs @@ -1316,8 +1316,6 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options, dep_info_omit_d_target: bool = (false, parse_bool, [TRACKED], "in dep-info output, omit targets for tracking dependencies of the dep-info files \ themselves"), - suggestion_applicability: bool = (false, parse_bool, [UNTRACKED], - "include machine-applicability of suggestions in JSON output"), unpretty: Option = (None, parse_unpretty, [UNTRACKED], "Present the input source, unstable (and less-pretty) variants; valid types are any of the types for `--pretty`, as well as: diff --git a/src/librustc/session/mod.rs b/src/librustc/session/mod.rs index 6c8d4f5669e8e..8df66d8d68855 100644 --- a/src/librustc/session/mod.rs +++ b/src/librustc/session/mod.rs @@ -1018,7 +1018,6 @@ pub fn build_session_with_codemap( Some(registry), codemap.clone(), pretty, - sopts.debugging_opts.suggestion_applicability, ).ui_testing(sopts.debugging_opts.ui_testing), ), (config::ErrorOutputType::Json(pretty), Some(dst)) => Box::new( @@ -1027,7 +1026,6 @@ pub fn build_session_with_codemap( Some(registry), codemap.clone(), pretty, - sopts.debugging_opts.suggestion_applicability, ).ui_testing(sopts.debugging_opts.ui_testing), ), (config::ErrorOutputType::Short(color_config), None) => Box::new( diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 90889890e0bc2..458ed105d2650 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -144,7 +144,6 @@ pub fn new_handler(error_format: ErrorOutputType, codemap: Option, cm: Lrc, pretty: bool, - /// Whether "approximate suggestions" are enabled in the config - suggestion_applicability: bool, ui_testing: bool, } impl JsonEmitter { pub fn stderr(registry: Option, code_map: Lrc, - pretty: bool, - suggestion_applicability: bool) -> JsonEmitter { + pretty: bool) -> JsonEmitter { JsonEmitter { dst: Box::new(io::stderr()), registry, cm: code_map, pretty, - suggestion_applicability, ui_testing: false, } } @@ -61,20 +57,18 @@ impl JsonEmitter { pub fn basic(pretty: bool) -> JsonEmitter { let file_path_mapping = FilePathMapping::empty(); JsonEmitter::stderr(None, Lrc::new(CodeMap::new(file_path_mapping)), - pretty, false) + pretty) } pub fn new(dst: Box, registry: Option, code_map: Lrc, - pretty: bool, - suggestion_applicability: bool) -> JsonEmitter { + pretty: bool) -> JsonEmitter { JsonEmitter { dst, registry, cm: code_map, pretty, - suggestion_applicability, ui_testing: false, } } @@ -137,7 +131,6 @@ struct DiagnosticSpan { /// that should be sliced in atop this span. suggested_replacement: Option, /// If the suggestion is approximate - #[rustc_serialize_exclude_null] suggestion_applicability: Option, /// Macro invocations that created the code at this span, if any. expansion: Option>, @@ -301,12 +294,6 @@ impl DiagnosticSpan { }) }); - let suggestion_applicability = if je.suggestion_applicability { - suggestion.map(|x| x.1) - } else { - None - }; - DiagnosticSpan { file_name: start.file.name.to_string(), byte_start: span.lo().0 - start.file.start_pos.0, @@ -318,7 +305,7 @@ impl DiagnosticSpan { is_primary, text: DiagnosticSpanLine::from_span(span, je), suggested_replacement: suggestion.map(|x| x.0.clone()), - suggestion_applicability, + suggestion_applicability: suggestion.map(|x| x.1), expansion: backtrace_step, label, } diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs index 2c6c18cc51cd7..8b409df1f0996 100644 --- a/src/libsyntax_ext/deriving/encodable.rs +++ b/src/libsyntax_ext/deriving/encodable.rs @@ -190,7 +190,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, Struct(_, ref fields) => { let emit_struct_field = cx.ident_of("emit_struct_field"); let mut stmts = Vec::new(); - for (i, &FieldInfo { name, ref self_, span, attrs, .. }) in fields.iter().enumerate() { + for (i, &FieldInfo { name, ref self_, span, .. }) in fields.iter().enumerate() { let name = match name { Some(id) => id.name, None => Symbol::intern(&format!("_field{}", i)), @@ -213,17 +213,7 @@ fn encodable_substructure(cx: &mut ExtCtxt, cx.expr(span, ExprKind::Ret(Some(call))) }; - // This exists for https://github.com/rust-lang/rust/pull/47540 - // - // If we decide to stabilize that flag this can be removed - let expr = if attrs.iter().any(|a| a.check_name("rustc_serialize_exclude_null")) { - let is_some = cx.ident_of("is_some"); - let condition = cx.expr_method_call(span, self_.clone(), is_some, vec![]); - cx.expr_if(span, condition, call, None) - } else { - call - }; - let stmt = cx.stmt_expr(expr); + let stmt = cx.stmt_expr(call); stmts.push(stmt); } diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr index 40d3758ded5c6..2ec0111ff4b66 100644 --- a/src/test/ui/lint/unused_parens_json_suggestion.stderr +++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr @@ -24,6 +24,7 @@ ], "label": null, "suggested_replacement": null, + "suggestion_applicability": null, "expansion": null } ], @@ -51,6 +52,7 @@ ], "label": null, "suggested_replacement": null, + "suggestion_applicability": null, "expansion": null } ], @@ -80,6 +82,7 @@ ], "label": null, "suggested_replacement": "1 / (2 + 3)", + "suggestion_applicability": "Unspecified", "expansion": null } ], diff --git a/src/test/ui/lint/use_suggestion_json.stderr b/src/test/ui/lint/use_suggestion_json.stderr index b90c5aa3a4bac..ce2657a44953b 100644 --- a/src/test/ui/lint/use_suggestion_json.stderr +++ b/src/test/ui/lint/use_suggestion_json.stderr @@ -89,6 +89,7 @@ mod foo { ], "label": "not found in this scope", "suggested_replacement": null, + "suggestion_applicability": null, "expansion": null } ], @@ -118,6 +119,7 @@ mod foo { "suggested_replacement": "use std::collections::binary_heap::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -140,6 +142,7 @@ mod foo { "suggested_replacement": "use std::collections::btree_map::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -162,6 +165,7 @@ mod foo { "suggested_replacement": "use std::collections::btree_set::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -184,6 +188,7 @@ mod foo { "suggested_replacement": "use std::collections::hash_map::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -206,6 +211,7 @@ mod foo { "suggested_replacement": "use std::collections::hash_set::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -228,6 +234,7 @@ mod foo { "suggested_replacement": "use std::collections::linked_list::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -250,6 +257,7 @@ mod foo { "suggested_replacement": "use std::collections::vec_deque::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -272,6 +280,7 @@ mod foo { "suggested_replacement": "use std::option::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -294,6 +303,7 @@ mod foo { "suggested_replacement": "use std::path::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -316,6 +326,7 @@ mod foo { "suggested_replacement": "use std::result::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -338,6 +349,7 @@ mod foo { "suggested_replacement": "use std::slice::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null }, { @@ -360,6 +372,7 @@ mod foo { "suggested_replacement": "use std::sync::mpsc::Iter; ", + "suggestion_applicability": "Unspecified", "expansion": null } ],