Skip to content

Commit

Permalink
Remove rustc_serialize_exclude_null
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed May 21, 2018
1 parent 30bd586 commit 1d8a4d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
5 changes: 0 additions & 5 deletions src/libsyntax/feature_gate.rs
Expand Up @@ -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 \
Expand Down
14 changes: 2 additions & 12 deletions src/libsyntax_ext/deriving/encodable.rs
Expand Up @@ -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)),
Expand All @@ -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);
}

Expand Down

0 comments on commit 1d8a4d1

Please sign in to comment.