diff options
| author | Skgland <bb-github@t-online.de> | 2021-02-04 22:49:50 +0100 |
|---|---|---|
| committer | Skgland <bb-github@t-online.de> | 2021-02-09 13:42:36 +0100 |
| commit | 0375022c73c05925871e440e086ed4e266e61ee7 (patch) | |
| tree | d64baadb2619cbaf078eb619d534f8dd5d3d9ede /compiler | |
| parent | 091ef95f8eaec353b8dc7934e8b43a0b5133e3c7 (diff) | |
| download | rust-0375022c73c05925871e440e086ed4e266e61ee7.tar.gz rust-0375022c73c05925871e440e086ed4e266e61ee7.zip | |
fix derive(RustcEncodable, RustcDecodable)
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_builtin_macros/src/deriving/decodable.rs | 15 | ||||
| -rw-r--r-- | compiler/rustc_builtin_macros/src/deriving/encodable.rs | 15 |
2 files changed, 12 insertions, 18 deletions
diff --git a/compiler/rustc_builtin_macros/src/deriving/decodable.rs b/compiler/rustc_builtin_macros/src/deriving/decodable.rs index 470d98c117e..1d892b20729 100644 --- a/compiler/rustc_builtin_macros/src/deriving/decodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/decodable.rs @@ -92,7 +92,7 @@ fn decodable_substructure( Named(ref fields) => fields.len(), }; let fn_read_struct_field_path: Vec<_> = - cx.def_site_path(&[sym::rustc_serialize, sym::Decodable, sym::read_struct_field]); + cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_struct_field]); let path = cx.path_ident(trait_span, substr.type_ident); let result = @@ -113,7 +113,7 @@ fn decodable_substructure( }); let result = cx.expr_ok(trait_span, result); let fn_read_struct_path: Vec<_> = - cx.def_site_path(&[sym::rustc_serialize, sym::Decodable, sym::read_struct]); + cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_struct]); cx.expr_call_global( trait_span, @@ -132,11 +132,8 @@ fn decodable_substructure( let mut arms = Vec::with_capacity(fields.len() + 1); let mut variants = Vec::with_capacity(fields.len()); - let fn_read_enum_variant_arg_path: Vec<_> = cx.def_site_path(&[ - sym::rustc_serialize, - sym::Decodable, - sym::read_enum_variant_arg, - ]); + let fn_read_enum_variant_arg_path: Vec<_> = + cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_enum_variant_arg]); for (i, &(ident, v_span, ref parts)) in fields.iter().enumerate() { variants.push(cx.expr_str(v_span, ident.name)); @@ -168,14 +165,14 @@ fn decodable_substructure( let variant_vec = cx.expr_vec(trait_span, variants); let variant_vec = cx.expr_addr_of(trait_span, variant_vec); let fn_read_enum_variant_path: Vec<_> = - cx.def_site_path(&[sym::rustc_serialize, sym::Decodable, sym::read_enum_variant]); + cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_enum_variant]); let result = cx.expr_call_global( trait_span, fn_read_enum_variant_path, vec![blkdecoder, variant_vec, lambda], ); let fn_read_enum_path: Vec<_> = - cx.def_site_path(&[sym::rustc_serialize, sym::Decodable, sym::read_enum]); + cx.def_site_path(&[sym::rustc_serialize, sym::Decoder, sym::read_enum]); cx.expr_call_global( trait_span, diff --git a/compiler/rustc_builtin_macros/src/deriving/encodable.rs b/compiler/rustc_builtin_macros/src/deriving/encodable.rs index 8aa805416ff..01a57bea14e 100644 --- a/compiler/rustc_builtin_macros/src/deriving/encodable.rs +++ b/compiler/rustc_builtin_macros/src/deriving/encodable.rs @@ -180,7 +180,7 @@ fn encodable_substructure( match *substr.fields { Struct(_, ref fields) => { let fn_emit_struct_field_path = - cx.def_site_path(&[sym::rustc_serialize, sym::Encodable, sym::emit_struct_field]); + cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_struct_field]); let mut stmts = Vec::new(); for (i, &FieldInfo { name, ref self_, span, .. }) in fields.iter().enumerate() { let name = match name { @@ -222,7 +222,7 @@ fn encodable_substructure( }; let fn_emit_struct_path = - cx.def_site_path(&[sym::rustc_serialize, sym::Encodable, sym::emit_struct]); + cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_struct]); cx.expr_call_global( trait_span, @@ -244,11 +244,8 @@ fn encodable_substructure( let me = cx.stmt_let(trait_span, false, blkarg, encoder); let encoder = cx.expr_ident(trait_span, blkarg); - let fn_emit_enum_variant_arg_path: Vec<_> = cx.def_site_path(&[ - sym::rustc_serialize, - sym::Encodable, - sym::emit_enum_variant_arg, - ]); + let fn_emit_enum_variant_arg_path: Vec<_> = + cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_enum_variant_arg]); let mut stmts = Vec::new(); if !fields.is_empty() { @@ -281,7 +278,7 @@ fn encodable_substructure( let name = cx.expr_str(trait_span, variant.ident.name); let fn_emit_enum_variant_path: Vec<_> = - cx.def_site_path(&[sym::rustc_serialize, sym::Encodable, sym::emit_enum_variant]); + cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_enum_variant]); let call = cx.expr_call_global( trait_span, @@ -297,7 +294,7 @@ fn encodable_substructure( let blk = cx.lambda1(trait_span, call, blkarg); let fn_emit_enum_path: Vec<_> = - cx.def_site_path(&[sym::rustc_serialize, sym::Encodable, sym::emit_enum]); + cx.def_site_path(&[sym::rustc_serialize, sym::Encoder, sym::emit_enum]); let ret = cx.expr_call_global( trait_span, fn_emit_enum_path, |
