Commit Graph

3832 Commits

Author SHA1 Message Date
Mingun
bb51e68f16 Keep aliases sorted 2023-07-23 15:21:21 +05:00
David Tolnay
27414c90a8
Merge pull request #2522 from serde-rs/leak
Leak all memory allocated during macro expansion
2023-07-22 08:37:52 -07:00
David Tolnay
50e2f4b213
Leak all memory allocated during macro expansion 2023-07-22 08:32:18 -07:00
David Tolnay
22be673beb
Release 1.0.174 2023-07-20 22:20:37 -07:00
David Tolnay
166c89fabf
Opt in to generate-link-to-definition when building on docs.rs 2023-07-20 22:19:03 -07:00
David Tolnay
6e0b13eedb
Release 1.0.173 2023-07-19 16:34:13 -07:00
David Tolnay
7e8f978ca9
Handle $crate special case 2023-07-19 16:32:59 -07:00
David Tolnay
6c0e838a7c
Always consider empty output to be unsuccessful 2023-07-19 16:13:02 -07:00
David Tolnay
d3da41927a
Enable full expression parsing for precompiled serde_derive 2023-07-19 16:01:18 -07:00
David Tolnay
425a4b7a74
Check precompiled subprocess exit status 2023-07-19 16:00:37 -07:00
David Tolnay
63c65ef742
Release 1.0.172 2023-07-19 14:13:56 -07:00
David Tolnay
e838b0bd81
Release 1.0.172-alpha.0 2023-07-19 14:00:50 -07:00
David Tolnay
041e99c78a
Implement fallback to compiling serde_derive from source 2023-07-19 13:53:49 -07:00
David Tolnay
07dcc4f7fe
Remove unneeded 'include' Cargo.toml entries 2023-07-19 13:44:55 -07:00
David Tolnay
b88052d875
Rearrange precompiled directory 2023-07-19 13:24:36 -07:00
David Tolnay
a28292764c
Publish precompiled deserialize_in_place 2023-07-19 12:29:30 -07:00
David Tolnay
2027088741
Support precompiled deserialize_in_place 2023-07-19 12:27:37 -07:00
David Tolnay
e2d8589976
Publish span-related fixes 2023-07-19 09:41:11 -07:00
David Tolnay
c8a9f99d14
Preserve Group span better on compilers without Span::join 2023-07-19 09:39:11 -07:00
David Tolnay
645d04012d
Fix off by one span counter, 0 is used for call_site() 2023-07-19 09:26:56 -07:00
David Tolnay
100ddada2f
Suppress dead_code on fields only accessed by deserialize_in_place
error: field `option` is never read
       --> test_suite/tests/test_gen.rs:666:9
        |
    665 |     struct ImplicitlyBorrowedOption<'a> {
        |            ------------------------ field in this struct
    666 |         option: std::option::Option<&'a str>,
        |         ^^^^^^
        |
    note: the lint level is defined here
       --> test_suite/tests/test_gen.rs:5:9
        |
    5   | #![deny(warnings)]
        |         ^^^^^^^^
        = note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`

    error: fields `ty` and `id` are never read
       --> test_suite/tests/test_gen.rs:696:9
        |
    695 |     struct RelObject<'a> {
        |            --------- fields in this struct
    696 |         ty: &'a str,
        |         ^^
    697 |         id: String,
        |         ^^

    error: field `field` is never read
       --> test_suite/tests/test_gen.rs:740:17
        |
    739 |             struct MacroRules<'a> {
        |                    ---------- field in this struct
    740 |                 field: $field,
        |                 ^^^^^
    ...
    745 |     deriving!(&'a str);
        |     ------------------ in this macro invocation
        |
        = note: this error originates in the macro `deriving` (in Nightly builds, run with -Z macro-backtrace for more info)

    error: field `f` is never read
       --> test_suite/tests/test_gen.rs:756:9
        |
    754 |     struct BorrowLifetimeInsideMacro<'a> {
        |            ------------------------- field in this struct
    755 |         #[serde(borrow = "'a")]
    756 |         f: mac!(Cow<'a, str>),
        |         ^

    warning: fields `question` and `answer` are never read
        --> test_suite/tests/test_annotations.rs:2969:9
         |
    2968 |     struct Struct {
         |            ------ fields in this struct
    2969 |         question: String,
         |         ^^^^^^^^
    2970 |         answer: u32,
         |         ^^^^^^
         |
         = note: `#[warn(dead_code)]` on by default
