Compare commits

...

62 Commits

Author SHA1 Message Date
David Tolnay af31449cb1 Run test suite on wa-serde-derive 2022-07-01 17:56:18 -07:00
David Tolnay 1afae183b0 Compile serde_derive to wasm 2022-07-01 17:55:51 -07:00
David Tolnay 845b900fd5 Exclude deliberately pinned prettyplease crate from cargo outdated 2022-06-22 21:07:57 -07:00
David Tolnay 7891ae7184 Merge pull request #2228 from serde-rs/expandtest
Update macrotest to 1.0.9 and enable in CI
2022-06-20 03:53:50 -07:00
David Tolnay bac90d19b9 Update macrotest to 1.0.9 and enable in CI 2022-06-20 03:40:49 -07:00
David Tolnay 227bf3023a Merge pull request #2229 from dtolnay/expandlinguist
Mark expandtest outputs as generated code
2022-06-20 03:40:37 -07:00
David Tolnay f4535f68c1 Mark expandtest outputs as generated code 2022-06-20 03:27:20 -07:00
David Tolnay c6c35b5a31 Ignore buggy doc_link_with_quotes clippy lint
https://github.com/rust-lang/rust-clippy/issues/8961

    error: possible intra-doc link using quotes instead of backticks
       --> serde_test/src/token.rs:277:5
        |
    277 |     /// let vec = vec!['a', 'b', 'c'];
        |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::doc-link-with-quotes` implied by `-D clippy::pedantic`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_link_with_quotes
2022-06-07 00:30:50 -07:00
David Tolnay 31e51324e2 Add actions job to notice outdated dependencies 2022-06-06 16:09:41 -07:00
David Tolnay bc3f24e0e9 Update toolchain_find dependency to 0.2 2022-06-06 16:09:14 -07:00
David Tolnay 2e38e2bf2f Ignore derive_partial_eq_without_eq clippy lint
error: you are deriving `PartialEq` and can implement `Eq`
      --> serde/src/de/value.rs:51:17
       |
    51 | #[derive(Clone, PartialEq)]
       |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = note: `-D clippy::derive-partial-eq-without-eq` implied by `-D clippy::all`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> serde_derive/src/internals/case.rs:13:23
       |
    13 | #[derive(Copy, Clone, PartialEq)]
       |                       ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
     --> test_suite/tests/unstable/mod.rs:6:21
      |
    6 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
      |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
     --> test_suite/tests/test_ignored_any.rs:7:10
      |
    7 | #[derive(PartialEq, Debug, Deserialize)]
      |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
     --> test_suite/tests/test_identifier.rs:7:34
      |
    7 |     #[derive(Deserialize, Debug, PartialEq)]
      |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
      |
      = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_identifier.rs:24:34
       |
    24 |     #[derive(Deserialize, Debug, PartialEq)]
       |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_identifier.rs:41:34
       |
    41 |     #[derive(Deserialize, Debug, PartialEq)]
       |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_identifier.rs:59:34
       |
    59 |     #[derive(Deserialize, Debug, PartialEq)]
       |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_ser.rs:46:10
       |
    46 | #[derive(PartialEq, Debug)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_value.rs:11:34
       |
    11 |     #[derive(Deserialize, Debug, PartialEq)]
       |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de_error.rs:15:23
       |
    15 | #[derive(Copy, Clone, PartialEq, Debug, Deserialize)]
       |                       ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de_error.rs:18:10
       |
    18 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de_error.rs:26:10
       |
    26 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de_error.rs:34:10
       |
    34 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de_error.rs:41:19
       |
    41 | #[derive(Default, PartialEq, Debug)]
       |                   ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de_error.rs:60:10
       |
    60 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_borrow.rs:70:34
       |
    70 |     #[derive(Deserialize, Debug, PartialEq)]
       |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_borrow.rs:97:34
       |
    97 |     #[derive(Deserialize, Debug, PartialEq)]
       |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_borrow.rs:106:34
        |
    106 |     #[derive(Deserialize, Debug, PartialEq)]
        |                                  ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de.rs:43:23
       |
    43 | #[derive(Copy, Clone, PartialEq, Debug, Deserialize)]
       |                       ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de.rs:46:10
       |
    46 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de.rs:49:10
       |
    49 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de.rs:52:10
       |
    52 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de.rs:76:10
       |
    76 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_de.rs:82:10
       |
    82 | #[derive(PartialEq, Debug, Deserialize)]
       |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_de.rs:102:10
        |
    102 | #[derive(PartialEq, Debug, Deserialize)]
        |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_de.rs:109:19
        |
    109 | #[derive(Default, PartialEq, Debug)]
        |                   ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_de.rs:128:10
        |
    128 | #[derive(PartialEq, Debug, Deserialize)]
        |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_de.rs:135:10
        |
    135 | #[derive(PartialEq, Debug)]
        |          ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_de.rs:185:14
        |
    185 |     #[derive(PartialEq, Debug, Deserialize)]
        |              ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
      --> test_suite/tests/test_macros.rs:25:17
       |
    25 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
       |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
       |
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_macros.rs:110:17
        |
    110 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_macros.rs:580:21
        |
    580 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_macros.rs:607:21
        |
    607 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_macros.rs:681:21
        |
    681 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_macros.rs:684:21
        |
    684 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_macros.rs:816:21
        |
    816 |     #[derive(Debug, PartialEq, Deserialize)]
        |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_macros.rs:976:21
        |
    976 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1027:21
         |
    1027 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1273:21
         |
    1273 |     #[derive(Debug, PartialEq, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1342:21
         |
    1342 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1413:21
         |
    1413 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1450:21
         |
    1450 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1474:21
         |
    1474 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1509:21
         |
    1509 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1543:21
         |
    1543 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1601:21
         |
    1601 |     #[derive(Debug, PartialEq, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1743:45
         |
    1743 |     #[derive(Serialize, Deserialize, Debug, PartialEq)]
         |                                             ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1763:45
         |
    1763 |     #[derive(Serialize, Deserialize, Debug, PartialEq)]
         |                                             ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1770:45
         |
    1770 |     #[derive(Serialize, Deserialize, Debug, PartialEq)]
         |                                             ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1870:21
         |
    1870 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_macros.rs:1888:21
         |
    1888 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:108:17
        |
    108 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:124:17
        |
    124 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:147:17
        |
    147 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:344:17
        |
    344 | #[derive(Debug, PartialEq, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:394:17
        |
    394 | #[derive(Debug, PartialEq)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:413:17
        |
    413 | #[derive(Debug, PartialEq)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:458:17
        |
    458 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:512:17
        |
    512 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:520:17
        |
    520 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:528:17
        |
    528 | #[derive(Debug, PartialEq, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:647:17
        |
    647 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_gen.rs:835:17
        |
    835 | #[derive(Debug, PartialEq, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
       --> test_suite/tests/test_annotations.rs:675:17
        |
    675 | #[derive(Debug, PartialEq, Deserialize)]
        |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
        |
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1047:17
         |
    1047 | #[derive(Debug, PartialEq)]
         |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1050:17
         |
    1050 | #[derive(Debug, PartialEq)]
         |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1196:17
         |
    1196 | #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1514:17
         |
    1514 | #[derive(Debug, PartialEq, Deserialize)]
         |                 ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1548:41
         |
    1548 | #[derive(Clone, Serialize, Deserialize, PartialEq, Debug)]
         |                                         ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1566:41
         |
    1566 | #[derive(Clone, Serialize, Deserialize, PartialEq, Debug)]
         |                                         ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1600:30
         |
    1600 | #[derive(Clone, Deserialize, PartialEq, Debug)]
         |                              ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1803:21
         |
    1803 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1843:21
         |
    1843 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1852:21
         |
    1852 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:1947:21
         |
    1947 |     #[derive(Debug, PartialEq, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2003:21
         |
    2003 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2037:21
         |
    2037 |     #[derive(Debug, PartialEq, Serialize, Deserialize)]
         |                     ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2074:45
         |
    2074 |     #[derive(Deserialize, Serialize, Debug, PartialEq)]
         |                                             ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2080:45
         |
    2080 |     #[derive(Deserialize, Serialize, Debug, PartialEq)]
         |                                             ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2157:38
         |
    2157 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2193:38
         |
    2193 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2200:38
         |
    2200 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2240:38
         |
    2240 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2279:38
         |
    2279 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2316:38
         |
    2316 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2359:38
         |
    2359 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2390:38
         |
    2390 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2421:38
         |
    2421 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2426:38
         |
    2426 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2483:38
         |
    2483 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2507:38
         |
    2507 |     #[derive(Serialize, Deserialize, PartialEq, Debug)]
         |                                      ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2521:27
         |
    2521 |     #[derive(Deserialize, PartialEq, Debug)]
         |                           ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2552:27
         |
    2552 |     #[derive(Deserialize, PartialEq, Debug)]
         |                           ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2558:27
         |
    2558 |     #[derive(Deserialize, PartialEq, Debug)]
         |                           ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2586:14
         |
    2586 |     #[derive(PartialEq, Debug)]
         |              ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2624:27
         |
    2624 |     #[derive(Deserialize, PartialEq, Debug)]
         |                           ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

    error: you are deriving `PartialEq` and can implement `Eq`
        --> test_suite/tests/test_annotations.rs:2647:27
         |
    2647 |     #[derive(Deserialize, PartialEq, Debug)]
         |                           ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
2022-05-21 20:43:51 -07:00
David Tolnay 819f90d9f6 Ignore unused_macro_rules warning in test macros
warning: 1st rule of macro `btreeset` is never used
     --> test_suite/tests/macros/mod.rs:5:5
      |
    5 |     () => {
      |     ^^
      |
      = note: `#[warn(unused_macro_rules)]` on by default

    warning: 1st rule of macro `hashset` is never used
      --> test_suite/tests/macros/mod.rs:27:5
       |
    27 |     () => {
       |     ^^

    warning: 1st rule of macro `hashmap` is never used
      --> test_suite/tests/macros/mod.rs:44:5
       |
    44 |     () => {
       |     ^^

    warning: 1st rule of macro `hashset` is never used
      --> test_suite/tests/macros/mod.rs:27:5
       |
    27 |     () => {
       |     ^^
       |
       = note: `#[warn(unused_macro_rules)]` on by default
2022-05-12 21:33:43 -07:00
David Tolnay 2eed86cd67 Remove doc(hidden) attribute that is being phased out
warning: `#[doc(hidden)]` is ignored on trait impl items
       --> serde/src/de/impls.rs:796:5
        |
    796 |     #[doc(hidden)]
        |     ^^^^^^^^^^^^^^ help: remove this attribute
        |
        = note: `#[warn(unused_attributes)]` on by default
        = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
        = note: whether the impl item is `doc(hidden)` or not entirely depends on the corresponding trait item
2022-05-09 21:16:16 -07:00
David Tolnay 3921b57435 Run miri in stricter miri-strict-provenance mode 2022-05-06 04:01:35 -07:00
David Tolnay 68069d734a Fix needless_borrow for both value=Cow<str> and value=&str 2022-05-05 21:07:33 -07:00
David Tolnay dc84693507 Resolve needless_borrow clippy lint
error: this expression creates a reference which is immediately dereferenced by the compiler
        --> serde/src/de/impls.rs:2015:58
         |
    2015 | ...                   Err(Error::unknown_field(&value, FIELDS))
         |                                                ^^^^^^ help: change this to: `value`
         |
         = note: `-D clippy::needless-borrow` implied by `-D clippy::all`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

    error: this expression creates a reference which is immediately dereferenced by the compiler
        --> serde/src/de/impls.rs:2355:54
         |
    2355 | ...                   Err(Error::unknown_field(&value, FIELDS))
         |                                                ^^^^^^ help: change this to: `value`
         |
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2022-05-05 21:01:03 -07:00
David Tolnay 4cf012c5be Resolve extra_unused_lifetimes clippy lint
error: this lifetime isn't used in the impl
       --> serde/src/de/value.rs:607:11
        |
    607 | impl<'de, 'a, E> de::EnumAccess<'de> for StringDeserializer<E>
        |           ^^
        |
        = note: `-D clippy::extra-unused-lifetimes` implied by `-D clippy::all`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
2022-05-05 21:00:37 -07:00
David Tolnay 17c3c0cf86 Release 1.0.137 2022-04-30 21:45:31 -07:00
David Tolnay 210e6c354e Clean up clippy allows which are superseded by msrv in clippy.toml 2022-04-30 21:35:00 -07:00
David Tolnay 41823a96df Ignore more type_repetition_in_bounds
I'm not sure what is going on with this lint but it's triggering in a
lot of test code. Will need to investigate further.

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:194:21
        |
    194 |             bound = "E: SerializeWith + DeserializeWith"
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
        = help: consider combining the bounds: `"E: SerializeWith + DeserializeWith": "E: SerializeWith + DeserializeWith" + "E: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:184:21
        |
    184 |     #[serde(bound = "D: SerializeWith + DeserializeWith")]
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith + DeserializeWith": "D: SerializeWith + DeserializeWith" + "D: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:210:31
        |
    210 |             bound(serialize = "E: SerializeWith")
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"E: SerializeWith": "E: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:201:31
        |
    201 |     #[serde(bound(serialize = "D: SerializeWith", deserialize = "D: DeserializeWith"))]
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith": "D: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:231:21
        |
    231 |             bound = "E: SerializeWith + DeserializeWith"
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"E: SerializeWith + DeserializeWith": "E: SerializeWith + DeserializeWith" + "E: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:221:21
        |
    221 |     #[serde(bound = "D: SerializeWith + DeserializeWith")]
        |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith + DeserializeWith": "D: SerializeWith + DeserializeWith" + "D: SerializeWith + DeserializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:247:31
        |
    247 |             bound(serialize = "E: SerializeWith")
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"E: SerializeWith": "E: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_gen.rs:238:31
        |
    238 |     #[serde(bound(serialize = "D: SerializeWith", deserialize = "D: DeserializeWith"))]
        |                               ^^^^^^^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `"D: SerializeWith": "D: SerializeWith"`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
      --> test_suite/tests/test_annotations.rs:84:5
       |
    84 |     C: MyDefault,
       |     ^^^^^^^^^^^^
       |
       = note: `-D clippy::type-repetition-in-bounds` implied by `-D clippy::pedantic`
       = help: consider combining the bounds: `C: MyDefault`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
      --> test_suite/tests/test_annotations.rs:85:5
       |
    85 |     E: MyDefault,
       |     ^^^^^^^^^^^^
       |
       = help: consider combining the bounds: `E: MyDefault`
       = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
       --> test_suite/tests/test_annotations.rs:105:5
        |
    105 |     C: MyDefault;
        |     ^^^^^^^^^^^^
        |
        = help: consider combining the bounds: `C: MyDefault`
        = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1066:5
         |
    1066 |     B: 'a,
         |     ^^^^^
         |
         = help: consider combining the bounds: ``
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1067:5
         |
    1067 |     D: SerializeWith,
         |     ^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `D: SerializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1106:5
         |
    1106 |     B: SerializeWith,
         |     ^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `B: SerializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1150:5
         |
    1150 |     B: SerializeWith,
         |     ^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `B: SerializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds

    error: this type has already been used as a bound predicate
        --> test_suite/tests/test_annotations.rs:1368:5
         |
    1368 |     B: DeserializeWith,
         |     ^^^^^^^^^^^^^^^^^^
         |
         = help: consider combining the bounds: `B: DeserializeWith`
         = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#type_repetition_in_bounds
2022-04-30 21:32:36 -07:00
David Tolnay 7ca13ff240 Ignore type_repetition_in_bounds lint that is incompatible with msrv
https://github.com/rust-lang/rust-clippy/issues/8772
2022-04-30 21:32:26 -07:00
David Tolnay 52391fd868 Inform clippy of supported compiler version in clippy.toml 2022-04-30 20:40:23 -07:00
David Tolnay 9b2d8dfc6b Add a miri test job in CI 2022-04-28 20:43:03 -07:00
David Tolnay 07ba7ea8dd Update workflows to actions/checkout@v3 2022-04-24 19:06:18 -07:00
David Tolnay 9f29f6bb4a Disable expandtest on miri 2022-04-24 16:01:52 -07:00
David Tolnay f6c104fd1d Ignore unused ignore attribute warning in some configurations 2022-04-24 16:01:22 -07:00
David Tolnay 8a3a6fb101 Disable ui test on miri 2022-04-24 15:21:17 -07:00
David Tolnay b5c3b5e8e5 Update ui test suite to nightly-2022-04-17 2022-04-16 23:48:27 -07:00
David Tolnay 996d171461 Merge pull request #2201 from atouchet/urls
Update some URLs
2022-04-14 02:50:36 -07:00
Alex Touchet e1c4517335 Update some URLs 2022-04-13 21:42:37 -07:00
David Tolnay 6e94a27c76 Merge pull request #2194 from serde-rs/exhaustive
Update exhaustive matching to syn 1.0.90
2022-03-28 10:27:27 -07:00
David Tolnay b23a768414 Update exhaustive matching to syn 1.0.90 2022-03-28 10:21:37 -07:00
David Tolnay 7e19ae8c94 Fix rust-version in serde_test Cargo.toml too
#2168
2022-01-25 14:49:56 -08:00
David Tolnay 404a1d142a Fix rust-version in Cargo.toml
Closes #2168.
2022-01-25 14:42:09 -08:00
David Tolnay 02bd79a0ba Release 1.0.136 2022-01-25 13:34:29 -08:00
David Tolnay c3ce2c934a Merge pull request #2167 from serde-rs/error128
Render 128-bit integer value into Visitor errors
2022-01-25 13:07:01 -08:00
David Tolnay 0d71ac84b5 Render 128-bit integer value into Visitor errors 2022-01-25 12:06:35 -08:00
David Tolnay 82c3eb7ba4 Add test of visitor error messages 2022-01-25 11:24:53 -08:00
David Tolnay 8932c852a5 Release 1.0.135 2022-01-22 16:04:17 -08:00
David Tolnay 9f3dd3c7c4 Merge pull request #2163 from serde-rs/discord
Add discord invite links
2022-01-22 11:23:32 -08:00
David Tolnay dd9b415ff9 Add discord invite links 2022-01-22 11:21:08 -08:00
David Tolnay 3bb4a5a4f6 Release 1.0.134 2022-01-20 22:22:30 -08:00
David Tolnay 6164627bea Merge pull request #2159 from serde-rs/nonzero
Write better Visitor for NonZero integers
2022-01-20 22:22:02 -08:00
David Tolnay 51aaf496d4 Write better Visitor for NonZero integers 2022-01-20 22:15:16 -08:00
David Tolnay bc66aeb0d3 Add tests of deserializing NonZero 2022-01-20 21:55:50 -08:00
David Tolnay 7e7044d457 Ignore clippy in number conversion tests 2022-01-20 21:38:31 -08:00
David Tolnay 5498dc0550 Add tests of num conversion errors 2022-01-20 21:37:16 -08:00
David Tolnay ff04e8be9b Improve coverage of num conversion in test suite 2022-01-20 21:16:50 -08:00
David Tolnay 69240c17c5 Eliminate macro from serialization tests 2022-01-20 20:37:08 -08:00
David Tolnay 237434f19c Accept ?Sized references in assert_ser_tokens 2022-01-20 20:21:04 -08:00
David Tolnay 1833914346 Eliminate macro from deserialization error tests 2022-01-20 19:58:45 -08:00
David Tolnay ab848060f2 Extract tests of deserialization errors to separate file 2022-01-20 19:58:01 -08:00
David Tolnay 7e39623f72 Implement test suite seq macro without tt muncher 2022-01-20 19:40:58 -08:00
David Tolnay 157dc44c51 Clean up test suite's macro formatting 2022-01-20 19:40:32 -08:00
David Tolnay 80d01a3a79 Tweak seq iterators in test suite 2022-01-20 19:40:13 -08:00
David Tolnay 343c060fc1 Adapt seq macro to not derail rustfmt 2022-01-20 19:38:51 -08:00
David Tolnay 21c1ab6c50 Format deserialization tests with rustfmt 2022-01-20 19:24:35 -08:00
David Tolnay 594ab7745d Reimplement deserialization tests without macro 2022-01-20 18:09:48 -08:00
David Tolnay 8cf0ba7fe2 Make serde_test build script buildable with older rustc 2022-01-20 17:59:21 -08:00
David Tolnay 34b52c0b83 Include build script in packaged serde_test crate 2022-01-20 17:52:25 -08:00
David Tolnay ec7ddc93cd Include 128-bit integers in test suite unconditionally 2022-01-20 15:45:07 -08:00
David Tolnay 55a7cedd73 Invert all build.rs cfgs
This allows non-Cargo builds to generally not get involved in cfgs. As
long as one is using a reasonably recent toolchain, no cfgs need to be
set and you'll get a fully-featured build.
2022-01-01 21:09:49 -08:00
68 changed files with 5508 additions and 2641 deletions
+1
View File
@@ -0,0 +1 @@
test_suite/tests/expand/*.expanded.rs linguist-generated
+41 -11
View File
@@ -13,15 +13,19 @@ jobs:
name: Test suite name: Test suite
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- run: cd test_suite && cargo test --features unstable - run: cd test_suite && cargo test --features unstable
- uses: dtolnay/install@cargo-expand
if: github.event_name != 'pull_request'
- run: cd test_suite && cargo test --features expandtest --test expandtest -- --include-ignored
if: github.event_name != 'pull_request'
windows: windows:
name: Test suite (windows) name: Test suite (windows)
runs-on: windows-latest runs-on: windows-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- run: cd test_suite && cargo test --features unstable -- --skip ui --exact - run: cd test_suite && cargo test --features unstable -- --skip ui --exact
@@ -33,7 +37,7 @@ jobs:
matrix: matrix:
rust: [stable, beta] rust: [stable, beta]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{matrix.rust}} toolchain: ${{matrix.rust}}
@@ -50,7 +54,7 @@ jobs:
matrix: matrix:
os: [ubuntu, windows] os: [ubuntu, windows]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- run: cd serde && cargo build - run: cd serde && cargo build
- run: cd serde && cargo build --no-default-features - run: cd serde && cargo build --no-default-features
@@ -59,12 +63,16 @@ jobs:
- run: cd serde && cargo test --features derive,rc,unstable - run: cd serde && cargo test --features derive,rc,unstable
- run: cd test_suite/no_std && cargo build - run: cd test_suite/no_std && cargo build
if: matrix.os != 'windows' if: matrix.os != 'windows'
- run: cd serde_derive && cargo check --tests
env:
RUSTFLAGS: --cfg exhaustive ${{env.RUSTFLAGS}}
if: matrix.os != 'windows'
msrv: msrv:
name: Rust 1.13.0 name: Rust 1.13.0
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.13.0 - uses: dtolnay/rust-toolchain@1.13.0
- name: Get timestamp for cache - name: Get timestamp for cache
id: date id: date
@@ -85,7 +93,7 @@ jobs:
matrix: matrix:
rust: [1.19.0, 1.20.0, 1.21.0, 1.25.0, 1.26.0, 1.34.0] rust: [1.19.0, 1.20.0, 1.21.0, 1.25.0, 1.26.0, 1.34.0]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{matrix.rust}} toolchain: ${{matrix.rust}}
@@ -100,7 +108,7 @@ jobs:
matrix: matrix:
rust: [1.27.0, 1.28.0] rust: [1.27.0, 1.28.0]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@master - uses: dtolnay/rust-toolchain@master
with: with:
toolchain: ${{matrix.rust}} toolchain: ${{matrix.rust}}
@@ -113,7 +121,7 @@ jobs:
name: Rust 1.31.0 name: Rust 1.31.0
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.31.0 - uses: dtolnay/rust-toolchain@1.31.0
- run: cd serde && cargo check --no-default-features - run: cd serde && cargo check --no-default-features
- run: cd serde && cargo check - run: cd serde && cargo check
@@ -123,7 +131,7 @@ jobs:
name: Rust 1.36.0 name: Rust 1.36.0
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@1.36.0 - uses: dtolnay/rust-toolchain@1.36.0
- run: cd serde && cargo build --no-default-features --features alloc - run: cd serde && cargo build --no-default-features --features alloc
@@ -131,7 +139,7 @@ jobs:
name: Emscripten name: Emscripten
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly - uses: dtolnay/rust-toolchain@nightly
- uses: actions/setup-node@v1 - uses: actions/setup-node@v1
with: with:
@@ -154,7 +162,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event_name != 'pull_request' if: github.event_name != 'pull_request'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@clippy - uses: dtolnay/rust-toolchain@clippy
- run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic - run: cd serde && cargo clippy --features rc,unstable -- -Dclippy::all -Dclippy::pedantic
- run: cd serde_derive && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd serde_derive && cargo clippy -- -Dclippy::all -Dclippy::pedantic
@@ -162,3 +170,25 @@ jobs:
- run: cd serde_test && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd serde_test && cargo clippy -- -Dclippy::all -Dclippy::pedantic
- run: cd test_suite && cargo clippy --tests --features unstable -- -Dclippy::all -Dclippy::pedantic - run: cd test_suite && cargo clippy --tests --features unstable -- -Dclippy::all -Dclippy::pedantic
- run: cd test_suite/no_std && cargo clippy -- -Dclippy::all -Dclippy::pedantic - run: cd test_suite/no_std && cargo clippy -- -Dclippy::all -Dclippy::pedantic
miri:
name: Miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@miri
- run: cd serde && cargo miri test --features derive,rc,unstable
env:
MIRIFLAGS: -Zmiri-strict-provenance
- run: cd test_suite && cargo miri test --features unstable
env:
MIRIFLAGS: -Zmiri-strict-provenance
outdated:
name: Outdated
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
steps:
- uses: actions/checkout@v3
- uses: dtolnay/install@cargo-outdated
- run: cargo outdated --workspace --exclude macrotest,prettyplease --exit-code 1
-1
View File
@@ -1,7 +1,6 @@
[workspace] [workspace]
members = [ members = [
"serde", "serde",
"serde_derive",
"serde_derive_internals", "serde_derive_internals",
"serde_test", "serde_test",
"test_suite", "test_suite",
+12 -9
View File
@@ -77,17 +77,20 @@ fn main() {
Serde is one of the most widely used Rust libraries so any place that Rustaceans Serde is one of the most widely used Rust libraries so any place that Rustaceans
congregate will be able to help you out. For chat, consider trying the congregate will be able to help you out. For chat, consider trying the
[#general] or [#beginners] channels of the unofficial community Discord, the [#rust-questions] or [#rust-beginners] channels of the unofficial community
[#rust-usage] channel of the official Rust Project Discord, or the Discord (invite: <https://discord.gg/rust-lang-community>), the [#rust-usage] or
[#general][zulip] stream in Zulip. For asynchronous, consider the [\[rust\] tag [#beginners] channels of the official Rust Project Discord (invite:
on StackOverflow][stackoverflow], the [/r/rust] subreddit which has a pinned <https://discord.gg/rust-lang>), or the [#general][zulip] stream in Zulip. For
weekly easy questions post, or the Rust [Discourse forum][discourse]. It's asynchronous, consider the [\[rust\] tag on StackOverflow][stackoverflow], the
acceptable to file a support issue in this repo but they tend not to get as many [/r/rust] subreddit which has a pinned weekly easy questions post, or the Rust
eyes as any of the above and may get closed without a response after some time. [Discourse forum][discourse]. It's acceptable to file a support issue in this
repo but they tend not to get as many eyes as any of the above and may get
closed without a response after some time.
[#general]: https://discord.com/channels/273534239310479360/274215136414400513 [#rust-questions]: https://discord.com/channels/273534239310479360/274215136414400513
[#beginners]: https://discord.com/channels/273534239310479360/273541522815713281 [#rust-beginners]: https://discord.com/channels/273534239310479360/273541522815713281
[#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848 [#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848
[#beginners]: https://discord.com/channels/442252698964721669/448238009733742612
[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general [zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general
[stackoverflow]: https://stackoverflow.com/questions/tagged/rust [stackoverflow]: https://stackoverflow.com/questions/tagged/rust
[/r/rust]: https://www.reddit.com/r/rust [/r/rust]: https://www.reddit.com/r/rust
+12 -9
View File
@@ -45,17 +45,20 @@ fn main() {
Serde is one of the most widely used Rust libraries so any place that Rustaceans Serde is one of the most widely used Rust libraries so any place that Rustaceans
congregate will be able to help you out. For chat, consider trying the congregate will be able to help you out. For chat, consider trying the
[#general] or [#beginners] channels of the unofficial community Discord, the [#rust-questions] or [#rust-beginners] channels of the unofficial community
[#rust-usage] channel of the official Rust Project Discord, or the Discord (invite: <https://discord.gg/rust-lang-community>, the [#rust-usage] or
[#general][zulip] stream in Zulip. For asynchronous, consider the [\[rust\] tag [#beginners] channels of the official Rust Project Discord (invite:
on StackOverflow][stackoverflow], the [/r/rust] subreddit which has a pinned <https://discord.gg/rust-lang>), or the [#general][zulip] stream in Zulip. For
weekly easy questions post, or the Rust [Discourse forum][discourse]. It's asynchronous, consider the [\[rust\] tag on StackOverflow][stackoverflow], the
acceptable to file a support issue in this repo but they tend not to get as many [/r/rust] subreddit which has a pinned weekly easy questions post, or the Rust
eyes as any of the above and may get closed without a response after some time. [Discourse forum][discourse]. It's acceptable to file a support issue in this
repo but they tend not to get as many eyes as any of the above and may get
closed without a response after some time.
[#general]: https://discord.com/channels/273534239310479360/274215136414400513 [#rust-questions]: https://discord.com/channels/273534239310479360/274215136414400513
[#beginners]: https://discord.com/channels/273534239310479360/273541522815713281 [#rust-beginners]: https://discord.com/channels/273534239310479360/273541522815713281
[#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848 [#rust-usage]: https://discord.com/channels/442252698964721669/443150878111694848
[#beginners]: https://discord.com/channels/442252698964721669/448238009733742612
[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general [zulip]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general
[stackoverflow]: https://stackoverflow.com/questions/tagged/rust [stackoverflow]: https://stackoverflow.com/questions/tagged/rust
[/r/rust]: https://www.reddit.com/r/rust [/r/rust]: https://www.reddit.com/r/rust
+1
View File
@@ -0,0 +1 @@
msrv = "1.13.0"
+3 -3
View File
@@ -1,8 +1,8 @@
[package] [package]
name = "serde" name = "serde"
version = "1.0.133" # remember to update html_root_url and serde_derive dependency version = "1.0.137" # remember to update html_root_url and serde_derive dependency
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
rust-version = "1.15" rust-version = "1.13"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "A generic serialization/deserialization framework" description = "A generic serialization/deserialization framework"
homepage = "https://serde.rs" homepage = "https://serde.rs"
@@ -15,7 +15,7 @@ include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APAC
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
serde_derive = { version = "=1.0.133", optional = true, path = "../serde_derive" } serde_derive = { version = "=1.0.137", optional = true, path = "../serde_derive" }
[dev-dependencies] [dev-dependencies]
serde_derive = { version = "1.0", path = "../serde_derive" } serde_derive = { version = "1.0", path = "../serde_derive" }
+44 -43
View File
@@ -17,37 +17,38 @@ fn main() {
// std::collections::Bound was stabilized in Rust 1.17 // std::collections::Bound was stabilized in Rust 1.17
// but it was moved to core::ops later in Rust 1.26: // but it was moved to core::ops later in Rust 1.26:
// https://doc.rust-lang.org/core/ops/enum.Bound.html // https://doc.rust-lang.org/core/ops/enum.Bound.html
if minor >= 26 { if minor < 26 {
println!("cargo:rustc-cfg=ops_bound"); println!("cargo:rustc-cfg=no_ops_bound");
} else if minor >= 17 && cfg!(feature = "std") { if minor < 17 {
println!("cargo:rustc-cfg=collections_bound"); println!("cargo:rustc-cfg=no_collections_bound");
}
} }
// core::cmp::Reverse stabilized in Rust 1.19: // core::cmp::Reverse stabilized in Rust 1.19:
// https://doc.rust-lang.org/stable/core/cmp/struct.Reverse.html // https://doc.rust-lang.org/stable/core/cmp/struct.Reverse.html
if minor >= 19 { if minor < 19 {
println!("cargo:rustc-cfg=core_reverse"); println!("cargo:rustc-cfg=no_core_reverse");
} }
// CString::into_boxed_c_str and PathBuf::into_boxed_path stabilized in Rust 1.20: // CString::into_boxed_c_str and PathBuf::into_boxed_path stabilized in Rust 1.20:
// https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str // https://doc.rust-lang.org/std/ffi/struct.CString.html#method.into_boxed_c_str
// https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.into_boxed_path // https://doc.rust-lang.org/std/path/struct.PathBuf.html#method.into_boxed_path
if minor >= 20 { if minor < 20 {
println!("cargo:rustc-cfg=de_boxed_c_str"); println!("cargo:rustc-cfg=no_de_boxed_c_str");
println!("cargo:rustc-cfg=de_boxed_path"); println!("cargo:rustc-cfg=no_de_boxed_path");
} }
// From<Box<T>> for Rc<T> / Arc<T> stabilized in Rust 1.21: // From<Box<T>> for Rc<T> / Arc<T> stabilized in Rust 1.21:
// https://doc.rust-lang.org/std/rc/struct.Rc.html#impl-From<Box<T>> // https://doc.rust-lang.org/std/rc/struct.Rc.html#impl-From<Box<T>>
// https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-From<Box<T>> // https://doc.rust-lang.org/std/sync/struct.Arc.html#impl-From<Box<T>>
if minor >= 21 { if minor < 21 {
println!("cargo:rustc-cfg=de_rc_dst"); println!("cargo:rustc-cfg=no_de_rc_dst");
} }
// Duration available in core since Rust 1.25: // Duration available in core since Rust 1.25:
// https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#library-stabilizations // https://blog.rust-lang.org/2018/03/29/Rust-1.25.html#library-stabilizations
if minor >= 25 { if minor < 25 {
println!("cargo:rustc-cfg=core_duration"); println!("cargo:rustc-cfg=no_core_duration");
} }
// 128-bit integers stabilized in Rust 1.26: // 128-bit integers stabilized in Rust 1.26:
@@ -56,56 +57,56 @@ fn main() {
// Disabled on Emscripten targets before Rust 1.40 since // Disabled on Emscripten targets before Rust 1.40 since
// Emscripten did not support 128-bit integers until Rust 1.40 // Emscripten did not support 128-bit integers until Rust 1.40
// (https://github.com/rust-lang/rust/pull/65251) // (https://github.com/rust-lang/rust/pull/65251)
if minor >= 26 && (!emscripten || minor >= 40) { if minor < 26 || emscripten && minor < 40 {
println!("cargo:rustc-cfg=integer128"); println!("cargo:rustc-cfg=no_integer128");
} }
// Inclusive ranges methods stabilized in Rust 1.27: // Inclusive ranges methods stabilized in Rust 1.27:
// https://github.com/rust-lang/rust/pull/50758 // https://github.com/rust-lang/rust/pull/50758
// Also Iterator::try_for_each: // Also Iterator::try_for_each:
// https://blog.rust-lang.org/2018/06/21/Rust-1.27.html#library-stabilizations // https://blog.rust-lang.org/2018/06/21/Rust-1.27.html#library-stabilizations
if minor >= 27 { if minor < 27 {
println!("cargo:rustc-cfg=range_inclusive"); println!("cargo:rustc-cfg=no_range_inclusive");
println!("cargo:rustc-cfg=iterator_try_fold"); println!("cargo:rustc-cfg=no_iterator_try_fold");
} }
// Non-zero integers stabilized in Rust 1.28: // Non-zero integers stabilized in Rust 1.28:
// https://blog.rust-lang.org/2018/08/02/Rust-1.28.html#library-stabilizations // https://blog.rust-lang.org/2018/08/02/Rust-1.28.html#library-stabilizations
if minor >= 28 { if minor < 28 {
println!("cargo:rustc-cfg=num_nonzero"); println!("cargo:rustc-cfg=no_num_nonzero");
} }
// Current minimum supported version of serde_derive crate is Rust 1.31. // Current minimum supported version of serde_derive crate is Rust 1.31.
if minor >= 31 { if minor < 31 {
println!("cargo:rustc-cfg=serde_derive"); println!("cargo:rustc-cfg=no_serde_derive");
} }
// TryFrom, Atomic types, non-zero signed integers, and SystemTime::checked_add // TryFrom, Atomic types, non-zero signed integers, and SystemTime::checked_add
// stabilized in Rust 1.34: // stabilized in Rust 1.34:
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto // https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#tryfrom-and-tryinto
// https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#library-stabilizations // https://blog.rust-lang.org/2019/04/11/Rust-1.34.0.html#library-stabilizations
if minor >= 34 { if minor < 34 {
println!("cargo:rustc-cfg=core_try_from"); println!("cargo:rustc-cfg=no_core_try_from");
println!("cargo:rustc-cfg=num_nonzero_signed"); println!("cargo:rustc-cfg=no_num_nonzero_signed");
println!("cargo:rustc-cfg=systemtime_checked_add"); println!("cargo:rustc-cfg=no_systemtime_checked_add");
}
// Whitelist of archs that support std::sync::atomic module. Ideally we // Whitelist of archs that support std::sync::atomic module. Ideally we
// would use #[cfg(target_has_atomic = "...")] but it is not stable yet. // would use #[cfg(target_has_atomic = "...")] but it is not stable yet.
// Instead this is based on rustc's compiler/rustc_target/src/spec/*.rs. // Instead this is based on rustc's compiler/rustc_target/src/spec/*.rs.
let has_atomic64 = target.starts_with("x86_64") let has_atomic64 = target.starts_with("x86_64")
|| target.starts_with("i686") || target.starts_with("i686")
|| target.starts_with("aarch64") || target.starts_with("aarch64")
|| target.starts_with("powerpc64") || target.starts_with("powerpc64")
|| target.starts_with("sparc64") || target.starts_with("sparc64")
|| target.starts_with("mips64el") || target.starts_with("mips64el")
|| target.starts_with("riscv64"); || target.starts_with("riscv64");
let has_atomic32 = has_atomic64 || emscripten; let has_atomic32 = has_atomic64 || emscripten;
if has_atomic64 { if minor < 34 || !has_atomic64 {
println!("cargo:rustc-cfg=std_atomic64"); println!("cargo:rustc-cfg=no_std_atomic64");
} }
if has_atomic32 { if minor < 34 || !has_atomic32 {
println!("cargo:rustc-cfg=std_atomic"); println!("cargo:rustc-cfg=no_std_atomic");
}
} }
} }
+30
View File
@@ -0,0 +1,30 @@
use lib::fmt::{self, Write};
use lib::str;
pub struct Buf<'a> {
bytes: &'a mut [u8],
offset: usize,
}
impl<'a> Buf<'a> {
pub fn new(bytes: &'a mut [u8]) -> Self {
Buf { bytes, offset: 0 }
}
pub fn as_str(&self) -> &str {
let slice = &self.bytes[..self.offset];
unsafe { str::from_utf8_unchecked(slice) }
}
}
impl<'a> Write for Buf<'a> {
fn write_str(&mut self, s: &str) -> fmt::Result {
if self.offset + s.len() > self.bytes.len() {
Err(fmt::Error)
} else {
self.bytes[self.offset..self.offset + s.len()].copy_from_slice(s.as_bytes());
self.offset += s.len();
Ok(())
}
}
}
+229 -168
View File
@@ -4,7 +4,7 @@ use de::{
Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, VariantAccess, Visitor, Deserialize, Deserializer, EnumAccess, Error, SeqAccess, Unexpected, VariantAccess, Visitor,
}; };
#[cfg(any(core_duration, feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc", not(no_core_duration)))]
use de::MapAccess; use de::MapAccess;
use seed::InPlaceSeed; use seed::InPlaceSeed;
@@ -81,8 +81,34 @@ impl<'de> Deserialize<'de> for bool {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
macro_rules! impl_deserialize_num { macro_rules! impl_deserialize_num {
($ty:ident, $deserialize:ident $($methods:tt)*) => { ($primitive:ident, $nonzero:ident $(cfg($($cfg:tt)*))*, $deserialize:ident $($method:ident!($($val:ident : $visit:ident)*);)*) => {
impl<'de> Deserialize<'de> for $ty { impl_deserialize_num!($primitive, $deserialize $($method!($($val : $visit)*);)*);
#[cfg(all(not(no_num_nonzero), $($($cfg)*)*))]
impl<'de> Deserialize<'de> for num::$nonzero {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
struct NonZeroVisitor;
impl<'de> Visitor<'de> for NonZeroVisitor {
type Value = num::$nonzero;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str(concat!("a nonzero ", stringify!($primitive)))
}
$($($method!(nonzero $primitive $val : $visit);)*)*
}
deserializer.$deserialize(NonZeroVisitor)
}
}
};
($primitive:ident, $deserialize:ident $($method:ident!($($val:ident : $visit:ident)*);)*) => {
impl<'de> Deserialize<'de> for $primitive {
#[inline] #[inline]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where
@@ -91,13 +117,13 @@ macro_rules! impl_deserialize_num {
struct PrimitiveVisitor; struct PrimitiveVisitor;
impl<'de> Visitor<'de> for PrimitiveVisitor { impl<'de> Visitor<'de> for PrimitiveVisitor {
type Value = $ty; type Value = $primitive;
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
formatter.write_str(stringify!($ty)) formatter.write_str(stringify!($primitive))
} }
$($methods)* $($($method!($val : $visit);)*)*
} }
deserializer.$deserialize(PrimitiveVisitor) deserializer.$deserialize(PrimitiveVisitor)
@@ -116,85 +142,149 @@ macro_rules! num_self {
Ok(v) Ok(v)
} }
}; };
(nonzero $primitive:ident $ty:ident : $visit:ident) => {
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
where
E: Error,
{
if let Some(nonzero) = Self::Value::new(v) {
Ok(nonzero)
} else {
Err(Error::invalid_value(Unexpected::Unsigned(0), &self))
}
}
};
} }
macro_rules! num_as_self { macro_rules! num_as_self {
($($ty:ident : $visit:ident)*) => { ($ty:ident : $visit:ident) => {
$( #[inline]
#[inline] fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> where
where E: Error,
E: Error, {
{ Ok(v as Self::Value)
Ok(v as Self::Value) }
};
(nonzero $primitive:ident $ty:ident : $visit:ident) => {
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
where
E: Error,
{
if let Some(nonzero) = Self::Value::new(v as $primitive) {
Ok(nonzero)
} else {
Err(Error::invalid_value(Unexpected::Unsigned(0), &self))
} }
)* }
}; };
} }
macro_rules! int_to_int { macro_rules! int_to_int {
($($ty:ident : $visit:ident)*) => { ($ty:ident : $visit:ident) => {
$( #[inline]
#[inline] fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> where
where E: Error,
E: Error, {
if Self::Value::min_value() as i64 <= v as i64
&& v as i64 <= Self::Value::max_value() as i64
{ {
if Self::Value::min_value() as i64 <= v as i64 && v as i64 <= Self::Value::max_value() as i64 { Ok(v as Self::Value)
Ok(v as Self::Value) } else {
} else { Err(Error::invalid_value(Unexpected::Signed(v as i64), &self))
Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) }
}
};
(nonzero $primitive:ident $ty:ident : $visit:ident) => {
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
where
E: Error,
{
if $primitive::min_value() as i64 <= v as i64
&& v as i64 <= $primitive::max_value() as i64
{
if let Some(nonzero) = Self::Value::new(v as $primitive) {
return Ok(nonzero);
} }
} }
)* Err(Error::invalid_value(Unexpected::Signed(v as i64), &self))
}
}; };
} }
macro_rules! int_to_uint { macro_rules! int_to_uint {
($($ty:ident : $visit:ident)*) => { ($ty:ident : $visit:ident) => {
$( #[inline]
#[inline] fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> where
where E: Error,
E: Error, {
{ if 0 <= v && v as u64 <= Self::Value::max_value() as u64 {
if 0 <= v && v as u64 <= Self::Value::max_value() as u64 { Ok(v as Self::Value)
Ok(v as Self::Value) } else {
} else { Err(Error::invalid_value(Unexpected::Signed(v as i64), &self))
Err(Error::invalid_value(Unexpected::Signed(v as i64), &self)) }
}
};
(nonzero $primitive:ident $ty:ident : $visit:ident) => {
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
where
E: Error,
{
if 0 < v && v as u64 <= $primitive::max_value() as u64 {
if let Some(nonzero) = Self::Value::new(v as $primitive) {
return Ok(nonzero);
} }
} }
)* Err(Error::invalid_value(Unexpected::Signed(v as i64), &self))
}
}; };
} }
macro_rules! uint_to_self { macro_rules! uint_to_self {
($($ty:ident : $visit:ident)*) => { ($ty:ident : $visit:ident) => {
$( #[inline]
#[inline] fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E> where
where E: Error,
E: Error, {
{ if v as u64 <= Self::Value::max_value() as u64 {
if v as u64 <= Self::Value::max_value() as u64 { Ok(v as Self::Value)
Ok(v as Self::Value) } else {
} else { Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self))
Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self)) }
}
};
(nonzero $primitive:ident $ty:ident : $visit:ident) => {
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
where
E: Error,
{
if v as u64 <= $primitive::max_value() as u64 {
if let Some(nonzero) = Self::Value::new(v as $primitive) {
return Ok(nonzero);
} }
} }
)* Err(Error::invalid_value(Unexpected::Unsigned(v as u64), &self))
}
}; };
} }
impl_deserialize_num! { impl_deserialize_num! {
i8, deserialize_i8 i8, NonZeroI8 cfg(not(no_num_nonzero_signed)), deserialize_i8
num_self!(i8:visit_i8); num_self!(i8:visit_i8);
int_to_int!(i16:visit_i16 i32:visit_i32 i64:visit_i64); int_to_int!(i16:visit_i16 i32:visit_i32 i64:visit_i64);
uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
} }
impl_deserialize_num! { impl_deserialize_num! {
i16, deserialize_i16 i16, NonZeroI16 cfg(not(no_num_nonzero_signed)), deserialize_i16
num_self!(i16:visit_i16); num_self!(i16:visit_i16);
num_as_self!(i8:visit_i8); num_as_self!(i8:visit_i8);
int_to_int!(i32:visit_i32 i64:visit_i64); int_to_int!(i32:visit_i32 i64:visit_i64);
@@ -202,7 +292,7 @@ impl_deserialize_num! {
} }
impl_deserialize_num! { impl_deserialize_num! {
i32, deserialize_i32 i32, NonZeroI32 cfg(not(no_num_nonzero_signed)), deserialize_i32
num_self!(i32:visit_i32); num_self!(i32:visit_i32);
num_as_self!(i8:visit_i8 i16:visit_i16); num_as_self!(i8:visit_i8 i16:visit_i16);
int_to_int!(i64:visit_i64); int_to_int!(i64:visit_i64);
@@ -210,28 +300,28 @@ impl_deserialize_num! {
} }
impl_deserialize_num! { impl_deserialize_num! {
i64, deserialize_i64 i64, NonZeroI64 cfg(not(no_num_nonzero_signed)), deserialize_i64
num_self!(i64:visit_i64); num_self!(i64:visit_i64);
num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32); num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32);
uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
} }
impl_deserialize_num! { impl_deserialize_num! {
isize, deserialize_i64 isize, NonZeroIsize cfg(not(no_num_nonzero_signed)), deserialize_i64
num_as_self!(i8:visit_i8 i16:visit_i16); num_as_self!(i8:visit_i8 i16:visit_i16);
int_to_int!(i32:visit_i32 i64:visit_i64); int_to_int!(i32:visit_i32 i64:visit_i64);
uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); uint_to_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
} }
impl_deserialize_num! { impl_deserialize_num! {
u8, deserialize_u8 u8, NonZeroU8, deserialize_u8
num_self!(u8:visit_u8); num_self!(u8:visit_u8);
int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
uint_to_self!(u16:visit_u16 u32:visit_u32 u64:visit_u64); uint_to_self!(u16:visit_u16 u32:visit_u32 u64:visit_u64);
} }
impl_deserialize_num! { impl_deserialize_num! {
u16, deserialize_u16 u16, NonZeroU16, deserialize_u16
num_self!(u16:visit_u16); num_self!(u16:visit_u16);
num_as_self!(u8:visit_u8); num_as_self!(u8:visit_u8);
int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
@@ -239,7 +329,7 @@ impl_deserialize_num! {
} }
impl_deserialize_num! { impl_deserialize_num! {
u32, deserialize_u32 u32, NonZeroU32, deserialize_u32
num_self!(u32:visit_u32); num_self!(u32:visit_u32);
num_as_self!(u8:visit_u8 u16:visit_u16); num_as_self!(u8:visit_u8 u16:visit_u16);
int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
@@ -247,14 +337,14 @@ impl_deserialize_num! {
} }
impl_deserialize_num! { impl_deserialize_num! {
u64, deserialize_u64 u64, NonZeroU64, deserialize_u64
num_self!(u64:visit_u64); num_self!(u64:visit_u64);
num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32); num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32);
int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
} }
impl_deserialize_num! { impl_deserialize_num! {
usize, deserialize_u64 usize, NonZeroUsize, deserialize_u64
num_as_self!(u8:visit_u8 u16:visit_u16); num_as_self!(u8:visit_u8 u16:visit_u16);
int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
uint_to_self!(u32:visit_u32 u64:visit_u64); uint_to_self!(u32:visit_u32 u64:visit_u64);
@@ -277,42 +367,62 @@ impl_deserialize_num! {
} }
serde_if_integer128! { serde_if_integer128! {
impl_deserialize_num! { macro_rules! num_128 {
i128, deserialize_i128 ($ty:ident : $visit:ident) => {
num_self!(i128:visit_i128); fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); where
num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); E: Error,
{
#[inline] if v as i128 >= Self::Value::min_value() as i128
fn visit_u128<E>(self, v: u128) -> Result<Self::Value, E> && v as u128 <= Self::Value::max_value() as u128
where {
E: Error, Ok(v as Self::Value)
{ } else {
if v <= i128::max_value() as u128 { Err(Error::invalid_value(
Ok(v as i128) Unexpected::Other(stringify!($ty)),
} else { &self,
Err(Error::invalid_value(Unexpected::Other("u128"), &self)) ))
}
} }
} };
(nonzero $primitive:ident $ty:ident : $visit:ident) => {
fn $visit<E>(self, v: $ty) -> Result<Self::Value, E>
where
E: Error,
{
if v as i128 >= $primitive::min_value() as i128
&& v as u128 <= $primitive::max_value() as u128
{
if let Some(nonzero) = Self::Value::new(v as $primitive) {
Ok(nonzero)
} else {
Err(Error::invalid_value(Unexpected::Unsigned(0), &self))
}
} else {
Err(Error::invalid_value(
Unexpected::Other(stringify!($ty)),
&self,
))
}
}
};
} }
impl_deserialize_num! { impl_deserialize_num! {
u128, deserialize_u128 i128, NonZeroI128 cfg(not(no_num_nonzero_signed)), deserialize_i128
num_self!(i128:visit_i128);
num_as_self!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
num_128!(u128:visit_u128);
}
impl_deserialize_num! {
u128, NonZeroU128, deserialize_u128
num_self!(u128:visit_u128); num_self!(u128:visit_u128);
num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64); num_as_self!(u8:visit_u8 u16:visit_u16 u32:visit_u32 u64:visit_u64);
int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64); int_to_uint!(i8:visit_i8 i16:visit_i16 i32:visit_i32 i64:visit_i64);
num_128!(i128:visit_i128);
#[inline]
fn visit_i128<E>(self, v: i128) -> Result<Self::Value, E>
where
E: Error,
{
if 0 <= v {
Ok(v as u128)
} else {
Err(Error::invalid_value(Unexpected::Other("i128"), &self))
}
}
} }
} }
@@ -637,10 +747,10 @@ macro_rules! forwarded_impl {
} }
} }
#[cfg(all(feature = "std", de_boxed_c_str))] #[cfg(all(feature = "std", not(no_de_boxed_c_str)))]
forwarded_impl!((), Box<CStr>, CString::into_boxed_c_str); forwarded_impl!((), Box<CStr>, CString::into_boxed_c_str);
#[cfg(core_reverse)] #[cfg(not(no_core_reverse))]
forwarded_impl!((T), Reverse<T>, Reverse); forwarded_impl!((T), Reverse<T>, Reverse);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -683,7 +793,6 @@ where
T::deserialize(deserializer).map(Some) T::deserialize(deserializer).map(Some)
} }
#[doc(hidden)]
fn __private_visit_untagged_option<D>(self, deserializer: D) -> Result<Self::Value, ()> fn __private_visit_untagged_option<D>(self, deserializer: D) -> Result<Self::Value, ()>
where where
D: Deserializer<'de>, D: Deserializer<'de>,
@@ -1604,7 +1713,7 @@ impl<'de> Deserialize<'de> for PathBuf {
} }
} }
#[cfg(all(feature = "std", de_boxed_path))] #[cfg(all(feature = "std", not(no_de_boxed_path)))]
forwarded_impl!((), Box<Path>, PathBuf::into_boxed_path); forwarded_impl!((), Box<Path>, PathBuf::into_boxed_path);
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
@@ -1685,11 +1794,7 @@ forwarded_impl!((T), Box<[T]>, Vec::into_boxed_slice);
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
forwarded_impl!((), Box<str>, String::into_boxed_str); forwarded_impl!((), Box<str>, String::into_boxed_str);
#[cfg(all( #[cfg(all(no_de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))]
not(de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
forwarded_impl! { forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde. /// This impl requires the [`"rc"`] Cargo feature of Serde.
/// ///
@@ -1701,11 +1806,7 @@ forwarded_impl! {
(T), Arc<T>, Arc::new (T), Arc<T>, Arc::new
} }
#[cfg(all( #[cfg(all(no_de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))]
not(de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
forwarded_impl! { forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde. /// This impl requires the [`"rc"`] Cargo feature of Serde.
/// ///
@@ -1772,7 +1873,11 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(all(de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))] #[cfg(all(
not(no_de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
macro_rules! box_forwarded_impl { macro_rules! box_forwarded_impl {
( (
$(#[doc = $doc:tt])* $(#[doc = $doc:tt])*
@@ -1793,7 +1898,11 @@ macro_rules! box_forwarded_impl {
}; };
} }
#[cfg(all(de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))] #[cfg(all(
not(no_de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
box_forwarded_impl! { box_forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde. /// This impl requires the [`"rc"`] Cargo feature of Serde.
/// ///
@@ -1805,7 +1914,11 @@ box_forwarded_impl! {
Rc Rc
} }
#[cfg(all(de_rc_dst, feature = "rc", any(feature = "std", feature = "alloc")))] #[cfg(all(
not(no_de_rc_dst),
feature = "rc",
any(feature = "std", feature = "alloc")
))]
box_forwarded_impl! { box_forwarded_impl! {
/// This impl requires the [`"rc"`] Cargo feature of Serde. /// This impl requires the [`"rc"`] Cargo feature of Serde.
/// ///
@@ -1849,7 +1962,7 @@ forwarded_impl!((T), RwLock<T>, RwLock::new);
// secs: u64, // secs: u64,
// nanos: u32, // nanos: u32,
// } // }
#[cfg(any(core_duration, feature = "std"))] #[cfg(any(feature = "std", not(no_core_duration)))]
impl<'de> Deserialize<'de> for Duration { impl<'de> Deserialize<'de> for Duration {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where
@@ -1898,7 +2011,7 @@ impl<'de> Deserialize<'de> for Duration {
b"nanos" => Ok(Field::Nanos), b"nanos" => Ok(Field::Nanos),
_ => { _ => {
let value = ::__private::from_utf8_lossy(value); let value = ::__private::from_utf8_lossy(value);
Err(Error::unknown_field(&value, FIELDS)) Err(Error::unknown_field(&*value, FIELDS))
} }
} }
} }
@@ -2127,11 +2240,11 @@ impl<'de> Deserialize<'de> for SystemTime {
const FIELDS: &'static [&'static str] = &["secs_since_epoch", "nanos_since_epoch"]; const FIELDS: &'static [&'static str] = &["secs_since_epoch", "nanos_since_epoch"];
let duration = try!(deserializer.deserialize_struct("SystemTime", FIELDS, DurationVisitor)); let duration = try!(deserializer.deserialize_struct("SystemTime", FIELDS, DurationVisitor));
#[cfg(systemtime_checked_add)] #[cfg(not(no_systemtime_checked_add))]
let ret = UNIX_EPOCH let ret = UNIX_EPOCH
.checked_add(duration) .checked_add(duration)
.ok_or_else(|| D::Error::custom("overflow deserializing SystemTime")); .ok_or_else(|| D::Error::custom("overflow deserializing SystemTime"));
#[cfg(not(systemtime_checked_add))] #[cfg(no_systemtime_checked_add)]
let ret = Ok(UNIX_EPOCH + duration); let ret = Ok(UNIX_EPOCH + duration);
ret ret
} }
@@ -2167,7 +2280,7 @@ where
} }
} }
#[cfg(range_inclusive)] #[cfg(not(no_range_inclusive))]
impl<'de, Idx> Deserialize<'de> for RangeInclusive<Idx> impl<'de, Idx> Deserialize<'de> for RangeInclusive<Idx>
where where
Idx: Deserialize<'de>, Idx: Deserialize<'de>,
@@ -2238,7 +2351,7 @@ mod range {
b"end" => Ok(Field::End), b"end" => Ok(Field::End),
_ => { _ => {
let value = ::__private::from_utf8_lossy(value); let value = ::__private::from_utf8_lossy(value);
Err(Error::unknown_field(&value, FIELDS)) Err(Error::unknown_field(&*value, FIELDS))
} }
} }
} }
@@ -2319,7 +2432,7 @@ mod range {
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(any(ops_bound, collections_bound))] #[cfg(any(not(no_ops_bound), all(feature = "std", not(no_collections_bound))))]
impl<'de, T> Deserialize<'de> for Bound<T> impl<'de, T> Deserialize<'de> for Bound<T>
where where
T: Deserialize<'de>, T: Deserialize<'de>,
@@ -2427,58 +2540,6 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
macro_rules! nonzero_integers {
( $( $T: ident, )+ ) => {
$(
#[cfg(num_nonzero)]
impl<'de> Deserialize<'de> for num::$T {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
let value = try!(Deserialize::deserialize(deserializer));
match <num::$T>::new(value) {
Some(nonzero) => Ok(nonzero),
None => Err(Error::custom("expected a non-zero value")),
}
}
}
)+
};
}
nonzero_integers! {
NonZeroU8,
NonZeroU16,
NonZeroU32,
NonZeroU64,
NonZeroUsize,
}
#[cfg(num_nonzero_signed)]
nonzero_integers! {
NonZeroI8,
NonZeroI16,
NonZeroI32,
NonZeroI64,
NonZeroIsize,
}
// Currently 128-bit integers do not work on Emscripten targets so we need an
// additional `#[cfg]`
serde_if_integer128! {
nonzero_integers! {
NonZeroU128,
}
#[cfg(num_nonzero_signed)]
nonzero_integers! {
NonZeroI128,
}
}
////////////////////////////////////////////////////////////////////////////////
impl<'de, T, E> Deserialize<'de> for Result<T, E> impl<'de, T, E> Deserialize<'de> for Result<T, E>
where where
T: Deserialize<'de>, T: Deserialize<'de>,
@@ -2599,7 +2660,7 @@ where
} }
} }
#[cfg(all(feature = "std", std_atomic))] #[cfg(all(feature = "std", not(no_std_atomic)))]
macro_rules! atomic_impl { macro_rules! atomic_impl {
($($ty:ident)*) => { ($($ty:ident)*) => {
$( $(
@@ -2615,14 +2676,14 @@ macro_rules! atomic_impl {
}; };
} }
#[cfg(all(feature = "std", std_atomic))] #[cfg(all(feature = "std", not(no_std_atomic)))]
atomic_impl! { atomic_impl! {
AtomicBool AtomicBool
AtomicI8 AtomicI16 AtomicI32 AtomicIsize AtomicI8 AtomicI16 AtomicI32 AtomicIsize
AtomicU8 AtomicU16 AtomicU32 AtomicUsize AtomicU8 AtomicU16 AtomicU32 AtomicUsize
} }
#[cfg(all(feature = "std", std_atomic64))] #[cfg(all(feature = "std", not(no_std_atomic64)))]
atomic_impl! { atomic_impl! {
AtomicI64 AtomicU64 AtomicI64 AtomicU64
} }
+12 -6
View File
@@ -104,7 +104,7 @@
//! [`Deserialize`]: ../trait.Deserialize.html //! [`Deserialize`]: ../trait.Deserialize.html
//! [`Deserializer`]: ../trait.Deserializer.html //! [`Deserializer`]: ../trait.Deserializer.html
//! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html //! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html
//! [`bincode`]: https://github.com/servo/bincode //! [`bincode`]: https://github.com/bincode-org/bincode
//! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map //! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map
//! [`serde_derive`]: https://crates.io/crates/serde_derive //! [`serde_derive`]: https://crates.io/crates/serde_derive
//! [`serde_json`]: https://github.com/serde-rs/json //! [`serde_json`]: https://github.com/serde-rs/json
@@ -118,6 +118,8 @@ use lib::*;
pub mod value; pub mod value;
#[cfg(not(no_integer128))]
mod format;
mod ignored_any; mod ignored_any;
mod impls; mod impls;
mod utf8; mod utf8;
@@ -1215,7 +1217,7 @@ pub trait Deserializer<'de>: Sized {
} }
// Not public API. // Not public API.
#[cfg(all(serde_derive, any(feature = "std", feature = "alloc")))] #[cfg(all(not(no_serde_derive), any(feature = "std", feature = "alloc")))]
#[doc(hidden)] #[doc(hidden)]
fn __deserialize_content<V>( fn __deserialize_content<V>(
self, self,
@@ -1366,8 +1368,10 @@ pub trait Visitor<'de>: Sized {
where where
E: Error, E: Error,
{ {
let _ = v; let mut buf = [0u8; 58];
Err(Error::invalid_type(Unexpected::Other("i128"), &self)) let mut writer = format::Buf::new(&mut buf);
fmt::Write::write_fmt(&mut writer, format_args!("integer `{}` as i128", v)).unwrap();
Err(Error::invalid_type(Unexpected::Other(writer.as_str()), &self))
} }
} }
@@ -1426,8 +1430,10 @@ pub trait Visitor<'de>: Sized {
where where
E: Error, E: Error,
{ {
let _ = v; let mut buf = [0u8; 57];
Err(Error::invalid_type(Unexpected::Other("u128"), &self)) let mut writer = format::Buf::new(&mut buf);
fmt::Write::write_fmt(&mut writer, format_args!("integer `{}` as u128", v)).unwrap();
Err(Error::invalid_type(Unexpected::Other(writer.as_str()), &self))
} }
} }
+1 -1
View File
@@ -604,7 +604,7 @@ where
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<'de, 'a, E> de::EnumAccess<'de> for StringDeserializer<E> impl<'de, E> de::EnumAccess<'de> for StringDeserializer<E>
where where
E: de::Error, E: de::Error,
{ {
+2 -2
View File
@@ -66,7 +66,7 @@
/// ($($tt:tt)*) => {}; /// ($($tt:tt)*) => {};
/// } /// }
/// ``` /// ```
#[cfg(integer128)] #[cfg(not(no_integer128))]
#[macro_export] #[macro_export]
macro_rules! serde_if_integer128 { macro_rules! serde_if_integer128 {
($($tt:tt)*) => { ($($tt:tt)*) => {
@@ -74,7 +74,7 @@ macro_rules! serde_if_integer128 {
}; };
} }
#[cfg(not(integer128))] #[cfg(no_integer128)]
#[macro_export] #[macro_export]
#[doc(hidden)] #[doc(hidden)]
macro_rules! serde_if_integer128 { macro_rules! serde_if_integer128 {
+14 -15
View File
@@ -59,14 +59,14 @@
//! and from DynamoDB. //! and from DynamoDB.
//! //!
//! [JSON]: https://github.com/serde-rs/json //! [JSON]: https://github.com/serde-rs/json
//! [Bincode]: https://github.com/servo/bincode //! [Bincode]: https://github.com/bincode-org/bincode
//! [CBOR]: https://github.com/enarx/ciborium //! [CBOR]: https://github.com/enarx/ciborium
//! [YAML]: https://github.com/dtolnay/serde-yaml //! [YAML]: https://github.com/dtolnay/serde-yaml
//! [MessagePack]: https://github.com/3Hren/msgpack-rust //! [MessagePack]: https://github.com/3Hren/msgpack-rust
//! [TOML]: https://github.com/alexcrichton/toml-rs //! [TOML]: https://github.com/alexcrichton/toml-rs
//! [Pickle]: https://github.com/birkenfeld/serde-pickle //! [Pickle]: https://github.com/birkenfeld/serde-pickle
//! [RON]: https://github.com/ron-rs/ron //! [RON]: https://github.com/ron-rs/ron
//! [BSON]: https://github.com/zonyitoo/bson-rs //! [BSON]: https://github.com/mongodb/bson-rust
//! [Avro]: https://github.com/flavray/avro-rs //! [Avro]: https://github.com/flavray/avro-rs
//! [JSON5]: https://github.com/callum-oakley/json5-rs //! [JSON5]: https://github.com/callum-oakley/json5-rs
//! [Postcard]: https://github.com/jamesmunns/postcard //! [Postcard]: https://github.com/jamesmunns/postcard
@@ -74,7 +74,7 @@
//! [Envy]: https://github.com/softprops/envy //! [Envy]: https://github.com/softprops/envy
//! [Envy Store]: https://github.com/softprops/envy-store //! [Envy Store]: https://github.com/softprops/envy-store
//! [Cargo]: https://doc.rust-lang.org/cargo/reference/manifest.html //! [Cargo]: https://doc.rust-lang.org/cargo/reference/manifest.html
//! [AWS Parameter Store]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html //! [AWS Parameter Store]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
//! [S-expressions]: https://github.com/rotty/lexpr-rs //! [S-expressions]: https://github.com/rotty/lexpr-rs
//! [D-Bus]: https://docs.rs/zvariant //! [D-Bus]: https://docs.rs/zvariant
//! [FlexBuffers]: https://github.com/google/flatbuffers/tree/master/rust/flexbuffers //! [FlexBuffers]: https://github.com/google/flatbuffers/tree/master/rust/flexbuffers
@@ -84,7 +84,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Serde types in rustdoc of other crates get linked to here. // Serde types in rustdoc of other crates get linked to here.
#![doc(html_root_url = "https://docs.rs/serde/1.0.133")] #![doc(html_root_url = "https://docs.rs/serde/1.0.137")]
// Support using Serde without the standard library! // Support using Serde without the standard library!
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
// Unstable functionality only if the user asks for it. For tracking and // Unstable functionality only if the user asks for it. For tracking and
@@ -103,10 +103,8 @@
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/7768 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/7768
semicolon_if_nothing_returned, semicolon_if_nothing_returned,
// not available in our oldest supported compiler // not available in our oldest supported compiler
checked_conversions,
empty_enum, empty_enum,
redundant_field_names, type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/8772
redundant_static_lifetimes,
// integer and float ser/de requires these sorts of casts // integer and float ser/de requires these sorts of casts
cast_possible_truncation, cast_possible_truncation,
cast_possible_wrap, cast_possible_wrap,
@@ -120,6 +118,7 @@
use_self, use_self,
zero_prefixed_literal, zero_prefixed_literal,
// correctly used // correctly used
derive_partial_eq_without_eq,
enum_glob_use, enum_glob_use,
let_underscore_drop, let_underscore_drop,
map_err_ignore, map_err_ignore,
@@ -227,27 +226,27 @@ mod lib {
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub use std::time::{SystemTime, UNIX_EPOCH}; pub use std::time::{SystemTime, UNIX_EPOCH};
#[cfg(all(feature = "std", collections_bound))] #[cfg(all(feature = "std", not(no_collections_bound), no_ops_bound))]
pub use std::collections::Bound; pub use std::collections::Bound;
#[cfg(core_reverse)] #[cfg(not(no_core_reverse))]
pub use self::core::cmp::Reverse; pub use self::core::cmp::Reverse;
#[cfg(ops_bound)] #[cfg(not(no_ops_bound))]
pub use self::core::ops::Bound; pub use self::core::ops::Bound;
#[cfg(range_inclusive)] #[cfg(not(no_range_inclusive))]
pub use self::core::ops::RangeInclusive; pub use self::core::ops::RangeInclusive;
#[cfg(all(feature = "std", std_atomic))] #[cfg(all(feature = "std", not(no_std_atomic)))]
pub use std::sync::atomic::{ pub use std::sync::atomic::{
AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8, AtomicBool, AtomicI16, AtomicI32, AtomicI8, AtomicIsize, AtomicU16, AtomicU32, AtomicU8,
AtomicUsize, Ordering, AtomicUsize, Ordering,
}; };
#[cfg(all(feature = "std", std_atomic64))] #[cfg(all(feature = "std", not(no_std_atomic64)))]
pub use std::sync::atomic::{AtomicI64, AtomicU64}; pub use std::sync::atomic::{AtomicI64, AtomicU64};
#[cfg(any(core_duration, feature = "std"))] #[cfg(any(feature = "std", not(no_core_duration)))]
pub use self::core::time::Duration; pub use self::core::time::Duration;
} }
@@ -296,7 +295,7 @@ extern crate serde_derive;
#[doc(hidden)] #[doc(hidden)]
pub use serde_derive::*; pub use serde_derive::*;
#[cfg(all(serde_derive, any(feature = "std", feature = "alloc")))] #[cfg(all(not(no_serde_derive), any(feature = "std", feature = "alloc")))]
mod actually_private { mod actually_private {
pub struct T; pub struct T;
} }
+3 -3
View File
@@ -1,6 +1,6 @@
#[cfg(serde_derive)] #[cfg(not(no_serde_derive))]
pub mod de; pub mod de;
#[cfg(serde_derive)] #[cfg(not(no_serde_derive))]
pub mod ser; pub mod ser;
pub mod size_hint; pub mod size_hint;
@@ -22,7 +22,7 @@ pub use self::string::from_utf8_lossy;
#[cfg(any(feature = "alloc", feature = "std"))] #[cfg(any(feature = "alloc", feature = "std"))]
pub use lib::{ToString, Vec}; pub use lib::{ToString, Vec};
#[cfg(core_try_from)] #[cfg(not(no_core_try_from))]
pub use lib::convert::TryFrom; pub use lib::convert::TryFrom;
mod string { mod string {
+10 -10
View File
@@ -239,7 +239,7 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(range_inclusive)] #[cfg(not(no_range_inclusive))]
impl<Idx> Serialize for RangeInclusive<Idx> impl<Idx> Serialize for RangeInclusive<Idx>
where where
Idx: Serialize, Idx: Serialize,
@@ -258,7 +258,7 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(any(ops_bound, collections_bound))] #[cfg(any(not(no_ops_bound), all(feature = "std", not(no_collections_bound))))]
impl<T> Serialize for Bound<T> impl<T> Serialize for Bound<T>
where where
T: Serialize, T: Serialize,
@@ -467,7 +467,7 @@ where
macro_rules! nonzero_integers { macro_rules! nonzero_integers {
( $( $T: ident, )+ ) => { ( $( $T: ident, )+ ) => {
$( $(
#[cfg(num_nonzero)] #[cfg(not(no_num_nonzero))]
impl Serialize for num::$T { impl Serialize for num::$T {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -488,7 +488,7 @@ nonzero_integers! {
NonZeroUsize, NonZeroUsize,
} }
#[cfg(num_nonzero_signed)] #[cfg(not(no_num_nonzero_signed))]
nonzero_integers! { nonzero_integers! {
NonZeroI8, NonZeroI8,
NonZeroI16, NonZeroI16,
@@ -504,7 +504,7 @@ serde_if_integer128! {
NonZeroU128, NonZeroU128,
} }
#[cfg(num_nonzero_signed)] #[cfg(not(no_num_nonzero_signed))]
nonzero_integers! { nonzero_integers! {
NonZeroI128, NonZeroI128,
} }
@@ -591,7 +591,7 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(any(core_duration, feature = "std"))] #[cfg(any(feature = "std", not(no_core_duration)))]
impl Serialize for Duration { impl Serialize for Duration {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
@@ -890,7 +890,7 @@ where
} }
} }
#[cfg(core_reverse)] #[cfg(not(no_core_reverse))]
impl<T> Serialize for Reverse<T> impl<T> Serialize for Reverse<T>
where where
T: Serialize, T: Serialize,
@@ -906,7 +906,7 @@ where
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#[cfg(all(feature = "std", std_atomic))] #[cfg(all(feature = "std", not(no_std_atomic)))]
macro_rules! atomic_impl { macro_rules! atomic_impl {
($($ty:ident)*) => { ($($ty:ident)*) => {
$( $(
@@ -923,14 +923,14 @@ macro_rules! atomic_impl {
} }
} }
#[cfg(all(feature = "std", std_atomic))] #[cfg(all(feature = "std", not(no_std_atomic)))]
atomic_impl! { atomic_impl! {
AtomicBool AtomicBool
AtomicI8 AtomicI16 AtomicI32 AtomicIsize AtomicI8 AtomicI16 AtomicI32 AtomicIsize
AtomicU8 AtomicU16 AtomicU32 AtomicUsize AtomicU8 AtomicU16 AtomicU32 AtomicUsize
} }
#[cfg(all(feature = "std", std_atomic64))] #[cfg(all(feature = "std", not(no_std_atomic64)))]
atomic_impl! { atomic_impl! {
AtomicI64 AtomicU64 AtomicI64 AtomicU64
} }
+5 -5
View File
@@ -99,7 +99,7 @@
//! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html //! [`LinkedHashMap<K, V>`]: https://docs.rs/linked-hash-map/*/linked_hash_map/struct.LinkedHashMap.html
//! [`Serialize`]: ../trait.Serialize.html //! [`Serialize`]: ../trait.Serialize.html
//! [`Serializer`]: ../trait.Serializer.html //! [`Serializer`]: ../trait.Serializer.html
//! [`bincode`]: https://github.com/servo/bincode //! [`bincode`]: https://github.com/bincode-org/bincode
//! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map //! [`linked-hash-map`]: https://crates.io/crates/linked-hash-map
//! [`serde_derive`]: https://crates.io/crates/serde_derive //! [`serde_derive`]: https://crates.io/crates/serde_derive
//! [`serde_json`]: https://github.com/serde-rs/json //! [`serde_json`]: https://github.com/serde-rs/json
@@ -1280,13 +1280,13 @@ pub trait Serializer: Sized {
let iter = iter.into_iter(); let iter = iter.into_iter();
let mut serializer = try!(self.serialize_seq(iterator_len_hint(&iter))); let mut serializer = try!(self.serialize_seq(iterator_len_hint(&iter)));
#[cfg(iterator_try_fold)] #[cfg(not(no_iterator_try_fold))]
{ {
let mut iter = iter; let mut iter = iter;
try!(iter.try_for_each(|item| serializer.serialize_element(&item))); try!(iter.try_for_each(|item| serializer.serialize_element(&item)));
} }
#[cfg(not(iterator_try_fold))] #[cfg(no_iterator_try_fold)]
{ {
for item in iter { for item in iter {
try!(serializer.serialize_element(&item)); try!(serializer.serialize_element(&item));
@@ -1331,13 +1331,13 @@ pub trait Serializer: Sized {
let iter = iter.into_iter(); let iter = iter.into_iter();
let mut serializer = try!(self.serialize_map(iterator_len_hint(&iter))); let mut serializer = try!(self.serialize_map(iterator_len_hint(&iter)));
#[cfg(iterator_try_fold)] #[cfg(not(no_iterator_try_fold))]
{ {
let mut iter = iter; let mut iter = iter;
try!(iter.try_for_each(|(key, value)| serializer.serialize_entry(&key, &value))); try!(iter.try_for_each(|(key, value)| serializer.serialize_entry(&key, &value)));
} }
#[cfg(not(iterator_try_fold))] #[cfg(no_iterator_try_fold)]
{ {
for (key, value) in iter { for (key, value) in iter {
try!(serializer.serialize_entry(&key, &value)); try!(serializer.serialize_entry(&key, &value));
+1
View File
@@ -0,0 +1 @@
msrv = "1.31.0"
+8 -4
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "serde_derive" name = "serde_derive"
version = "1.0.133" # remember to update html_root_url version = "1.0.137" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
rust-version = "1.31" rust-version = "1.31"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
@@ -17,16 +17,20 @@ default = []
deserialize_in_place = [] deserialize_in_place = []
[lib] [lib]
name = "serde_derive" crate-type = ["cdylib"]
proc-macro = true
[dependencies] [dependencies]
proc-macro2 = "1.0" proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
syn = "1.0.60" syn = "1.0.90"
[dev-dependencies] [dev-dependencies]
serde = { version = "1.0", path = "../serde" } serde = { version = "1.0", path = "../serde" }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
[workspace]
[patch.crates-io]
proc-macro2 = { git = "https://github.com/dtolnay/watt" }
+1 -3
View File
@@ -184,9 +184,7 @@ pub fn with_bound(
syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {} syn::Type::Infer(_) | syn::Type::Never(_) | syn::Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
syn::Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }
+1 -3
View File
@@ -1912,9 +1912,7 @@ fn collect_lifetimes(ty: &syn::Type, out: &mut BTreeSet<syn::Lifetime>) {
| syn::Type::Infer(_) | syn::Type::Infer(_)
| syn::Type::Verbatim(_) => {} | syn::Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
syn::Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }
+1 -3
View File
@@ -147,9 +147,7 @@ impl ReplaceReceiver<'_> {
Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {} Type::Infer(_) | Type::Never(_) | Type::Verbatim(_) => {}
#[cfg(test)] #[cfg_attr(all(test, exhaustive), deny(non_exhaustive_omitted_patterns))]
Type::__TestExhaustive(_) => unimplemented!(),
#[cfg(not(test))]
_ => {} _ => {}
} }
} }
+21 -16
View File
@@ -13,7 +13,7 @@
//! //!
//! [https://serde.rs/derive.html]: https://serde.rs/derive.html //! [https://serde.rs/derive.html]: https://serde.rs/derive.html
#![doc(html_root_url = "https://docs.rs/serde_derive/1.0.133")] #![doc(html_root_url = "https://docs.rs/serde_derive/1.0.137")]
#![allow(unknown_lints, bare_trait_objects)] #![allow(unknown_lints, bare_trait_objects)]
// Ignored clippy lints // Ignored clippy lints
#![allow( #![allow(
@@ -22,6 +22,7 @@
clippy::cognitive_complexity, clippy::cognitive_complexity,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/7575 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/7575
clippy::collapsible_match, clippy::collapsible_match,
clippy::derive_partial_eq_without_eq,
clippy::enum_variant_names, clippy::enum_variant_names,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/6797 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/6797
clippy::manual_map, clippy::manual_map,
@@ -60,18 +61,18 @@
clippy::use_self, clippy::use_self,
clippy::wildcard_imports clippy::wildcard_imports
)] )]
#![cfg_attr(all(test, exhaustive), feature(non_exhaustive_omitted_patterns_lint))]
#[macro_use] #[macro_use]
extern crate quote; extern crate quote;
#[macro_use] #[macro_use]
extern crate syn; extern crate syn;
extern crate proc_macro;
extern crate proc_macro2; extern crate proc_macro2;
mod internals; mod internals;
use proc_macro::TokenStream; use proc_macro2::TokenStream;
use syn::DeriveInput; use syn::DeriveInput;
#[macro_use] #[macro_use]
@@ -85,23 +86,27 @@ mod pretend;
mod ser; mod ser;
mod try; mod try;
#[proc_macro_derive(Serialize, attributes(serde))] #[no_mangle]
pub fn derive_serialize(input: TokenStream) -> TokenStream { pub extern "C" fn derive_serialize(input: TokenStream) -> TokenStream {
let mut input = parse_macro_input!(input as DeriveInput); let mut input: DeriveInput = match syn::parse2(input) {
ser::expand_derive_serialize(&mut input) Ok(input) => input,
.unwrap_or_else(to_compile_errors) Err(err) => return err.to_compile_error(),
.into() };
ser::expand_derive_serialize(&mut input).unwrap_or_else(to_compile_errors)
} }
#[proc_macro_derive(Deserialize, attributes(serde))] #[no_mangle]
pub fn derive_deserialize(input: TokenStream) -> TokenStream { pub extern "C" fn derive_deserialize(input: TokenStream) -> TokenStream {
let mut input = parse_macro_input!(input as DeriveInput); let mut input: DeriveInput = match syn::parse2(input) {
de::expand_derive_deserialize(&mut input) Ok(input) => input,
.unwrap_or_else(to_compile_errors) Err(err) => return err.to_compile_error(),
.into() };
de::expand_derive_deserialize(&mut input).unwrap_or_else(to_compile_errors)
} }
fn to_compile_errors(errors: Vec<syn::Error>) -> proc_macro2::TokenStream { fn to_compile_errors(errors: Vec<syn::Error>) -> TokenStream {
let compile_errors = errors.iter().map(syn::Error::to_compile_error); let compile_errors = errors.iter().map(syn::Error::to_compile_error);
quote!(#(#compile_errors)*) quote!(#(#compile_errors)*)
} }
+1
View File
@@ -0,0 +1 @@
msrv = "1.31.0"
+1 -1
View File
@@ -17,7 +17,7 @@ path = "lib.rs"
[dependencies] [dependencies]
proc-macro2 = "1.0" proc-macro2 = "1.0"
quote = "1.0" quote = "1.0"
syn = { version = "1.0.60", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] } syn = { version = "1.0.90", default-features = false, features = ["derive", "parsing", "printing", "clone-impls"] }
[package.metadata.docs.rs] [package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"] targets = ["x86_64-unknown-linux-gnu"]
+1
View File
@@ -5,6 +5,7 @@
clippy::cognitive_complexity, clippy::cognitive_complexity,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/7575 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/7575
clippy::collapsible_match, clippy::collapsible_match,
clippy::derive_partial_eq_without_eq,
// clippy bug: https://github.com/rust-lang/rust-clippy/issues/6797 // clippy bug: https://github.com/rust-lang/rust-clippy/issues/6797
clippy::manual_map, clippy::manual_map,
clippy::missing_panics_doc, clippy::missing_panics_doc,
+1
View File
@@ -0,0 +1 @@
msrv = "1.13.0"
+4 -3
View File
@@ -1,8 +1,8 @@
[package] [package]
name = "serde_test" name = "serde_test"
version = "1.0.133" # remember to update html_root_url version = "1.0.137" # remember to update html_root_url
authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"] authors = ["Erick Tryzelaar <erick.tryzelaar@gmail.com>", "David Tolnay <dtolnay@gmail.com>"]
rust-version = "1.15" rust-version = "1.13"
license = "MIT OR Apache-2.0" license = "MIT OR Apache-2.0"
description = "Token De/Serializer for testing De/Serialize implementations" description = "Token De/Serializer for testing De/Serialize implementations"
homepage = "https://serde.rs" homepage = "https://serde.rs"
@@ -10,7 +10,8 @@ repository = "https://github.com/serde-rs/serde"
documentation = "https://docs.serde.rs/serde_test/" documentation = "https://docs.serde.rs/serde_test/"
keywords = ["serde", "serialization"] keywords = ["serde", "serialization"]
readme = "crates-io.md" readme = "crates-io.md"
include = ["src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"] include = ["build.rs", "src/**/*.rs", "crates-io.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
build = "build.rs"
[dependencies] [dependencies]
serde = { version = "1.0.60", path = "../serde" } serde = { version = "1.0.60", path = "../serde" }
+23 -5
View File
@@ -1,6 +1,6 @@
use std::env; use std::env;
use std::process::Command; use std::process::Command;
use std::str; use std::str::{self, FromStr};
// The rustc-cfg strings below are *not* public API. Please let us know by // The rustc-cfg strings below are *not* public API. Please let us know by
// opening a GitHub issue if your build environment requires some way to enable // opening a GitHub issue if your build environment requires some way to enable
@@ -19,12 +19,30 @@ fn main() {
} }
fn rustc_minor_version() -> Option<u32> { fn rustc_minor_version() -> Option<u32> {
let rustc = env::var_os("RUSTC")?; let rustc = match env::var_os("RUSTC") {
let output = Command::new(rustc).arg("--version").output().ok()?; Some(rustc) => rustc,
let version = str::from_utf8(&output.stdout).ok()?; None => return None,
};
let output = match Command::new(rustc).arg("--version").output() {
Ok(output) => output,
Err(_) => return None,
};
let version = match str::from_utf8(&output.stdout) {
Ok(version) => version,
Err(_) => return None,
};
let mut pieces = version.split('.'); let mut pieces = version.split('.');
if pieces.next() != Some("rustc 1") { if pieces.next() != Some("rustc 1") {
return None; return None;
} }
pieces.next()?.parse().ok()
let next = match pieces.next() {
Some(next) => next,
None => return None,
};
u32::from_str(next).ok()
} }
+2 -2
View File
@@ -60,7 +60,7 @@ where
/// ]); /// ]);
/// ``` /// ```
#[cfg_attr(track_caller, track_caller)] #[cfg_attr(track_caller, track_caller)]
pub fn assert_ser_tokens<T>(value: &T, tokens: &[Token]) pub fn assert_ser_tokens<T: ?Sized>(value: &T, tokens: &[Token])
where where
T: Serialize, T: Serialize,
{ {
@@ -113,7 +113,7 @@ where
/// } /// }
/// ``` /// ```
#[cfg_attr(track_caller, track_caller)] #[cfg_attr(track_caller, track_caller)]
pub fn assert_ser_tokens_error<T>(value: &T, tokens: &[Token], error: &str) pub fn assert_ser_tokens_error<T: ?Sized>(value: &T, tokens: &[Token], error: &str)
where where
T: Serialize, T: Serialize,
{ {
+3 -1
View File
@@ -144,7 +144,7 @@
//! # } //! # }
//! ``` //! ```
#![doc(html_root_url = "https://docs.rs/serde_test/1.0.133")] #![doc(html_root_url = "https://docs.rs/serde_test/1.0.137")]
#![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))] #![cfg_attr(feature = "cargo-clippy", allow(renamed_and_removed_lints))]
// Ignored clippy lints // Ignored clippy lints
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))] #![cfg_attr(feature = "cargo-clippy", allow(float_cmp, needless_doctest_main))]
@@ -153,6 +153,7 @@
feature = "cargo-clippy", feature = "cargo-clippy",
allow( allow(
cloned_instead_of_copied, cloned_instead_of_copied,
doc_link_with_quotes, // https://github.com/rust-lang/rust-clippy/issues/8961
empty_line_after_outer_attr, empty_line_after_outer_attr,
manual_assert, manual_assert,
missing_docs_in_private_items, missing_docs_in_private_items,
@@ -161,6 +162,7 @@
must_use_candidate, must_use_candidate,
redundant_field_names, redundant_field_names,
too_many_lines, too_many_lines,
type_repetition_in_bounds, // https://github.com/rust-lang/rust-clippy/issues/8772
use_debug, use_debug,
use_self use_self
) )
+7 -4
View File
@@ -14,13 +14,16 @@ unstable = ["serde/unstable"]
serde = { path = "../serde" } serde = { path = "../serde" }
[build-dependencies] [build-dependencies]
toolchain_find = "0.1" toolchain_find = "0.2"
[dev-dependencies] [dev-dependencies]
fnv = "1.0" fnv = "1.0"
macrotest = "=1.0.0" macrotest = "=1.0.9"
prettyplease = "=0.1.14"
rustversion = "1.0" rustversion = "1.0"
serde = { path = "../serde", features = ["rc", "derive"] } serde = { path = "../serde", features = ["rc"] }
serde_derive = { path = "../serde_derive", features = ["deserialize_in_place"] } wa-serde-derive = { path = "../wa-serde-derive" }
serde_test = { path = "../serde_test" } serde_test = { path = "../serde_test" }
trybuild = { version = "1.0.49", features = ["diff"] } trybuild = { version = "1.0.49", features = ["diff"] }
[workspace]
+1 -5
View File
@@ -18,12 +18,8 @@ fn has_cargo_expand() -> bool {
.unwrap_or(false) .unwrap_or(false)
} }
fn has_rustfmt() -> bool {
toolchain_find::find_installed_component("rustfmt").is_some()
}
fn main() { fn main() {
if cfg!(feature = "expandtest") && has_cargo_expand() && has_rustfmt() { if cfg!(feature = "expandtest") && has_cargo_expand() {
println!("cargo:rustc-cfg=expandtest"); println!("cargo:rustc-cfg=expandtest");
} }
} }
+4
View File
@@ -1,5 +1,9 @@
#![cfg(any())]
#[cfg_attr(target_os = "emscripten", ignore)] #[cfg_attr(target_os = "emscripten", ignore)]
#[rustversion::attr(not(nightly), ignore)] #[rustversion::attr(not(nightly), ignore)]
#[cfg_attr(miri, ignore)]
#[allow(unused_attributes)]
#[test] #[test]
fn ui() { fn ui() {
let t = trybuild::TestCases::new(); let t = trybuild::TestCases::new();
+161 -172
View File
@@ -28,7 +28,12 @@ const _: () = {
{ {
match *self { match *self {
DeEnum::Unit => { DeEnum::Unit => {
_serde::Serializer::serialize_unit_variant(__serializer, "DeEnum", 0u32, "Unit") _serde::Serializer::serialize_unit_variant(
__serializer,
"DeEnum",
0u32,
"Unit",
)
} }
DeEnum::Seq(ref __field0, ref __field1, ref __field2, ref __field3) => { DeEnum::Seq(ref __field0, ref __field1, ref __field2, ref __field3) => {
let mut __serde_state = match _serde::Serializer::serialize_tuple_variant( let mut __serde_state = match _serde::Serializer::serialize_tuple_variant(
@@ -81,12 +86,7 @@ const _: () = {
}; };
_serde::ser::SerializeTupleVariant::end(__serde_state) _serde::ser::SerializeTupleVariant::end(__serde_state)
} }
DeEnum::Map { DeEnum::Map { ref a, ref b, ref c, ref d } => {
ref a,
ref b,
ref c,
ref d,
} => {
let mut __serde_state = match _serde::Serializer::serialize_struct_variant( let mut __serde_state = match _serde::Serializer::serialize_struct_variant(
__serializer, __serializer,
"DeEnum", "DeEnum",
@@ -141,13 +141,20 @@ const _: () = {
}; };
_serde::ser::SerializeStructVariant::end(__serde_state) _serde::ser::SerializeStructVariant::end(__serde_state)
} }
DeEnum::_Unit2 => _serde::Serializer::serialize_unit_variant( DeEnum::_Unit2 => {
__serializer, _serde::Serializer::serialize_unit_variant(
"DeEnum", __serializer,
3u32, "DeEnum",
"_Unit2", 3u32,
), "_Unit2",
DeEnum::_Seq2(ref __field0, ref __field1, ref __field2, ref __field3) => { )
}
DeEnum::_Seq2(
ref __field0,
ref __field1,
ref __field2,
ref __field3,
) => {
let mut __serde_state = match _serde::Serializer::serialize_tuple_variant( let mut __serde_state = match _serde::Serializer::serialize_tuple_variant(
__serializer, __serializer,
"DeEnum", "DeEnum",
@@ -198,12 +205,7 @@ const _: () = {
}; };
_serde::ser::SerializeTupleVariant::end(__serde_state) _serde::ser::SerializeTupleVariant::end(__serde_state)
} }
DeEnum::_Map2 { DeEnum::_Map2 { ref a, ref b, ref c, ref d } => {
ref a,
ref b,
ref c,
ref d,
} => {
let mut __serde_state = match _serde::Serializer::serialize_struct_variant( let mut __serde_state = match _serde::Serializer::serialize_struct_variant(
__serializer, __serializer,
"DeEnum", "DeEnum",
@@ -274,7 +276,9 @@ const _: () = {
C: _serde::Deserialize<'de>, C: _serde::Deserialize<'de>,
D: _serde::Deserialize<'de>, D: _serde::Deserialize<'de>,
{ {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -294,9 +298,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "variant identifier") _serde::__private::Formatter::write_str(
__formatter,
"variant identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -307,10 +317,14 @@ const _: () = {
3u64 => _serde::__private::Ok(__Field::__field3), 3u64 => _serde::__private::Ok(__Field::__field3),
4u64 => _serde::__private::Ok(__Field::__field4), 4u64 => _serde::__private::Ok(__Field::__field4),
5u64 => _serde::__private::Ok(__Field::__field5), 5u64 => _serde::__private::Ok(__Field::__field5),
_ => _serde::__private::Err(_serde::de::Error::invalid_value( _ => {
_serde::de::Unexpected::Unsigned(__value), _serde::__private::Err(
&"variant index 0 <= i < 6", _serde::de::Error::invalid_value(
)), _serde::de::Unexpected::Unsigned(__value),
&"variant index 0 <= i < 6",
),
)
}
} }
} }
fn visit_str<__E>( fn visit_str<__E>(
@@ -327,9 +341,11 @@ const _: () = {
"_Unit2" => _serde::__private::Ok(__Field::__field3), "_Unit2" => _serde::__private::Ok(__Field::__field3),
"_Seq2" => _serde::__private::Ok(__Field::__field4), "_Seq2" => _serde::__private::Ok(__Field::__field4),
"_Map2" => _serde::__private::Ok(__Field::__field5), "_Map2" => _serde::__private::Ok(__Field::__field5),
_ => _serde::__private::Err(_serde::de::Error::unknown_variant( _ => {
__value, VARIANTS, _serde::__private::Err(
)), _serde::de::Error::unknown_variant(__value, VARIANTS),
)
}
} }
} }
fn visit_bytes<__E>( fn visit_bytes<__E>(
@@ -348,9 +364,9 @@ const _: () = {
b"_Map2" => _serde::__private::Ok(__Field::__field5), b"_Map2" => _serde::__private::Ok(__Field::__field5),
_ => { _ => {
let __value = &_serde::__private::from_utf8_lossy(__value); let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant( _serde::__private::Err(
__value, VARIANTS, _serde::de::Error::unknown_variant(__value, VARIANTS),
)) )
} }
} }
} }
@@ -363,7 +379,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, B, C, D> struct __Visitor<'de, B, C, D>
@@ -420,7 +439,8 @@ const _: () = {
marker: _serde::__private::PhantomData<DeEnum<B, C, D>>, marker: _serde::__private::PhantomData<DeEnum<B, C, D>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, B, C, D> _serde::de::Visitor<'de> for __Visitor<'de, B, C, D> impl<'de, B, C, D> _serde::de::Visitor<'de>
for __Visitor<'de, B, C, D>
where where
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
C: _serde::Deserialize<'de>, C: _serde::Deserialize<'de>,
@@ -430,8 +450,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"tuple variant DeEnum::Seq", "tuple variant DeEnum::Seq",
@@ -447,9 +466,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
i8, i8,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -467,9 +484,7 @@ const _: () = {
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::< let __field1 = match match _serde::de::SeqAccess::next_element::<
B, B,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -487,9 +502,7 @@ const _: () = {
}; };
let __field2 = match match _serde::de::SeqAccess::next_element::< let __field2 = match match _serde::de::SeqAccess::next_element::<
C, C,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -507,9 +520,7 @@ const _: () = {
}; };
let __field3 = match match _serde::de::SeqAccess::next_element::< let __field3 = match match _serde::de::SeqAccess::next_element::<
D, D,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -525,9 +536,9 @@ const _: () = {
); );
} }
}; };
_serde::__private::Ok(DeEnum::Seq( _serde::__private::Ok(
__field0, __field1, __field2, __field3, DeEnum::Seq(__field0, __field1, __field2, __field3),
)) )
} }
} }
_serde::de::VariantAccess::tuple_variant( _serde::de::VariantAccess::tuple_variant(
@@ -554,8 +565,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"field identifier", "field identifier",
@@ -630,7 +640,8 @@ const _: () = {
marker: _serde::__private::PhantomData<DeEnum<B, C, D>>, marker: _serde::__private::PhantomData<DeEnum<B, C, D>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, B, C, D> _serde::de::Visitor<'de> for __Visitor<'de, B, C, D> impl<'de, B, C, D> _serde::de::Visitor<'de>
for __Visitor<'de, B, C, D>
where where
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
C: _serde::Deserialize<'de>, C: _serde::Deserialize<'de>,
@@ -640,8 +651,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"struct variant DeEnum::Map", "struct variant DeEnum::Map",
@@ -657,9 +667,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
i8, i8,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -677,9 +685,7 @@ const _: () = {
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::< let __field1 = match match _serde::de::SeqAccess::next_element::<
B, B,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -697,9 +703,7 @@ const _: () = {
}; };
let __field2 = match match _serde::de::SeqAccess::next_element::< let __field2 = match match _serde::de::SeqAccess::next_element::<
C, C,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -717,9 +721,7 @@ const _: () = {
}; };
let __field3 = match match _serde::de::SeqAccess::next_element::< let __field3 = match match _serde::de::SeqAccess::next_element::<
D, D,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -750,32 +752,28 @@ const _: () = {
where where
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: _serde::__private::Option<i8> = let mut __field0: _serde::__private::Option<i8> = _serde::__private::None;
_serde::__private::None; let mut __field1: _serde::__private::Option<B> = _serde::__private::None;
let mut __field1: _serde::__private::Option<B> = let mut __field2: _serde::__private::Option<C> = _serde::__private::None;
_serde::__private::None; let mut __field3: _serde::__private::Option<D> = _serde::__private::None;
let mut __field2: _serde::__private::Option<C> = while let _serde::__private::Some(__key)
_serde::__private::None; = match _serde::de::MapAccess::next_key::<
let mut __field3: _serde::__private::Option<D> = __Field,
_serde::__private::None; >(&mut __map) {
while let _serde::__private::Some(__key) =
match _serde::de::MapAccess::next_key::<__Field>(&mut __map)
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("a")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("a"),
);
} }
__field0 = _serde::__private::Some( __field0 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<i8>( match _serde::de::MapAccess::next_value::<i8>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -785,12 +783,12 @@ const _: () = {
} }
__Field::__field1 => { __Field::__field1 => {
if _serde::__private::Option::is_some(&__field1) { if _serde::__private::Option::is_some(&__field1) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("b")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("b"),
);
} }
__field1 = _serde::__private::Some( __field1 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<B>( match _serde::de::MapAccess::next_value::<B>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -800,12 +798,12 @@ const _: () = {
} }
__Field::__field2 => { __Field::__field2 => {
if _serde::__private::Option::is_some(&__field2) { if _serde::__private::Option::is_some(&__field2) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("c")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("c"),
);
} }
__field2 = _serde::__private::Some( __field2 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<C>( match _serde::de::MapAccess::next_value::<C>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -815,12 +813,12 @@ const _: () = {
} }
__Field::__field3 => { __Field::__field3 => {
if _serde::__private::Option::is_some(&__field3) { if _serde::__private::Option::is_some(&__field3) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("d")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("d"),
);
} }
__field3 = _serde::__private::Some( __field3 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<D>( match _serde::de::MapAccess::next_value::<D>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -831,9 +829,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>( >(&mut __map) {
&mut __map
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -894,7 +890,12 @@ const _: () = {
}) })
} }
} }
const FIELDS: &'static [&'static str] = &["a", "b", "c", "d"]; const FIELDS: &'static [&'static str] = &[
"a",
"b",
"c",
"d",
];
_serde::de::VariantAccess::struct_variant( _serde::de::VariantAccess::struct_variant(
__variant, __variant,
FIELDS, FIELDS,
@@ -923,7 +924,8 @@ const _: () = {
marker: _serde::__private::PhantomData<DeEnum<B, C, D>>, marker: _serde::__private::PhantomData<DeEnum<B, C, D>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, B, C, D> _serde::de::Visitor<'de> for __Visitor<'de, B, C, D> impl<'de, B, C, D> _serde::de::Visitor<'de>
for __Visitor<'de, B, C, D>
where where
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
C: _serde::Deserialize<'de>, C: _serde::Deserialize<'de>,
@@ -933,8 +935,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"tuple variant DeEnum::_Seq2", "tuple variant DeEnum::_Seq2",
@@ -950,9 +951,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
i8, i8,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -970,9 +969,7 @@ const _: () = {
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::< let __field1 = match match _serde::de::SeqAccess::next_element::<
B, B,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -990,9 +987,7 @@ const _: () = {
}; };
let __field2 = match match _serde::de::SeqAccess::next_element::< let __field2 = match match _serde::de::SeqAccess::next_element::<
C, C,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1010,9 +1005,7 @@ const _: () = {
}; };
let __field3 = match match _serde::de::SeqAccess::next_element::< let __field3 = match match _serde::de::SeqAccess::next_element::<
D, D,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1028,9 +1021,9 @@ const _: () = {
); );
} }
}; };
_serde::__private::Ok(DeEnum::_Seq2( _serde::__private::Ok(
__field0, __field1, __field2, __field3, DeEnum::_Seq2(__field0, __field1, __field2, __field3),
)) )
} }
} }
_serde::de::VariantAccess::tuple_variant( _serde::de::VariantAccess::tuple_variant(
@@ -1057,8 +1050,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"field identifier", "field identifier",
@@ -1133,7 +1125,8 @@ const _: () = {
marker: _serde::__private::PhantomData<DeEnum<B, C, D>>, marker: _serde::__private::PhantomData<DeEnum<B, C, D>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, B, C, D> _serde::de::Visitor<'de> for __Visitor<'de, B, C, D> impl<'de, B, C, D> _serde::de::Visitor<'de>
for __Visitor<'de, B, C, D>
where where
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
C: _serde::Deserialize<'de>, C: _serde::Deserialize<'de>,
@@ -1143,8 +1136,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"struct variant DeEnum::_Map2", "struct variant DeEnum::_Map2",
@@ -1160,9 +1152,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
i8, i8,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1180,9 +1170,7 @@ const _: () = {
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::< let __field1 = match match _serde::de::SeqAccess::next_element::<
B, B,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1200,9 +1188,7 @@ const _: () = {
}; };
let __field2 = match match _serde::de::SeqAccess::next_element::< let __field2 = match match _serde::de::SeqAccess::next_element::<
C, C,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1220,9 +1206,7 @@ const _: () = {
}; };
let __field3 = match match _serde::de::SeqAccess::next_element::< let __field3 = match match _serde::de::SeqAccess::next_element::<
D, D,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1253,32 +1237,28 @@ const _: () = {
where where
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: _serde::__private::Option<i8> = let mut __field0: _serde::__private::Option<i8> = _serde::__private::None;
_serde::__private::None; let mut __field1: _serde::__private::Option<B> = _serde::__private::None;
let mut __field1: _serde::__private::Option<B> = let mut __field2: _serde::__private::Option<C> = _serde::__private::None;
_serde::__private::None; let mut __field3: _serde::__private::Option<D> = _serde::__private::None;
let mut __field2: _serde::__private::Option<C> = while let _serde::__private::Some(__key)
_serde::__private::None; = match _serde::de::MapAccess::next_key::<
let mut __field3: _serde::__private::Option<D> = __Field,
_serde::__private::None; >(&mut __map) {
while let _serde::__private::Some(__key) =
match _serde::de::MapAccess::next_key::<__Field>(&mut __map)
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("a")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("a"),
);
} }
__field0 = _serde::__private::Some( __field0 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<i8>( match _serde::de::MapAccess::next_value::<i8>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1288,12 +1268,12 @@ const _: () = {
} }
__Field::__field1 => { __Field::__field1 => {
if _serde::__private::Option::is_some(&__field1) { if _serde::__private::Option::is_some(&__field1) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("b")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("b"),
);
} }
__field1 = _serde::__private::Some( __field1 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<B>( match _serde::de::MapAccess::next_value::<B>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1303,12 +1283,12 @@ const _: () = {
} }
__Field::__field2 => { __Field::__field2 => {
if _serde::__private::Option::is_some(&__field2) { if _serde::__private::Option::is_some(&__field2) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("c")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("c"),
);
} }
__field2 = _serde::__private::Some( __field2 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<C>( match _serde::de::MapAccess::next_value::<C>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1318,12 +1298,12 @@ const _: () = {
} }
__Field::__field3 => { __Field::__field3 => {
if _serde::__private::Option::is_some(&__field3) { if _serde::__private::Option::is_some(&__field3) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("d")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("d"),
);
} }
__field3 = _serde::__private::Some( __field3 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<D>( match _serde::de::MapAccess::next_value::<D>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1334,9 +1314,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>( >(&mut __map) {
&mut __map
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -1397,7 +1375,12 @@ const _: () = {
}) })
} }
} }
const FIELDS: &'static [&'static str] = &["a", "b", "c", "d"]; const FIELDS: &'static [&'static str] = &[
"a",
"b",
"c",
"d",
];
_serde::de::VariantAccess::struct_variant( _serde::de::VariantAccess::struct_variant(
__variant, __variant,
FIELDS, FIELDS,
@@ -1410,8 +1393,14 @@ const _: () = {
} }
} }
} }
const VARIANTS: &'static [&'static str] = const VARIANTS: &'static [&'static str] = &[
&["Unit", "Seq", "Map", "_Unit2", "_Seq2", "_Map2"]; "Unit",
"Seq",
"Map",
"_Unit2",
"_Seq2",
"_Map2",
];
_serde::Deserializer::deserialize_enum( _serde::Deserializer::deserialize_enum(
__deserializer, __deserializer,
"DeEnum", "DeEnum",
+93 -55
View File
@@ -52,8 +52,11 @@ const _: () = {
#[allow(unused_extern_crates, clippy::useless_attribute)] #[allow(unused_extern_crates, clippy::useless_attribute)]
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, T: AssociatedType<X = i32>> _serde::Deserialize<'de> for DefaultTyParam<T> { impl<'de, T: AssociatedType<X = i32>> _serde::Deserialize<'de>
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> for DefaultTyParam<T> {
fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -69,9 +72,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "field identifier") _serde::__private::Formatter::write_str(
__formatter,
"field identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -113,20 +122,27 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, T: AssociatedType<X = i32>> { struct __Visitor<'de, T: AssociatedType<X = i32>> {
marker: _serde::__private::PhantomData<DefaultTyParam<T>>, marker: _serde::__private::PhantomData<DefaultTyParam<T>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, T: AssociatedType<X = i32>> _serde::de::Visitor<'de> for __Visitor<'de, T> { impl<'de, T: AssociatedType<X = i32>> _serde::de::Visitor<'de>
for __Visitor<'de, T> {
type Value = DefaultTyParam<T>; type Value = DefaultTyParam<T>;
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "struct DefaultTyParam") _serde::__private::Formatter::write_str(
__formatter,
"struct DefaultTyParam",
)
} }
#[inline] #[inline]
fn visit_seq<__A>( fn visit_seq<__A>(
@@ -136,9 +152,9 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::<PhantomData<T>>( let __field0 = match match _serde::de::SeqAccess::next_element::<
&mut __seq, PhantomData<T>,
) { >(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -146,13 +162,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
0usize, _serde::de::Error::invalid_length(
&"struct DefaultTyParam with 1 element", 0usize,
)); &"struct DefaultTyParam with 1 element",
),
);
} }
}; };
_serde::__private::Ok(DefaultTyParam { phantom: __field0 }) _serde::__private::Ok(DefaultTyParam {
phantom: __field0,
})
} }
#[inline] #[inline]
fn visit_map<__A>( fn visit_map<__A>(
@@ -162,16 +182,14 @@ const _: () = {
where where
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: _serde::__private::Option<PhantomData<T>> = let mut __field0: _serde::__private::Option<PhantomData<T>> = _serde::__private::None;
_serde::__private::None; while let _serde::__private::Some(__key)
while let _serde::__private::Some(__key) = = match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
@@ -182,9 +200,9 @@ const _: () = {
); );
} }
__field0 = _serde::__private::Some( __field0 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<PhantomData<T>>( match _serde::de::MapAccess::next_value::<
&mut __map, PhantomData<T>,
) { >(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -195,8 +213,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>(&mut __map) >(&mut __map) {
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -216,7 +233,9 @@ const _: () = {
} }
} }
}; };
_serde::__private::Ok(DefaultTyParam { phantom: __field0 }) _serde::__private::Ok(DefaultTyParam {
phantom: __field0,
})
} }
} }
const FIELDS: &'static [&'static str] = &["phantom"]; const FIELDS: &'static [&'static str] = &["phantom"];
@@ -249,9 +268,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "field identifier") _serde::__private::Formatter::write_str(
__formatter,
"field identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -293,22 +318,30 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, 'place, T: AssociatedType<X = i32> + 'place> { struct __Visitor<'de, 'place, T: AssociatedType<X = i32> + 'place> {
place: &'place mut DefaultTyParam<T>, place: &'place mut DefaultTyParam<T>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'place, T: AssociatedType<X = i32> + 'place> _serde::de::Visitor<'de> impl<
for __Visitor<'de, 'place, T> 'de,
{ 'place,
T: AssociatedType<X = i32> + 'place,
> _serde::de::Visitor<'de> for __Visitor<'de, 'place, T> {
type Value = (); type Value = ();
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "struct DefaultTyParam") _serde::__private::Formatter::write_str(
__formatter,
"struct DefaultTyParam",
)
} }
#[inline] #[inline]
fn visit_seq<__A>( fn visit_seq<__A>(
@@ -318,19 +351,22 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.phantom), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.phantom),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
0usize, return _serde::__private::Err(
&"struct DefaultTyParam with 1 element", _serde::de::Error::invalid_length(
)); 0usize,
&"struct DefaultTyParam with 1 element",
),
);
} }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
@@ -343,14 +379,13 @@ const _: () = {
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: bool = false; let mut __field0: bool = false;
while let _serde::__private::Some(__key) = while let _serde::__private::Some(__key)
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) { = match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if __field0 { if __field0 {
@@ -374,8 +409,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>(&mut __map) >(&mut __map) {
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -385,13 +419,17 @@ const _: () = {
} }
} }
if !__field0 { if !__field0 {
self.place.phantom = match _serde::__private::de::missing_field("phantom") { self
.place
.phantom = match _serde::__private::de::missing_field(
"phantom",
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
}; }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
} }
+100 -69
View File
@@ -24,12 +24,14 @@ const _: () = {
__S: _serde::Serializer, __S: _serde::Serializer,
{ {
match *self { match *self {
GenericEnum::Unit => _serde::Serializer::serialize_unit_variant( GenericEnum::Unit => {
__serializer, _serde::Serializer::serialize_unit_variant(
"GenericEnum", __serializer,
0u32, "GenericEnum",
"Unit", 0u32,
), "Unit",
)
}
GenericEnum::NewType(ref __field0) => { GenericEnum::NewType(ref __field0) => {
_serde::Serializer::serialize_newtype_variant( _serde::Serializer::serialize_newtype_variant(
__serializer, __serializer,
@@ -122,7 +124,9 @@ const _: () = {
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
U: _serde::Deserialize<'de>, U: _serde::Deserialize<'de>,
{ {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -140,9 +144,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "variant identifier") _serde::__private::Formatter::write_str(
__formatter,
"variant identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -151,10 +161,14 @@ const _: () = {
1u64 => _serde::__private::Ok(__Field::__field1), 1u64 => _serde::__private::Ok(__Field::__field1),
2u64 => _serde::__private::Ok(__Field::__field2), 2u64 => _serde::__private::Ok(__Field::__field2),
3u64 => _serde::__private::Ok(__Field::__field3), 3u64 => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Err(_serde::de::Error::invalid_value( _ => {
_serde::de::Unexpected::Unsigned(__value), _serde::__private::Err(
&"variant index 0 <= i < 4", _serde::de::Error::invalid_value(
)), _serde::de::Unexpected::Unsigned(__value),
&"variant index 0 <= i < 4",
),
)
}
} }
} }
fn visit_str<__E>( fn visit_str<__E>(
@@ -169,9 +183,11 @@ const _: () = {
"NewType" => _serde::__private::Ok(__Field::__field1), "NewType" => _serde::__private::Ok(__Field::__field1),
"Seq" => _serde::__private::Ok(__Field::__field2), "Seq" => _serde::__private::Ok(__Field::__field2),
"Map" => _serde::__private::Ok(__Field::__field3), "Map" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Err(_serde::de::Error::unknown_variant( _ => {
__value, VARIANTS, _serde::__private::Err(
)), _serde::de::Error::unknown_variant(__value, VARIANTS),
)
}
} }
} }
fn visit_bytes<__E>( fn visit_bytes<__E>(
@@ -188,9 +204,9 @@ const _: () = {
b"Map" => _serde::__private::Ok(__Field::__field3), b"Map" => _serde::__private::Ok(__Field::__field3),
_ => { _ => {
let __value = &_serde::__private::from_utf8_lossy(__value); let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant( _serde::__private::Err(
__value, VARIANTS, _serde::de::Error::unknown_variant(__value, VARIANTS),
)) )
} }
} }
} }
@@ -203,7 +219,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, T, U> struct __Visitor<'de, T, U>
@@ -224,7 +243,10 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "enum GenericEnum") _serde::__private::Formatter::write_str(
__formatter,
"enum GenericEnum",
)
} }
fn visit_enum<__A>( fn visit_enum<__A>(
self, self,
@@ -248,10 +270,12 @@ const _: () = {
}; };
_serde::__private::Ok(GenericEnum::Unit) _serde::__private::Ok(GenericEnum::Unit)
} }
(__Field::__field1, __variant) => _serde::__private::Result::map( (__Field::__field1, __variant) => {
_serde::de::VariantAccess::newtype_variant::<T>(__variant), _serde::__private::Result::map(
GenericEnum::NewType, _serde::de::VariantAccess::newtype_variant::<T>(__variant),
), GenericEnum::NewType,
)
}
(__Field::__field2, __variant) => { (__Field::__field2, __variant) => {
struct __Visitor<'de, T, U> struct __Visitor<'de, T, U>
where where
@@ -261,7 +285,8 @@ const _: () = {
marker: _serde::__private::PhantomData<GenericEnum<T, U>>, marker: _serde::__private::PhantomData<GenericEnum<T, U>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, T, U> _serde::de::Visitor<'de> for __Visitor<'de, T, U> impl<'de, T, U> _serde::de::Visitor<'de>
for __Visitor<'de, T, U>
where where
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
U: _serde::Deserialize<'de>, U: _serde::Deserialize<'de>,
@@ -270,8 +295,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"tuple variant GenericEnum::Seq", "tuple variant GenericEnum::Seq",
@@ -287,9 +311,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
T, T,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -297,14 +319,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde :: __private :: Err (_serde :: de :: Error :: invalid_length (0usize , & "tuple variant GenericEnum::Seq with 2 elements")) ; return _serde::__private::Err(
_serde::de::Error::invalid_length(
0usize,
&"tuple variant GenericEnum::Seq with 2 elements",
),
);
} }
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::< let __field1 = match match _serde::de::SeqAccess::next_element::<
U, U,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -312,7 +337,12 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde :: __private :: Err (_serde :: de :: Error :: invalid_length (1usize , & "tuple variant GenericEnum::Seq with 2 elements")) ; return _serde::__private::Err(
_serde::de::Error::invalid_length(
1usize,
&"tuple variant GenericEnum::Seq with 2 elements",
),
);
} }
}; };
_serde::__private::Ok(GenericEnum::Seq(__field0, __field1)) _serde::__private::Ok(GenericEnum::Seq(__field0, __field1))
@@ -340,8 +370,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"field identifier", "field identifier",
@@ -409,7 +438,8 @@ const _: () = {
marker: _serde::__private::PhantomData<GenericEnum<T, U>>, marker: _serde::__private::PhantomData<GenericEnum<T, U>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, T, U> _serde::de::Visitor<'de> for __Visitor<'de, T, U> impl<'de, T, U> _serde::de::Visitor<'de>
for __Visitor<'de, T, U>
where where
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
U: _serde::Deserialize<'de>, U: _serde::Deserialize<'de>,
@@ -418,8 +448,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"struct variant GenericEnum::Map", "struct variant GenericEnum::Map",
@@ -435,9 +464,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
T, T,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -445,14 +472,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde :: __private :: Err (_serde :: de :: Error :: invalid_length (0usize , & "struct variant GenericEnum::Map with 2 elements")) ; return _serde::__private::Err(
_serde::de::Error::invalid_length(
0usize,
&"struct variant GenericEnum::Map with 2 elements",
),
);
} }
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::< let __field1 = match match _serde::de::SeqAccess::next_element::<
U, U,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -460,7 +490,12 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde :: __private :: Err (_serde :: de :: Error :: invalid_length (1usize , & "struct variant GenericEnum::Map with 2 elements")) ; return _serde::__private::Err(
_serde::de::Error::invalid_length(
1usize,
&"struct variant GenericEnum::Map with 2 elements",
),
);
} }
}; };
_serde::__private::Ok(GenericEnum::Map { _serde::__private::Ok(GenericEnum::Map {
@@ -476,28 +511,26 @@ const _: () = {
where where
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: _serde::__private::Option<T> = let mut __field0: _serde::__private::Option<T> = _serde::__private::None;
_serde::__private::None; let mut __field1: _serde::__private::Option<U> = _serde::__private::None;
let mut __field1: _serde::__private::Option<U> = while let _serde::__private::Some(__key)
_serde::__private::None; = match _serde::de::MapAccess::next_key::<
while let _serde::__private::Some(__key) = __Field,
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) >(&mut __map) {
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("x")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("x"),
);
} }
__field0 = _serde::__private::Some( __field0 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<T>( match _serde::de::MapAccess::next_value::<T>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -507,12 +540,12 @@ const _: () = {
} }
__Field::__field1 => { __Field::__field1 => {
if _serde::__private::Option::is_some(&__field1) { if _serde::__private::Option::is_some(&__field1) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("y")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("y"),
);
} }
__field1 = _serde::__private::Some( __field1 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<U>( match _serde::de::MapAccess::next_value::<U>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -523,9 +556,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>( >(&mut __map) {
&mut __map
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
+112 -66
View File
@@ -29,7 +29,11 @@ const _: () = {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "x", &self.x) { match _serde::ser::SerializeStruct::serialize_field(
&mut __serde_state,
"x",
&self.x,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -49,7 +53,9 @@ const _: () = {
where where
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
{ {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -65,9 +71,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "field identifier") _serde::__private::Formatter::write_str(
__formatter,
"field identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -109,7 +121,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, T> struct __Visitor<'de, T>
@@ -128,7 +143,10 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "struct GenericStruct") _serde::__private::Formatter::write_str(
__formatter,
"struct GenericStruct",
)
} }
#[inline] #[inline]
fn visit_seq<__A>( fn visit_seq<__A>(
@@ -138,8 +156,9 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::<T>(&mut __seq) let __field0 = match match _serde::de::SeqAccess::next_element::<
{ T,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -147,10 +166,12 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
0usize, _serde::de::Error::invalid_length(
&"struct GenericStruct with 1 element", 0usize,
)); &"struct GenericStruct with 1 element",
),
);
} }
}; };
_serde::__private::Ok(GenericStruct { x: __field0 }) _serde::__private::Ok(GenericStruct { x: __field0 })
@@ -164,14 +185,13 @@ const _: () = {
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: _serde::__private::Option<T> = _serde::__private::None; let mut __field0: _serde::__private::Option<T> = _serde::__private::None;
while let _serde::__private::Some(__key) = while let _serde::__private::Some(__key)
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) { = match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
@@ -191,8 +211,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>(&mut __map) >(&mut __map) {
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -245,9 +264,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "field identifier") _serde::__private::Formatter::write_str(
__formatter,
"field identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -289,7 +314,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, 'place, T: 'place> struct __Visitor<'de, 'place, T: 'place>
@@ -299,7 +327,8 @@ const _: () = {
place: &'place mut GenericStruct<T>, place: &'place mut GenericStruct<T>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'place, T: 'place> _serde::de::Visitor<'de> for __Visitor<'de, 'place, T> impl<'de, 'place, T: 'place> _serde::de::Visitor<'de>
for __Visitor<'de, 'place, T>
where where
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
{ {
@@ -308,7 +337,10 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "struct GenericStruct") _serde::__private::Formatter::write_str(
__formatter,
"struct GenericStruct",
)
} }
#[inline] #[inline]
fn visit_seq<__A>( fn visit_seq<__A>(
@@ -318,19 +350,22 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.x), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.x),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
0usize, return _serde::__private::Err(
&"struct GenericStruct with 1 element", _serde::de::Error::invalid_length(
)); 0usize,
&"struct GenericStruct with 1 element",
),
);
} }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
@@ -343,14 +378,13 @@ const _: () = {
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: bool = false; let mut __field0: bool = false;
while let _serde::__private::Some(__key) = while let _serde::__private::Some(__key)
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) { = match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if __field0 { if __field0 {
@@ -372,8 +406,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>(&mut __map) >(&mut __map) {
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -383,13 +416,15 @@ const _: () = {
} }
} }
if !__field0 { if !__field0 {
self.place.x = match _serde::__private::de::missing_field("x") { self
.place
.x = match _serde::__private::de::missing_field("x") {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
}; }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
} }
@@ -442,7 +477,9 @@ const _: () = {
where where
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
{ {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -475,7 +512,9 @@ const _: () = {
where where
__E: _serde::Deserializer<'de>, __E: _serde::Deserializer<'de>,
{ {
let __field0: T = match <T as _serde::Deserialize>::deserialize(__e) { let __field0: T = match <T as _serde::Deserialize>::deserialize(
__e,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -491,8 +530,9 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::<T>(&mut __seq) let __field0 = match match _serde::de::SeqAccess::next_element::<
{ T,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -500,10 +540,12 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
0usize, _serde::de::Error::invalid_length(
&"tuple struct GenericNewTypeStruct with 1 element", 0usize,
)); &"tuple struct GenericNewTypeStruct with 1 element",
),
);
} }
}; };
_serde::__private::Ok(GenericNewTypeStruct(__field0)) _serde::__private::Ok(GenericNewTypeStruct(__field0))
@@ -532,7 +574,8 @@ const _: () = {
place: &'place mut GenericNewTypeStruct<T>, place: &'place mut GenericNewTypeStruct<T>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'place, T: 'place> _serde::de::Visitor<'de> for __Visitor<'de, 'place, T> impl<'de, 'place, T: 'place> _serde::de::Visitor<'de>
for __Visitor<'de, 'place, T>
where where
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
{ {
@@ -564,19 +607,22 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.0), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.0),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
0usize, return _serde::__private::Err(
&"tuple struct GenericNewTypeStruct with 1 element", _serde::de::Error::invalid_length(
)); 0usize,
&"tuple struct GenericNewTypeStruct with 1 element",
),
);
} }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
+55 -40
View File
@@ -11,7 +11,9 @@ const _: () = {
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
U: _serde::Deserialize<'de>, U: _serde::Deserialize<'de>,
{ {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -46,8 +48,9 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::<T>(&mut __seq) let __field0 = match match _serde::de::SeqAccess::next_element::<
{ T,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -55,14 +58,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
0usize, _serde::de::Error::invalid_length(
&"tuple struct GenericTupleStruct with 2 elements", 0usize,
)); &"tuple struct GenericTupleStruct with 2 elements",
),
);
} }
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::<U>(&mut __seq) let __field1 = match match _serde::de::SeqAccess::next_element::<
{ U,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -70,10 +76,12 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
1usize, _serde::de::Error::invalid_length(
&"tuple struct GenericTupleStruct with 2 elements", 1usize,
)); &"tuple struct GenericTupleStruct with 2 elements",
),
);
} }
}; };
_serde::__private::Ok(GenericTupleStruct(__field0, __field1)) _serde::__private::Ok(GenericTupleStruct(__field0, __field1))
@@ -104,7 +112,8 @@ const _: () = {
place: &'place mut GenericTupleStruct<T, U>, place: &'place mut GenericTupleStruct<T, U>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'place, T: 'place, U: 'place> _serde::de::Visitor<'de> for __Visitor<'de, 'place, T, U> impl<'de, 'place, T: 'place, U: 'place> _serde::de::Visitor<'de>
for __Visitor<'de, 'place, T, U>
where where
T: _serde::Deserialize<'de>, T: _serde::Deserialize<'de>,
U: _serde::Deserialize<'de>, U: _serde::Deserialize<'de>,
@@ -127,33 +136,39 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.0), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.0),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
0usize, return _serde::__private::Err(
&"tuple struct GenericTupleStruct with 2 elements", _serde::de::Error::invalid_length(
)); 0usize,
&"tuple struct GenericTupleStruct with 2 elements",
),
);
} }
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.1), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.1),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
1usize, return _serde::__private::Err(
&"tuple struct GenericTupleStruct with 2 elements", _serde::de::Error::invalid_length(
)); 1usize,
&"tuple struct GenericTupleStruct with 2 elements",
),
);
} }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
+109 -73
View File
@@ -99,7 +99,9 @@ const _: () = {
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de, 'a> _serde::Deserialize<'de> for Lifetimes<'a> { impl<'de, 'a> _serde::Deserialize<'de> for Lifetimes<'a> {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -117,9 +119,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "variant identifier") _serde::__private::Formatter::write_str(
__formatter,
"variant identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -128,10 +136,14 @@ const _: () = {
1u64 => _serde::__private::Ok(__Field::__field1), 1u64 => _serde::__private::Ok(__Field::__field1),
2u64 => _serde::__private::Ok(__Field::__field2), 2u64 => _serde::__private::Ok(__Field::__field2),
3u64 => _serde::__private::Ok(__Field::__field3), 3u64 => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Err(_serde::de::Error::invalid_value( _ => {
_serde::de::Unexpected::Unsigned(__value), _serde::__private::Err(
&"variant index 0 <= i < 4", _serde::de::Error::invalid_value(
)), _serde::de::Unexpected::Unsigned(__value),
&"variant index 0 <= i < 4",
),
)
}
} }
} }
fn visit_str<__E>( fn visit_str<__E>(
@@ -146,9 +158,11 @@ const _: () = {
"NoLifetimeSeq" => _serde::__private::Ok(__Field::__field1), "NoLifetimeSeq" => _serde::__private::Ok(__Field::__field1),
"LifetimeMap" => _serde::__private::Ok(__Field::__field2), "LifetimeMap" => _serde::__private::Ok(__Field::__field2),
"NoLifetimeMap" => _serde::__private::Ok(__Field::__field3), "NoLifetimeMap" => _serde::__private::Ok(__Field::__field3),
_ => _serde::__private::Err(_serde::de::Error::unknown_variant( _ => {
__value, VARIANTS, _serde::__private::Err(
)), _serde::de::Error::unknown_variant(__value, VARIANTS),
)
}
} }
} }
fn visit_bytes<__E>( fn visit_bytes<__E>(
@@ -165,9 +179,9 @@ const _: () = {
b"NoLifetimeMap" => _serde::__private::Ok(__Field::__field3), b"NoLifetimeMap" => _serde::__private::Ok(__Field::__field3),
_ => { _ => {
let __value = &_serde::__private::from_utf8_lossy(__value); let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant( _serde::__private::Err(
__value, VARIANTS, _serde::de::Error::unknown_variant(__value, VARIANTS),
)) )
} }
} }
} }
@@ -180,7 +194,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, 'a> { struct __Visitor<'de, 'a> {
@@ -193,7 +210,10 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "enum Lifetimes") _serde::__private::Formatter::write_str(
__formatter,
"enum Lifetimes",
)
} }
fn visit_enum<__A>( fn visit_enum<__A>(
self, self,
@@ -208,14 +228,22 @@ const _: () = {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} { } {
(__Field::__field0, __variant) => _serde::__private::Result::map( (__Field::__field0, __variant) => {
_serde::de::VariantAccess::newtype_variant::<&'a i32>(__variant), _serde::__private::Result::map(
Lifetimes::LifetimeSeq, _serde::de::VariantAccess::newtype_variant::<
), &'a i32,
(__Field::__field1, __variant) => _serde::__private::Result::map( >(__variant),
_serde::de::VariantAccess::newtype_variant::<i32>(__variant), Lifetimes::LifetimeSeq,
Lifetimes::NoLifetimeSeq, )
), }
(__Field::__field1, __variant) => {
_serde::__private::Result::map(
_serde::de::VariantAccess::newtype_variant::<
i32,
>(__variant),
Lifetimes::NoLifetimeSeq,
)
}
(__Field::__field2, __variant) => { (__Field::__field2, __variant) => {
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
enum __Field { enum __Field {
@@ -228,8 +256,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"field identifier", "field identifier",
@@ -290,13 +317,13 @@ const _: () = {
marker: _serde::__private::PhantomData<Lifetimes<'a>>, marker: _serde::__private::PhantomData<Lifetimes<'a>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'a> _serde::de::Visitor<'de> for __Visitor<'de, 'a> { impl<'de, 'a> _serde::de::Visitor<'de>
for __Visitor<'de, 'a> {
type Value = Lifetimes<'a>; type Value = Lifetimes<'a>;
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"struct variant Lifetimes::LifetimeMap", "struct variant Lifetimes::LifetimeMap",
@@ -312,9 +339,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
&'a i32, &'a i32,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -322,10 +347,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde :: __private :: Err (_serde :: de :: Error :: invalid_length (0usize , & "struct variant Lifetimes::LifetimeMap with 1 element")) ; return _serde::__private::Err(
_serde::de::Error::invalid_length(
0usize,
&"struct variant Lifetimes::LifetimeMap with 1 element",
),
);
} }
}; };
_serde::__private::Ok(Lifetimes::LifetimeMap { a: __field0 }) _serde::__private::Ok(Lifetimes::LifetimeMap {
a: __field0,
})
} }
#[inline] #[inline]
fn visit_map<__A>( fn visit_map<__A>(
@@ -335,26 +367,27 @@ const _: () = {
where where
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: _serde::__private::Option<&'a i32> = let mut __field0: _serde::__private::Option<&'a i32> = _serde::__private::None;
_serde::__private::None; while let _serde::__private::Some(__key)
while let _serde::__private::Some(__key) = = match _serde::de::MapAccess::next_key::<
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) __Field,
{ >(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("a")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("a"),
);
} }
__field0 = _serde::__private::Some( __field0 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<&'a i32>( match _serde::de::MapAccess::next_value::<
&mut __map, &'a i32,
) { >(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -365,9 +398,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>( >(&mut __map) {
&mut __map
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -387,7 +418,9 @@ const _: () = {
} }
} }
}; };
_serde::__private::Ok(Lifetimes::LifetimeMap { a: __field0 }) _serde::__private::Ok(Lifetimes::LifetimeMap {
a: __field0,
})
} }
} }
const FIELDS: &'static [&'static str] = &["a"]; const FIELDS: &'static [&'static str] = &["a"];
@@ -412,8 +445,7 @@ const _: () = {
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"field identifier", "field identifier",
@@ -474,13 +506,13 @@ const _: () = {
marker: _serde::__private::PhantomData<Lifetimes<'a>>, marker: _serde::__private::PhantomData<Lifetimes<'a>>,
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'a> _serde::de::Visitor<'de> for __Visitor<'de, 'a> { impl<'de, 'a> _serde::de::Visitor<'de>
for __Visitor<'de, 'a> {
type Value = Lifetimes<'a>; type Value = Lifetimes<'a>;
fn expecting( fn expecting(
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result ) -> _serde::__private::fmt::Result {
{
_serde::__private::Formatter::write_str( _serde::__private::Formatter::write_str(
__formatter, __formatter,
"struct variant Lifetimes::NoLifetimeMap", "struct variant Lifetimes::NoLifetimeMap",
@@ -496,9 +528,7 @@ const _: () = {
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::< let __field0 = match match _serde::de::SeqAccess::next_element::<
i32, i32,
>( >(&mut __seq) {
&mut __seq
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -506,10 +536,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde :: __private :: Err (_serde :: de :: Error :: invalid_length (0usize , & "struct variant Lifetimes::NoLifetimeMap with 1 element")) ; return _serde::__private::Err(
_serde::de::Error::invalid_length(
0usize,
&"struct variant Lifetimes::NoLifetimeMap with 1 element",
),
);
} }
}; };
_serde::__private::Ok(Lifetimes::NoLifetimeMap { a: __field0 }) _serde::__private::Ok(Lifetimes::NoLifetimeMap {
a: __field0,
})
} }
#[inline] #[inline]
fn visit_map<__A>( fn visit_map<__A>(
@@ -519,26 +556,25 @@ const _: () = {
where where
__A: _serde::de::MapAccess<'de>, __A: _serde::de::MapAccess<'de>,
{ {
let mut __field0: _serde::__private::Option<i32> = let mut __field0: _serde::__private::Option<i32> = _serde::__private::None;
_serde::__private::None; while let _serde::__private::Some(__key)
while let _serde::__private::Some(__key) = = match _serde::de::MapAccess::next_key::<
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) __Field,
{ >(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
return _serde :: __private :: Err (< __A :: Error as _serde :: de :: Error > :: duplicate_field ("a")) ; return _serde::__private::Err(
<__A::Error as _serde::de::Error>::duplicate_field("a"),
);
} }
__field0 = _serde::__private::Some( __field0 = _serde::__private::Some(
match _serde::de::MapAccess::next_value::<i32>( match _serde::de::MapAccess::next_value::<i32>(&mut __map) {
&mut __map,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -549,9 +585,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>( >(&mut __map) {
&mut __map
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -571,7 +605,9 @@ const _: () = {
} }
} }
}; };
_serde::__private::Ok(Lifetimes::NoLifetimeMap { a: __field0 }) _serde::__private::Ok(Lifetimes::NoLifetimeMap {
a: __field0,
})
} }
} }
const FIELDS: &'static [&'static str] = &["a"]; const FIELDS: &'static [&'static str] = &["a"];
+146 -88
View File
@@ -33,19 +33,31 @@ const _: () = {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "a", &self.a) { match _serde::ser::SerializeStruct::serialize_field(
&mut __serde_state,
"a",
&self.a,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "b", &self.b) { match _serde::ser::SerializeStruct::serialize_field(
&mut __serde_state,
"b",
&self.b,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
match _serde::ser::SerializeStruct::serialize_field(&mut __serde_state, "c", &self.c) { match _serde::ser::SerializeStruct::serialize_field(
&mut __serde_state,
"c",
&self.c,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -72,7 +84,9 @@ const _: () = {
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
C: _serde::Deserialize<'de>, C: _serde::Deserialize<'de>,
{ {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -90,9 +104,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "field identifier") _serde::__private::Formatter::write_str(
__formatter,
"field identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -140,7 +160,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, A, B, C> struct __Visitor<'de, A, B, C>
@@ -163,7 +186,10 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "struct DeNamedMap") _serde::__private::Formatter::write_str(
__formatter,
"struct DeNamedMap",
)
} }
#[inline] #[inline]
fn visit_seq<__A>( fn visit_seq<__A>(
@@ -173,8 +199,9 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::<A>(&mut __seq) let __field0 = match match _serde::de::SeqAccess::next_element::<
{ A,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -182,14 +209,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
0usize, _serde::de::Error::invalid_length(
&"struct DeNamedMap with 3 elements", 0usize,
)); &"struct DeNamedMap with 3 elements",
),
);
} }
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::<B>(&mut __seq) let __field1 = match match _serde::de::SeqAccess::next_element::<
{ B,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -197,14 +227,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
1usize, _serde::de::Error::invalid_length(
&"struct DeNamedMap with 3 elements", 1usize,
)); &"struct DeNamedMap with 3 elements",
),
);
} }
}; };
let __field2 = match match _serde::de::SeqAccess::next_element::<C>(&mut __seq) let __field2 = match match _serde::de::SeqAccess::next_element::<
{ C,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -212,10 +245,12 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
2usize, _serde::de::Error::invalid_length(
&"struct DeNamedMap with 3 elements", 2usize,
)); &"struct DeNamedMap with 3 elements",
),
);
} }
}; };
_serde::__private::Ok(DeNamedMap { _serde::__private::Ok(DeNamedMap {
@@ -235,14 +270,13 @@ const _: () = {
let mut __field0: _serde::__private::Option<A> = _serde::__private::None; let mut __field0: _serde::__private::Option<A> = _serde::__private::None;
let mut __field1: _serde::__private::Option<B> = _serde::__private::None; let mut __field1: _serde::__private::Option<B> = _serde::__private::None;
let mut __field2: _serde::__private::Option<C> = _serde::__private::None; let mut __field2: _serde::__private::Option<C> = _serde::__private::None;
while let _serde::__private::Some(__key) = while let _serde::__private::Some(__key)
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) { = match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if _serde::__private::Option::is_some(&__field0) { if _serde::__private::Option::is_some(&__field0) {
@@ -292,8 +326,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>(&mut __map) >(&mut __map) {
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -374,9 +407,15 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "field identifier") _serde::__private::Formatter::write_str(
__formatter,
"field identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
@@ -424,7 +463,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de, 'place, A: 'place, B: 'place, C: 'place> struct __Visitor<'de, 'place, A: 'place, B: 'place, C: 'place>
@@ -437,7 +479,7 @@ const _: () = {
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'place, A: 'place, B: 'place, C: 'place> _serde::de::Visitor<'de> impl<'de, 'place, A: 'place, B: 'place, C: 'place> _serde::de::Visitor<'de>
for __Visitor<'de, 'place, A, B, C> for __Visitor<'de, 'place, A, B, C>
where where
A: _serde::Deserialize<'de>, A: _serde::Deserialize<'de>,
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
@@ -448,7 +490,10 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "struct DeNamedMap") _serde::__private::Formatter::write_str(
__formatter,
"struct DeNamedMap",
)
} }
#[inline] #[inline]
fn visit_seq<__A>( fn visit_seq<__A>(
@@ -458,47 +503,56 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.a), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.a),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
0usize, return _serde::__private::Err(
&"struct DeNamedMap with 3 elements", _serde::de::Error::invalid_length(
)); 0usize,
&"struct DeNamedMap with 3 elements",
),
);
} }
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.b), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.b),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
1usize, return _serde::__private::Err(
&"struct DeNamedMap with 3 elements", _serde::de::Error::invalid_length(
)); 1usize,
&"struct DeNamedMap with 3 elements",
),
);
} }
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.c), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.c),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
2usize, return _serde::__private::Err(
&"struct DeNamedMap with 3 elements", _serde::de::Error::invalid_length(
)); 2usize,
&"struct DeNamedMap with 3 elements",
),
);
} }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
@@ -513,14 +567,13 @@ const _: () = {
let mut __field0: bool = false; let mut __field0: bool = false;
let mut __field1: bool = false; let mut __field1: bool = false;
let mut __field2: bool = false; let mut __field2: bool = false;
while let _serde::__private::Some(__key) = while let _serde::__private::Some(__key)
match _serde::de::MapAccess::next_key::<__Field>(&mut __map) { = match _serde::de::MapAccess::next_key::<__Field>(&mut __map) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
} } {
{
match __key { match __key {
__Field::__field0 => { __Field::__field0 => {
if __field0 { if __field0 {
@@ -576,8 +629,7 @@ const _: () = {
_ => { _ => {
let _ = match _serde::de::MapAccess::next_value::< let _ = match _serde::de::MapAccess::next_value::<
_serde::de::IgnoredAny, _serde::de::IgnoredAny,
>(&mut __map) >(&mut __map) {
{
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -587,29 +639,35 @@ const _: () = {
} }
} }
if !__field0 { if !__field0 {
self.place.a = match _serde::__private::de::missing_field("a") { self
.place
.a = match _serde::__private::de::missing_field("a") {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
}; }
if !__field1 { if !__field1 {
self.place.b = match _serde::__private::de::missing_field("b") { self
.place
.b = match _serde::__private::de::missing_field("b") {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
}; }
if !__field2 { if !__field2 {
self.place.c = match _serde::__private::de::missing_field("c") { self
.place
.c = match _serde::__private::de::missing_field("c") {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
}; }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
} }
+91 -62
View File
@@ -29,19 +29,28 @@ const _: () = {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
match _serde::ser::SerializeTupleStruct::serialize_field(&mut __serde_state, &self.0) { match _serde::ser::SerializeTupleStruct::serialize_field(
&mut __serde_state,
&self.0,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
match _serde::ser::SerializeTupleStruct::serialize_field(&mut __serde_state, &self.1) { match _serde::ser::SerializeTupleStruct::serialize_field(
&mut __serde_state,
&self.1,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
} }
}; };
match _serde::ser::SerializeTupleStruct::serialize_field(&mut __serde_state, &self.2) { match _serde::ser::SerializeTupleStruct::serialize_field(
&mut __serde_state,
&self.2,
) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -64,7 +73,9 @@ const _: () = {
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
C: _serde::Deserialize<'de>, C: _serde::Deserialize<'de>,
{ {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -101,8 +112,9 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
let __field0 = match match _serde::de::SeqAccess::next_element::<A>(&mut __seq) let __field0 = match match _serde::de::SeqAccess::next_element::<
{ A,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -110,14 +122,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
0usize, _serde::de::Error::invalid_length(
&"tuple struct DeNamedTuple with 3 elements", 0usize,
)); &"tuple struct DeNamedTuple with 3 elements",
),
);
} }
}; };
let __field1 = match match _serde::de::SeqAccess::next_element::<B>(&mut __seq) let __field1 = match match _serde::de::SeqAccess::next_element::<
{ B,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -125,14 +140,17 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
1usize, _serde::de::Error::invalid_length(
&"tuple struct DeNamedTuple with 3 elements", 1usize,
)); &"tuple struct DeNamedTuple with 3 elements",
),
);
} }
}; };
let __field2 = match match _serde::de::SeqAccess::next_element::<C>(&mut __seq) let __field2 = match match _serde::de::SeqAccess::next_element::<
{ C,
>(&mut __seq) {
_serde::__private::Ok(__val) => __val, _serde::__private::Ok(__val) => __val,
_serde::__private::Err(__err) => { _serde::__private::Err(__err) => {
return _serde::__private::Err(__err); return _serde::__private::Err(__err);
@@ -140,10 +158,12 @@ const _: () = {
} { } {
_serde::__private::Some(__value) => __value, _serde::__private::Some(__value) => __value,
_serde::__private::None => { _serde::__private::None => {
return _serde::__private::Err(_serde::de::Error::invalid_length( return _serde::__private::Err(
2usize, _serde::de::Error::invalid_length(
&"tuple struct DeNamedTuple with 3 elements", 2usize,
)); &"tuple struct DeNamedTuple with 3 elements",
),
);
} }
}; };
_serde::__private::Ok(DeNamedTuple(__field0, __field1, __field2)) _serde::__private::Ok(DeNamedTuple(__field0, __field1, __field2))
@@ -176,7 +196,7 @@ const _: () = {
lifetime: _serde::__private::PhantomData<&'de ()>, lifetime: _serde::__private::PhantomData<&'de ()>,
} }
impl<'de, 'place, A: 'place, B: 'place, C: 'place> _serde::de::Visitor<'de> impl<'de, 'place, A: 'place, B: 'place, C: 'place> _serde::de::Visitor<'de>
for __Visitor<'de, 'place, A, B, C> for __Visitor<'de, 'place, A, B, C>
where where
A: _serde::Deserialize<'de>, A: _serde::Deserialize<'de>,
B: _serde::Deserialize<'de>, B: _serde::Deserialize<'de>,
@@ -200,47 +220,56 @@ const _: () = {
where where
__A: _serde::de::SeqAccess<'de>, __A: _serde::de::SeqAccess<'de>,
{ {
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.0), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.0),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
0usize, return _serde::__private::Err(
&"tuple struct DeNamedTuple with 3 elements", _serde::de::Error::invalid_length(
)); 0usize,
&"tuple struct DeNamedTuple with 3 elements",
),
);
} }
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.1), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.1),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
1usize, return _serde::__private::Err(
&"tuple struct DeNamedTuple with 3 elements", _serde::de::Error::invalid_length(
)); 1usize,
&"tuple struct DeNamedTuple with 3 elements",
),
);
} }
if let _serde::__private::None = match _serde::de::SeqAccess::next_element_seed( if let _serde::__private::None
&mut __seq, = match _serde::de::SeqAccess::next_element_seed(
_serde::__private::de::InPlaceSeed(&mut self.place.2), &mut __seq,
) { _serde::__private::de::InPlaceSeed(&mut self.place.2),
_serde::__private::Ok(__val) => __val, ) {
_serde::__private::Err(__err) => { _serde::__private::Ok(__val) => __val,
return _serde::__private::Err(__err); _serde::__private::Err(__err) => {
} return _serde::__private::Err(__err);
} { }
return _serde::__private::Err(_serde::de::Error::invalid_length( } {
2usize, return _serde::__private::Err(
&"tuple struct DeNamedTuple with 3 elements", _serde::de::Error::invalid_length(
)); 2usize,
&"tuple struct DeNamedTuple with 3 elements",
),
);
} }
_serde::__private::Ok(()) _serde::__private::Ok(())
} }
+12 -3
View File
@@ -25,7 +25,9 @@ const _: () = {
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de> _serde::Deserialize<'de> for NamedUnit { impl<'de> _serde::Deserialize<'de> for NamedUnit {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -36,7 +38,10 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "unit struct NamedUnit") _serde::__private::Formatter::write_str(
__formatter,
"unit struct NamedUnit",
)
} }
#[inline] #[inline]
fn visit_unit<__E>(self) -> _serde::__private::Result<Self::Value, __E> fn visit_unit<__E>(self) -> _serde::__private::Result<Self::Value, __E>
@@ -46,7 +51,11 @@ const _: () = {
_serde::__private::Ok(NamedUnit) _serde::__private::Ok(NamedUnit)
} }
} }
_serde::Deserializer::deserialize_unit_struct(__deserializer, "NamedUnit", __Visitor) _serde::Deserializer::deserialize_unit_struct(
__deserializer,
"NamedUnit",
__Visitor,
)
} }
} }
}; };
+24 -25
View File
@@ -31,12 +31,14 @@ const _: () = {
__S: _serde::Serializer, __S: _serde::Serializer,
{ {
match *self { match *self {
SerEnum::Unit => _serde::Serializer::serialize_unit_variant( SerEnum::Unit => {
__serializer, _serde::Serializer::serialize_unit_variant(
"SerEnum", __serializer,
0u32, "SerEnum",
"Unit", 0u32,
), "Unit",
)
}
SerEnum::Seq(ref __field0, ref __field1, ref __field2, ref __field3) => { SerEnum::Seq(ref __field0, ref __field1, ref __field2, ref __field3) => {
let mut __serde_state = match _serde::Serializer::serialize_tuple_variant( let mut __serde_state = match _serde::Serializer::serialize_tuple_variant(
__serializer, __serializer,
@@ -88,12 +90,7 @@ const _: () = {
}; };
_serde::ser::SerializeTupleVariant::end(__serde_state) _serde::ser::SerializeTupleVariant::end(__serde_state)
} }
SerEnum::Map { SerEnum::Map { ref a, ref b, ref c, ref d } => {
ref a,
ref b,
ref c,
ref d,
} => {
let mut __serde_state = match _serde::Serializer::serialize_struct_variant( let mut __serde_state = match _serde::Serializer::serialize_struct_variant(
__serializer, __serializer,
"SerEnum", "SerEnum",
@@ -148,13 +145,20 @@ const _: () = {
}; };
_serde::ser::SerializeStructVariant::end(__serde_state) _serde::ser::SerializeStructVariant::end(__serde_state)
} }
SerEnum::_Unit2 => _serde::Serializer::serialize_unit_variant( SerEnum::_Unit2 => {
__serializer, _serde::Serializer::serialize_unit_variant(
"SerEnum", __serializer,
3u32, "SerEnum",
"_Unit2", 3u32,
), "_Unit2",
SerEnum::_Seq2(ref __field0, ref __field1, ref __field2, ref __field3) => { )
}
SerEnum::_Seq2(
ref __field0,
ref __field1,
ref __field2,
ref __field3,
) => {
let mut __serde_state = match _serde::Serializer::serialize_tuple_variant( let mut __serde_state = match _serde::Serializer::serialize_tuple_variant(
__serializer, __serializer,
"SerEnum", "SerEnum",
@@ -205,12 +209,7 @@ const _: () = {
}; };
_serde::ser::SerializeTupleVariant::end(__serde_state) _serde::ser::SerializeTupleVariant::end(__serde_state)
} }
SerEnum::_Map2 { SerEnum::_Map2 { ref a, ref b, ref c, ref d } => {
ref a,
ref b,
ref c,
ref d,
} => {
let mut __serde_state = match _serde::Serializer::serialize_struct_variant( let mut __serde_state = match _serde::Serializer::serialize_struct_variant(
__serializer, __serializer,
"SerEnum", "SerEnum",
+31 -14
View File
@@ -25,7 +25,9 @@ const _: () = {
extern crate serde as _serde; extern crate serde as _serde;
#[automatically_derived] #[automatically_derived]
impl<'de> _serde::Deserialize<'de> for Void { impl<'de> _serde::Deserialize<'de> for Void {
fn deserialize<__D>(__deserializer: __D) -> _serde::__private::Result<Self, __D::Error> fn deserialize<__D>(
__deserializer: __D,
) -> _serde::__private::Result<Self, __D::Error>
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
@@ -38,17 +40,27 @@ const _: () = {
&self, &self,
__formatter: &mut _serde::__private::Formatter, __formatter: &mut _serde::__private::Formatter,
) -> _serde::__private::fmt::Result { ) -> _serde::__private::fmt::Result {
_serde::__private::Formatter::write_str(__formatter, "variant identifier") _serde::__private::Formatter::write_str(
__formatter,
"variant identifier",
)
} }
fn visit_u64<__E>(self, __value: u64) -> _serde::__private::Result<Self::Value, __E> fn visit_u64<__E>(
self,
__value: u64,
) -> _serde::__private::Result<Self::Value, __E>
where where
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
match __value { match __value {
_ => _serde::__private::Err(_serde::de::Error::invalid_value( _ => {
_serde::de::Unexpected::Unsigned(__value), _serde::__private::Err(
&"variant index 0 <= i < 0", _serde::de::Error::invalid_value(
)), _serde::de::Unexpected::Unsigned(__value),
&"variant index 0 <= i < 0",
),
)
}
} }
} }
fn visit_str<__E>( fn visit_str<__E>(
@@ -59,9 +71,11 @@ const _: () = {
__E: _serde::de::Error, __E: _serde::de::Error,
{ {
match __value { match __value {
_ => _serde::__private::Err(_serde::de::Error::unknown_variant( _ => {
__value, VARIANTS, _serde::__private::Err(
)), _serde::de::Error::unknown_variant(__value, VARIANTS),
)
}
} }
} }
fn visit_bytes<__E>( fn visit_bytes<__E>(
@@ -74,9 +88,9 @@ const _: () = {
match __value { match __value {
_ => { _ => {
let __value = &_serde::__private::from_utf8_lossy(__value); let __value = &_serde::__private::from_utf8_lossy(__value);
_serde::__private::Err(_serde::de::Error::unknown_variant( _serde::__private::Err(
__value, VARIANTS, _serde::de::Error::unknown_variant(__value, VARIANTS),
)) )
} }
} }
} }
@@ -89,7 +103,10 @@ const _: () = {
where where
__D: _serde::Deserializer<'de>, __D: _serde::Deserializer<'de>,
{ {
_serde::Deserializer::deserialize_identifier(__deserializer, __FieldVisitor) _serde::Deserializer::deserialize_identifier(
__deserializer,
__FieldVisitor,
)
} }
} }
struct __Visitor<'de> { struct __Visitor<'de> {
+1
View File
@@ -1,6 +1,7 @@
#[cfg_attr(target_os = "emscripten", ignore)] #[cfg_attr(target_os = "emscripten", ignore)]
#[cfg_attr(not(expandtest), ignore)] #[cfg_attr(not(expandtest), ignore)]
#[rustversion::attr(not(nightly), ignore)] #[rustversion::attr(not(nightly), ignore)]
#[cfg_attr(miri, ignore)]
#[allow(unused_attributes)] #[allow(unused_attributes)]
#[test] #[test]
fn expandtest() { fn expandtest() {
+52 -66
View File
@@ -1,93 +1,79 @@
#![allow(unused_macro_rules)]
use serde_test::Token;
use std::iter;
macro_rules! btreeset { macro_rules! btreeset {
() => { () => {
BTreeSet::new() BTreeSet::new()
}; };
($($value:expr),+) => { ($($value:expr),+) => {{
{ let mut set = BTreeSet::new();
let mut set = BTreeSet::new(); $(set.insert($value);)+
$(set.insert($value);)+ set
set }};
}
}
} }
macro_rules! btreemap { macro_rules! btreemap {
() => { () => {
BTreeMap::new() BTreeMap::new()
}; };
($($key:expr => $value:expr),+) => { ($($key:expr => $value:expr),+) => {{
{ let mut map = BTreeMap::new();
let mut map = BTreeMap::new(); $(map.insert($key, $value);)+
$(map.insert($key, $value);)+ map
map }};
}
}
} }
macro_rules! hashset { macro_rules! hashset {
() => { () => {
HashSet::new() HashSet::new()
}; };
($($value:expr),+) => { ($($value:expr),+) => {{
{ let mut set = HashSet::new();
let mut set = HashSet::new(); $(set.insert($value);)+
$(set.insert($value);)+ set
set }};
} ($hasher:ident @ $($value:expr),+) => {{
}; use std::hash::BuildHasherDefault;
($hasher:ident @ $($value:expr),+) => { let mut set = HashSet::with_hasher(BuildHasherDefault::<$hasher>::default());
{ $(set.insert($value);)+
use std::hash::BuildHasherDefault; set
let mut set = HashSet::with_hasher(BuildHasherDefault::<$hasher>::default()); }};
$(set.insert($value);)+
set
}
}
} }
macro_rules! hashmap { macro_rules! hashmap {
() => { () => {
HashMap::new() HashMap::new()
}; };
($($key:expr => $value:expr),+) => { ($($key:expr => $value:expr),+) => {{
{ let mut map = HashMap::new();
let mut map = HashMap::new(); $(map.insert($key, $value);)+
$(map.insert($key, $value);)+ map
map }};
} ($hasher:ident @ $($key:expr => $value:expr),+) => {{
}; use std::hash::BuildHasherDefault;
($hasher:ident @ $($key:expr => $value:expr),+) => { let mut map = HashMap::with_hasher(BuildHasherDefault::<$hasher>::default());
{ $(map.insert($key, $value);)+
use std::hash::BuildHasherDefault; map
let mut map = HashMap::with_hasher(BuildHasherDefault::<$hasher>::default()); }};
$(map.insert($key, $value);)+ }
map
} pub trait SingleTokenIntoIterator {
fn into_iter(self) -> iter::Once<Token>;
}
impl SingleTokenIntoIterator for Token {
fn into_iter(self) -> iter::Once<Token> {
iter::once(self)
} }
} }
macro_rules! seq_impl {
(seq $first:expr,) => {
seq_impl!(seq $first)
};
($first:expr,) => {
seq_impl!($first)
};
(seq $first:expr) => {
$first.into_iter()
};
($first:expr) => {
Some($first).into_iter()
};
(seq $first:expr , $( $elem: tt)*) => {
$first.into_iter().chain(seq!( $($elem)* ))
};
($first:expr , $($elem: tt)*) => {
Some($first).into_iter().chain(seq!( $($elem)* ))
}
}
macro_rules! seq { macro_rules! seq {
($($tt: tt)*) => { ($($elem:expr),* $(,)?) => {{
seq_impl!($($tt)*).collect::<Vec<_>>() use crate::macros::SingleTokenIntoIterator;
}; let mut vec = Vec::new();
$(<Vec<Token> as Extend<Token>>::extend(&mut vec, $elem.into_iter());)*
vec
}};
} }
+4 -1
View File
@@ -1,14 +1,17 @@
#![allow( #![allow(
clippy::cast_lossless, clippy::cast_lossless,
clippy::derive_partial_eq_without_eq,
clippy::from_over_into, clippy::from_over_into,
// Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422 // Clippy bug: https://github.com/rust-lang/rust-clippy/issues/7422
clippy::nonstandard_macro_braces, clippy::nonstandard_macro_braces,
clippy::too_many_lines, clippy::too_many_lines,
clippy::trivially_copy_pass_by_ref clippy::trivially_copy_pass_by_ref,
clippy::type_repetition_in_bounds
)] )]
use serde::de::{self, MapAccess, Unexpected, Visitor}; use serde::de::{self, MapAccess, Unexpected, Visitor};
use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde::{Deserialize, Deserializer, Serialize, Serializer};
use serde_derive::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap}; use std::collections::{BTreeMap, HashMap};
use std::convert::TryFrom; use std::convert::TryFrom;
+6 -1
View File
@@ -1,6 +1,11 @@
#![allow(clippy::items_after_statements, clippy::used_underscore_binding)] #![allow(
clippy::derive_partial_eq_without_eq,
clippy::items_after_statements,
clippy::used_underscore_binding
)]
use serde::{Deserialize, Deserializer}; use serde::{Deserialize, Deserializer};
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens, assert_de_tokens_error, Token}; use serde_test::{assert_de_tokens, assert_de_tokens_error, Token};
use std::borrow::Cow; use std::borrow::Cow;
+1741 -1116
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -2,10 +2,12 @@
// successfully when there are a variety of generics and non-(de)serializable // successfully when there are a variety of generics and non-(de)serializable
// types involved. // types involved.
#![cfg(any())]
#![deny(warnings)] #![deny(warnings)]
#![allow( #![allow(
unknown_lints, unknown_lints,
mixed_script_confusables, mixed_script_confusables,
clippy::derive_partial_eq_without_eq,
clippy::items_after_statements, clippy::items_after_statements,
clippy::missing_errors_doc, clippy::missing_errors_doc,
clippy::missing_panics_doc, clippy::missing_panics_doc,
@@ -14,7 +16,8 @@
clippy::nonstandard_macro_braces, clippy::nonstandard_macro_braces,
clippy::ptr_arg, clippy::ptr_arg,
clippy::too_many_lines, clippy::too_many_lines,
clippy::trivially_copy_pass_by_ref clippy::trivially_copy_pass_by_ref,
clippy::type_repetition_in_bounds
)] )]
use serde::de::DeserializeOwned; use serde::de::DeserializeOwned;
+4 -1
View File
@@ -1,5 +1,8 @@
//! Tests for `#[serde(field_identifier)]` and `#[serde(variant_identifier)]` //! Tests for `#[serde(field_identifier)]` and `#[serde(variant_identifier)]`
use serde::Deserialize;
#![allow(clippy::derive_partial_eq_without_eq)]
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens, Token}; use serde_test::{assert_de_tokens, Token};
#[test] #[test]
+3
View File
@@ -1,8 +1,11 @@
#![allow(clippy::derive_partial_eq_without_eq)]
use serde::de::value::{Error, MapDeserializer, SeqDeserializer}; use serde::de::value::{Error, MapDeserializer, SeqDeserializer};
use serde::de::{ use serde::de::{
DeserializeSeed, EnumAccess, IgnoredAny, IntoDeserializer, VariantAccess, Visitor, DeserializeSeed, EnumAccess, IgnoredAny, IntoDeserializer, VariantAccess, Visitor,
}; };
use serde::{forward_to_deserialize_any, Deserialize, Deserializer}; use serde::{forward_to_deserialize_any, Deserialize, Deserializer};
use serde_derive::Deserialize;
#[derive(PartialEq, Debug, Deserialize)] #[derive(PartialEq, Debug, Deserialize)]
enum Target { enum Target {
+2 -1
View File
@@ -1,5 +1,6 @@
#![deny(trivial_numeric_casts)] #![deny(trivial_numeric_casts)]
#![allow( #![allow(
clippy::derive_partial_eq_without_eq,
clippy::enum_variant_names, clippy::enum_variant_names,
clippy::redundant_field_names, clippy::redundant_field_names,
clippy::too_many_lines clippy::too_many_lines
@@ -7,7 +8,7 @@
mod bytes; mod bytes;
use serde::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
use serde_test::{ use serde_test::{
assert_de_tokens, assert_de_tokens_error, assert_ser_tokens, assert_tokens, Token, assert_de_tokens, assert_de_tokens_error, assert_ser_tokens, assert_tokens, Token,
}; };
+1 -1
View File
@@ -1,6 +1,6 @@
#![allow(clippy::redundant_field_names)] #![allow(clippy::redundant_field_names)]
use serde::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
mod remote { mod remote {
pub struct Unit; pub struct Unit;
+10 -8
View File
@@ -11,10 +11,12 @@ fn ip_addr_roundtrip() {
assert_tokens( assert_tokens(
&net::IpAddr::from(*b"1234").compact(), &net::IpAddr::from(*b"1234").compact(),
&seq![ &seq![
Token::NewtypeVariant { name: "IpAddr", variant: "V4" }, Token::NewtypeVariant {
name: "IpAddr",
variant: "V4"
},
Token::Tuple { len: 4 }, Token::Tuple { len: 4 },
seq b"1234".iter().map(|&b| Token::U8(b)), b"1234".iter().copied().map(Token::U8),
Token::TupleEnd, Token::TupleEnd,
], ],
); );
@@ -25,14 +27,14 @@ fn socket_addr_roundtrip() {
assert_tokens( assert_tokens(
&net::SocketAddr::from((*b"1234567890123456", 1234)).compact(), &net::SocketAddr::from((*b"1234567890123456", 1234)).compact(),
&seq![ &seq![
Token::NewtypeVariant { name: "SocketAddr", variant: "V6" }, Token::NewtypeVariant {
name: "SocketAddr",
variant: "V6"
},
Token::Tuple { len: 2 }, Token::Tuple { len: 2 },
Token::Tuple { len: 16 }, Token::Tuple { len: 16 },
seq b"1234567890123456".iter().map(|&b| Token::U8(b)), b"1234567890123456".iter().copied().map(Token::U8),
Token::TupleEnd, Token::TupleEnd,
Token::U16(1234), Token::U16(1234),
Token::TupleEnd, Token::TupleEnd,
], ],
+1 -1
View File
@@ -1,6 +1,6 @@
#![allow(clippy::used_underscore_binding)] #![allow(clippy::used_underscore_binding)]
use serde::{Deserialize, Serialize}; use serde_derive::{Deserialize, Serialize};
#[test] #[test]
fn test_self() { fn test_self() {
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -2,7 +2,7 @@
#[test] #[test]
fn test_gen_custom_serde() { fn test_gen_custom_serde() {
#[derive(serde::Serialize, serde::Deserialize)] #[derive(serde_derive::Serialize, serde_derive::Deserialize)]
#[serde(crate = "fake_serde")] #[serde(crate = "fake_serde")]
struct Foo; struct Foo;
+1
View File
@@ -1,4 +1,5 @@
#![deny(warnings)] #![deny(warnings)]
#![allow(clippy::derive_partial_eq_without_eq)]
// This test target is convoluted with the actual #[test] in a separate file to // This test target is convoluted with the actual #[test] in a separate file to
// get it so that the stable compiler does not need to parse the code of the // get it so that the stable compiler does not need to parse the code of the
+2 -2
View File
@@ -1,8 +1,9 @@
#![allow(clippy::similar_names)] #![allow(clippy::derive_partial_eq_without_eq, clippy::similar_names)]
use serde::de::value::{self, MapAccessDeserializer}; use serde::de::value::{self, MapAccessDeserializer};
use serde::de::{IntoDeserializer, MapAccess, Visitor}; use serde::de::{IntoDeserializer, MapAccess, Visitor};
use serde::{Deserialize, Deserializer}; use serde::{Deserialize, Deserializer};
use serde_derive::Deserialize;
use serde_test::{assert_de_tokens, Token}; use serde_test::{assert_de_tokens, Token};
use std::fmt; use std::fmt;
@@ -19,7 +20,6 @@ fn test_u32_to_enum() {
assert_eq!(E::B, e); assert_eq!(E::B, e);
} }
#[cfg(not(any(target_arch = "asmjs", target_arch = "wasm32")))]
#[test] #[test]
fn test_integer128() { fn test_integer128() {
let de_u128 = IntoDeserializer::<value::Error>::into_deserializer(1u128); let de_u128 = IntoDeserializer::<value::Error>::into_deserializer(1u128);
@@ -3,7 +3,14 @@ error[E0308]: mismatched types
| |
7 | #[derive(Deserialize)] 7 | #[derive(Deserialize)]
| ^^^^^^^^^^^ expected `u16`, found `u8` | ^^^^^^^^^^^ expected `u16`, found `u8`
8 | #[serde(remote = "remote::S")]
| ----------- arguments to this struct are incorrect
| |
note: tuple struct defined here
--> tests/ui/remote/wrong_de.rs:4:16
|
4 | pub struct S(pub u16);
| ^
= note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Deserialize` (in Nightly builds, run with -Z macro-backtrace for more info)
help: you can convert a `u8` to a `u16` help: you can convert a `u8` to a `u16`
| |
@@ -2,8 +2,16 @@ error[E0308]: mismatched types
--> tests/ui/remote/wrong_getter.rs:15:10 --> tests/ui/remote/wrong_getter.rs:15:10
| |
15 | #[derive(Serialize)] 15 | #[derive(Serialize)]
| ^^^^^^^^^ expected `u8`, found `u16` | ^^^^^^^^^
| |
| expected `u8`, found `u16`
| arguments to this function are incorrect
| |
= note: expected reference `&u8` = note: expected reference `&u8`
found reference `&u16` found reference `&u16`
note: function defined here
--> $WORKSPACE/serde/src/private/ser.rs
|
| pub fn constrain<T: ?Sized>(t: &T) -> &T {
| ^^^^^^^^^
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
+16 -8
View File
@@ -1,9 +1,17 @@
error[E0308]: mismatched types error[E0308]: mismatched types
--> tests/ui/remote/wrong_ser.rs:9:10 --> tests/ui/remote/wrong_ser.rs:9:10
| |
9 | #[derive(Serialize)] 9 | #[derive(Serialize)]
| ^^^^^^^^^ expected `u8`, found `u16` | ^^^^^^^^^
| | |
= note: expected reference `&u8` | expected `u8`, found `u16`
found reference `&u16` | arguments to this function are incorrect
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info) |
= note: expected reference `&u8`
found reference `&u16`
note: function defined here
--> $WORKSPACE/serde/src/private/ser.rs
|
| pub fn constrain<T: ?Sized>(t: &T) -> &T {
| ^^^^^^^^^
= note: this error originates in the derive macro `Serialize` (in Nightly builds, run with -Z macro-backtrace for more info)
+1
View File
@@ -0,0 +1 @@
*.wasm
+17
View File
@@ -0,0 +1,17 @@
[package]
name = "wa-serde-derive"
version = "0.1.137"
authors = ["David Tolnay <dtolnay@gmail.com>"]
license = "MIT OR Apache-2.0"
description = "serde_derive compiled to wasm"
repository = "https://github.com/dtolnay/watt"
include = ["src"]
[lib]
name = "serde_derive"
proc-macro = true
[dependencies]
watt = "0.4"
[workspace]
+18
View File
@@ -0,0 +1,18 @@
extern crate proc_macro;
extern crate watt;
use proc_macro::TokenStream;
use watt::WasmMacro;
static MACRO: WasmMacro = WasmMacro::new(WASM);
static WASM: &[u8] = include_bytes!("serde_derive.wasm");
#[proc_macro_derive(Serialize, attributes(serde))]
pub fn derive_serialize(input: TokenStream) -> TokenStream {
MACRO.proc_macro_derive("derive_serialize", input)
}
#[proc_macro_derive(Deserialize, attributes(serde))]
pub fn derive_deserialize(input: TokenStream) -> TokenStream {
MACRO.proc_macro_derive("derive_deserialize", input)
}