Commit Graph

373 Commits

Author SHA1 Message Date
David Tolnay
656ea96c65
Remove reminders about flatten in a sequence 2018-05-20 12:42:40 -07:00
David Tolnay
5302482596
Simplify deserialize_seq_in_place 2018-05-20 12:40:35 -07:00
David Tolnay
7ada27014d
Track field index in internal AST 2018-05-20 12:40:28 -07:00
David Tolnay
4fa2a50f62
Format with rustfmt 0.7.0 2018-05-19 17:33:30 -07:00
David Tolnay
0c5f20c148
Release 1.0.58 2018-05-19 17:30:39 -07:00
David Tolnay
16d1265e17
Fix generated code for deserializing untagged newtype variant 2018-05-19 17:20:14 -07:00
David Tolnay
3b4803115b
Release 1.0.57 2018-05-18 23:31:33 -07:00
David Tolnay
f58000cb41
Release 1.0.56 2018-05-18 12:37:06 -07:00
David Tolnay
6550231a51
Release 1.0.55 2018-05-12 09:47:43 -07:00
David Tolnay
d6b62b9417
Release 1.0.54 2018-05-11 23:02:37 -07:00
David Tolnay
f3f26796c7
Format with rustfmt 0.6.1 2018-05-10 09:11:19 -07:00
David Tolnay
d1460e1f0d
Release 1.0.53 2018-05-10 08:44:53 -07:00
David Tolnay
368961e961
Support deserializing flattened untagged enum 2018-05-10 08:33:47 -07:00
David Tolnay
f9c6f0ab62
Release 1.0.52 2018-05-09 13:01:41 -07:00
David Tolnay
b2b36e1764
Accept implicitly borrowed data inside of Option 2018-05-08 12:19:09 -07:00
David Tolnay
4ad140ea70
Improve error for struct deserialized from array that is too short 2018-05-08 12:03:35 -07:00
David Tolnay
67777eb585
Account for skip_serializing_if in tuple struct length 2018-05-08 11:49:37 -07:00
David Tolnay
b4e51fcc77
Respect skip_serializing in tuple structs and variants 2018-05-08 11:37:52 -07:00
David Tolnay
be7fe2a5eb
Introduce bound attribute on enum variants 2018-05-08 11:16:10 -07:00
David Tolnay
b4076f4577
Release 1.0.51 2018-05-08 10:07:45 -07:00
David Tolnay
c4181f46be
Respect variant skip attribute in inferred bounds 2018-05-07 21:30:00 -07:00
David Tolnay
8c0efc3d77
Add a variant skip attribute 2018-05-07 21:27:34 -07:00
David Tolnay
7e3efaf6c5
Improve error when a 'de lifetime parameter already exists 2018-05-07 21:15:44 -07:00
David Tolnay
12fe42ed45
Support empty adjacently tagged enum 2018-05-07 21:02:42 -07:00
David Tolnay
7cd4f49c76
Release 1.0.50 2018-05-07 13:51:32 -07:00
David Tolnay
0025ef9aba
Detect deserialize on a struct ending in dynamically sized slice 2018-05-07 11:52:59 -07:00
David Tolnay
536bdd77a0
Release 1.0.49 2018-05-07 11:51:15 -07:00
David Tolnay
dc921892be
Eliminate map_or(None, f) 2018-05-07 11:23:04 -07:00
David Tolnay
62557731c3
Enable pedantic clippy lints in serde_derive 2018-05-07 11:03:09 -07:00
David Tolnay
30824e9f61
Release 1.0.48 2018-05-07 10:22:26 -07:00
David Tolnay
6475e73b05
Less horrible logic for missing fields that unconditionally return error 2018-05-06 22:20:35 -07:00
David Tolnay
3cd9d071c2
Fix adjacently tagged empty tuple variant or struct variant 2018-05-06 21:50:40 -07:00
David Tolnay
9dc05c36f0
Release 1.0.47 2018-05-06 21:39:21 -07:00
David Tolnay
94b857057b
Support deserializing enums containing flatten 2018-05-06 20:41:02 -07:00
David Tolnay
979df3427b
Support serializing enums containing flatten 2018-05-06 20:14:35 -07:00
David Tolnay
978d64993e
Allow flatten attribute in enums 2018-05-06 20:14:28 -07:00
David Tolnay
5098609935
Release 1.0.46 2018-05-06 13:44:55 -07:00
David Tolnay
6374467f02
Merge pull request #1245 from serde-rs/flat
Support deserializing a flattened internally tagged enum
2018-05-06 13:43:44 -07:00
David Tolnay
3859f58d9b
Move derive internals into serde_derive crate
We can continue to publish serde_derive_internals independently but
serde_derive no longer has a dependency on it. This improves compile
time of serde_derive by 7%.
2018-05-05 23:46:30 -07:00
David Tolnay
aac1c65033
Simplify implementation of flattened internally tagged enum
The fact that the tag entry is consumed was only observable if there is
a later flattened map field, at which point the behavior is already
confusing anyway.

    #[derive(Deserialize)]
    struct Example {
        #[serde(flatten)]
        a: InternallyTagged,
        #[serde(flatten)]
        rest: BTreeMap<String, Value>,
    }