2023-07-19 09:12:35 -07:00
David Tolnay
2ef1cd4b35
Import macros exclusively through serde_derive in test suite
This makes it easier to execute tests against the precompiled serde_derive.
2023-07-19 09:08:05 -07:00
David Tolnay
be9c3fd69d
Publish raw string fix 2023-07-18 18:42:54 -07:00
David Tolnay
ef522e1d16
Add a reminder about trim-paths 2023-07-18 18:39:40 -07:00
David Tolnay
1ddb6c2fdb
Fix handling of raw idents in proc-macro2 shim 2023-07-18 18:29:24 -07:00
David Tolnay
eb3f2329af
Merge pull request #2514 from dtolnay/precompiled
Add experiment to produce precompiled builds of serde_derive
2023-07-18 13:48:17 -07:00
David Tolnay
9e8f14816b
Add experiment to produce precompiled builds of serde_derive 2023-07-18 13:37:36 -07:00
Mingun
4e5e55bf1c Remove custom implementations of SeqDeserializer and MapDeserializer for enums
Those deserializers are used to deserialize tuple or struct variants from Content
which is used by internally tagged enums and by flatten

FlatMapDeserializer is reached in the following tests:
    flatten::enum_::externally_tagged::newtype
    flatten::enum_::externally_tagged::struct_from_map
    flatten::enum_::externally_tagged::struct_from_seq
    flatten::enum_::externally_tagged::tuple

ContentDeserializer is reached in the following tests:
    test_enum_in_internally_tagged_enum
    test_internally_tagged_struct_variant_containing_unit_variant
2023-07-11 22:01:48 +05:00
Mingun
4513a9e6a7 Move test_flatten_enum_newtype into new group of flatten tests - flatten::enum_::externally_tagged::newtype 2023-07-11 22:00:38 +05:00
Mingun
4f922e4e5b Implement serialization of flattened tuple variants of externally tagged enums
The Container struct

  struct Container {
    #[serde(flatten)]
    enum_field: Enum,
  }
  enum Enum {
    Tuple(u32, u32),
  }

now can be serialized to JSON as

  { "enum_field": [1, 2] }

Deserialization already works

Fixes (1):
    flatten::enum_::externally_tagged::tuple
2023-07-11 22:00:10 +05:00
Mingun
993966600e Implement tests for crate::private:🇩🇪:content::VariantDeserializer
failures (1):
    flatten::enum_::externally_tagged::tuple
2023-07-11 21:59:22 +05:00
Mingun
5b96cf1bde Use traditional order for enum variants (Unit, Newtype, Tuple, Struct) and names for tag and content fields 2023-07-11 21:58:43 +05:00
Mingun
f3d50e5209 Use FromIterator to fill HashMap 2023-07-11 21:58:14 +05:00
Mingun
ab21d4d017 Merge assert_de_tokens and assert_ser_tokens into assert_tokens 2023-07-11 21:57:49 +05:00
Mingun
f7c5d93e6a Pull up types from function into module, unify style 2023-07-11 21:57:22 +05:00
Mingun
52a7d40e6e Rename test types so their names reflects, what's tested 2023-07-11 21:56:53 +05:00
Mingun
348bc6b257 Move flatten enum tests to a dedicated module
(review with "ignore whitespace" option on and editor that shows line moves,
for example, TortoiseGitMerge)
2023-07-11 21:56:22 +05:00
David Tolnay
03da66c805
Release 1.0.171 2023-07-09 18:05:02 -07:00
David Tolnay
f75426f47e
Inline visitor_expr of unit struct deserialize impl 2023-07-09 18:03:58 -07:00
David Tolnay
662fc3861c
Add test of const-generic unit struct where-clause edge case
Closes #2501.
2023-07-09 18:01:43 -07:00
David Tolnay
28c10020b9
Merge pull request #2500 from Baptistemontan/derive_generic_unit_struct
Allow `[derive(serde::Deserialize)]` for generic unit structs
2023-07-09 17:52:12 -07:00
Baptiste de Montangon
89c8d85de9 allow Deserialize derive to handle generic unit structs 2023-07-10 01:31:40 +02:00
David Tolnay
6502838f27
Release 1.0.170 2023-07-09 11:17:30 -07:00
David Tolnay
c93a0f335a
Merge pull request #2499 from dtolnay/strsuffix
Reject suffixed string literals inside serde attrs
2023-07-09 11:16:31 -07:00
David Tolnay
8264e002a7
Reject suffixed string literals inside serde attrs 2023-07-09 11:13:24 -07:00
David Tolnay
117ef22142
Add ui test with suffixed string literals in attribute 2023-07-09 11:09:38 -07:00
David Tolnay
3fb5e71c33
Release 1.0.169 2023-07-08 21:09:08 -07:00
David Tolnay
296db177e2
Pull in syn fix for issue 2414 2023-07-08 21:08:22 -07:00
David Tolnay
e4a4389177
Delete excessive tests of adjacently tagged non-string keys 2023-07-08 18:23:31 -07:00
David Tolnay
7aa0453c3b
Merge pull request 2475 from Baptistemontan/master 2023-07-08 18:07:16 -07:00