From 30bd586bec5efb8317a6fdf6ce53b64fac567270 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 6 May 2018 13:30:06 -0700 Subject: Stabilize suggestion applicability field in json output --- src/libsyntax/json.rs | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index 2f15e75093b..f129aea32b8 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -38,22 +38,18 @@ pub struct JsonEmitter { registry: 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, } -- cgit 1.4.1-3-g733a5 From 1d8a4d16a7b1fb1d38302ea38290ace2d6bf2180 Mon Sep 17 00:00:00 2001 From: Manish Goregaokar Date: Sun, 6 May 2018 13:30:57 -0700 Subject: Remove rustc_serialize_exclude_null --- src/libsyntax/feature_gate.rs | 5 ----- src/libsyntax_ext/deriving/encodable.rs | 14 ++------------ 2 files changed, 2 insertions(+), 17 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 604df862dc2..709c3653b02 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -846,11 +846,6 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG is just used for rustc unit tests \ and will never be stable", cfg_fn!(rustc_attrs))), - ("rustc_serialize_exclude_null", Normal, Gated(Stability::Unstable, - "rustc_attrs", - "the `#[rustc_serialize_exclude_null]` attribute \ - is an internal-only feature", - cfg_fn!(rustc_attrs))), ("rustc_synthetic", Whitelisted, Gated(Stability::Unstable, "rustc_attrs", "this attribute \ diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs index 2c6c18cc51c..8b409df1f09 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); } -- cgit 1.4.1-3-g733a5