Before this simplification the map would receive all the fields of the
internally tagged enum but not its tag, after it receives all the fields
including the tag.
2018-05-05 22:30:46 -07:00
David Tolnay
d8120e19bc
Support deserializing a flattened internally tagged enum 2018-05-05 21:52:16 -07:00
David Tolnay
f263e3fcec
Format serde_derive generated where-clauses 2018-05-05 18:24:16 -07:00
David Tolnay
47676cdb49
Clean up references to Ident 2018-05-05 00:45:30 -07:00
David Tolnay
93bddb361e
Fix toplevel_ref_arg lint 2018-05-05 00:39:26 -07:00
David Tolnay
adb1c9540d
Remove a layer of wrapping in deserialize_with untagged newtype variant 2018-05-05 00:25:27 -07:00
David Tolnay
0e1d065402
Format with rustfmt 0.6.1 2018-05-05 00:18:21 -07:00
David Tolnay
8c3b52e308
Remove a layer of wrapping in deserialize_with newtype struct 2018-05-05 00:17:00 -07:00
David Tolnay
3f0d3453d8
Release 1.0.45 2018-05-02 15:18:17 -07:00
David Tolnay
b78f434086
Pretend remote derives are not dead code 2018-05-02 14:23:59 -07:00
David Tolnay
893c0578dd
Release 1.0.44 2018-05-01 22:34:27 -07:00
David Tolnay
cb2b92f828
Handle flatten + deserialize_with 2018-05-01 22:25:06 -07:00
David Tolnay
47a4ffbd31
Fill in missing fully qualified paths in flatten 2018-05-01 22:24:25 -07:00
David Tolnay
d82d1707d6
Format with rustfmt 0.6.0 2018-04-30 01:42:46 -07:00
David Tolnay
89278996c5
Release 1.0.43 2018-04-23 11:23:58 -07:00
Igor Gnatenko
f3cb7c7a32
derive: bump min version of quote to 0.5.2
Fixes: https://github.com/serde-rs/serde/issues/1230
2018-04-22 09:22:47 +02:00
David Tolnay
af795e2e54
Release 1.0.42 2018-04-21 15:16:10 -07:00
David Tolnay
df93fab5fa
Reduce instantiations of Result::map in Deserialize of unit variants
This eliminates 110 instantiations of Result::map in Xi and reduces
binary size by 229 kilobytes.
2018-04-21 13:27:17 -07:00
David Tolnay
6d1807bb4a
Improve Serialize of adjacently tagged newtype variants
The existing implementation was unnecessarily complicated.

    struct __AdjacentlyTagged<'__a> {
        data: (&'__a String,),
        phantom: _serde::export::PhantomData<AdjacentlyTagged>,
    }
    impl<'__a> _serde::Serialize for __AdjacentlyTagged<'__a> {
        fn serialize<__S>(
            &self,
            __serializer: __S,
        ) -> _serde::export::Result<__S::Ok, __S::Error>
        where
            __S: _serde::Serializer,
        {
            let (__field0,) = self.data;
            _serde::Serialize::serialize(__field0, __serializer)
        }
    }
    _serde::ser::SerializeStruct::serialize_field(
        &mut __struct,
        "content",
        &__AdjacentlyTagged {
            data: (__field0,),
            phantom: _serde::export::PhantomData::<AdjacentlyTagged>,
        },
    )?;

Instead the new implementation does simply:

    _serde::ser::SerializeStruct::serialize_field(
        &mut __struct,
        "content",
        __field0,
    )?;
