1
Fork 0

Remove rustc_serialize_exclude_null

This commit is contained in:
Manish Goregaokar 2018-05-06 13:30:57 -07:00
parent 30bd586bec
commit 1d8a4d16a7
2 changed files with 2 additions and 17 deletions

View file

@ -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 \

View file

@ -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);
}