2018-04-21 11:41:39 -07:00
David Tolnay
b37cf858ce
Remove unneeded quote_spanned that uses call_site 2018-04-21 11:33:39 -07:00
David Tolnay
5f8fa33756
Quote's default has changed to call_site 2018-04-21 11:33:38 -07:00
David Tolnay
607966dcf7
Fix error message type inference in compile-fail/remote/wrong_de.rs 2018-04-21 11:21:13 -07:00
David Tolnay
6a8c39b2aa
More efficient try!() alternative 2018-04-21 10:53:13 -07:00
David Tolnay
382f3c2771
Release 1.0.41 2018-04-19 22:13:45 -07:00
David Tolnay
541f9180cf
Release 1.0.40 2018-04-19 10:31:33 -07:00
David Tolnay
184264ee92
Release 1.0.39 2018-04-17 11:35:45 -07:00
David Tolnay
8d113e67d6
Release 1.0.38 2018-04-14 20:30:18 -07:00
David Tolnay
6e206ce053
Name formatter args with a leading double underscore 2018-04-13 00:21:21 -07:00
David Tolnay
47fc9af472
Emit borrowed methods only if collect_other_fields
Without collect_other_fields, the visit_borrowed_str and
visit_borrowed_bytes implementations that were being generated were
identical to their default implementation of forwarding to visit_str and
visit_bytes.
2018-04-13 00:17:34 -07:00
David Tolnay
1651f86d56
Simplify Option that is always Some 2018-04-13 00:17:30 -07:00
David Tolnay
1157ac0118
Eliminate unnecessary braces in wrap_deserialize_variant_with 2018-04-12 23:48:38 -07:00
David Tolnay
202c10147e
Fix deserialize_with on a struct variant with one field 2018-04-12 23:44:53 -07:00
David Tolnay
9f38ca032e
Format with rustfmt 0.4.1 2018-04-12 23:04:47 -07:00
David Tolnay
00178ba795
Eliminate generic functions in bound.rs 2018-04-12 22:48:31 -07:00
David Tolnay
24700ebeb6
Move associated type search into with_bounds 2018-04-12 22:46:53 -07:00
David Tolnay
f06001c086
Name type_params consistently with Syn 2018-04-12 22:04:34 -07:00
David Tolnay
ec773fb7db
Make use of Generics::type_params iterator 2018-04-12 22:03:40 -07:00
David Tolnay
da8b457f66
Simplify with_where_predicates_from_fields 2018-04-12 21:47:08 -07:00
Osspial
629bf7b354 Fix clippy warnings 2018-04-12 18:40:06 -04:00
Osspial
4415d10c61 Fix associated types only working for first generic parameter
Also, removes extraneous `where for`
2018-04-12 16:44:34 -04:00
Osspial
2e824e9aba Limit type bounds to associated types 2018-04-10 10:53:37 -04:00
Osspial
fd14332729 Ignore skipped fields 2018-04-09 23:57:20 -04:00
Osspial
c413775574 Add partially-working where bounds for associated types 2018-04-09 23:22:18 -04:00
David Tolnay
eed18ffab2
Release 1.0.37 2018-04-01 22:30:32 -07:00
David Tolnay
f8e1fa8ebc
Use Generics::make_where_clause helper 2018-04-01 22:25:50 -07:00
David Tolnay
ba002e1119
Update signature of Lifetime::new 2018-03-31 23:46:25 +02:00
David Tolnay
8b44eb8bfc
Add parens to TraitBound 2018-03-31 23:45:30 +02:00
David Tolnay
d82a0cc5ff
Remove use of Span::located_at 2018-03-31 23:44:50 +02:00
Alex Crichton
b1c1d964e1 Update to syn/quote/proc-macro2 new apis 2018-03-29 00:54:05 -07:00
David Tolnay
d2b65e0a5d
Prefer call site spans 2018-03-28 10:49:30 +02:00
David Tolnay
7c04c98e0e
Release 1.0.36 2018-03-27 11:35:45 +02:00
David Tolnay
23e2e92237
Release 1.0.35 2018-03-25 12:59:02 +02:00
David Tolnay
c1602a4d76
Deserialize map in place cannot have flatten attributes 2018-03-25 12:42:36 +02:00
David Tolnay
c23be3f855
Revert flatten change in deserialize in place 2018-03-25 12:39:20 +02:00
David Tolnay
e5ed440136
Always check flatten assertions 2018-03-25 12:32:06 +02:00
David Tolnay
2b18b57d84
Release 1.0.34 2018-03-22 15:06:21 -07:00
Armin Ronacher
e4ef087735 Added support for borrowing when flattening 2018-03-20 15:19:36 +01:00
Armin Ronacher
695c3eedcb Do not imply flatten from skip_serialize 2018-03-20 14:45:14 +01:00
Armin Ronacher
50c636a923 Remove now dead as_map detection (can be cattrs.has_flatten) 2018-03-20 13:43:23 +01:00
Armin Ronacher
5b884b5bf9 Added some missing UFCs 2018-03-20 13:38:22 +01:00
Armin Ronacher
abeea89147 Fully qualify some calls in generated code and fix a bad comment 2018-03-20 13:35:16 +01:00