Commit Graph

2998 Commits

Author SHA1 Message Date
David Tolnay
15ee353488
IgnoredAny::visit_enum for old compilers 2019-06-27 10:45:18 -07:00
David Tolnay
e75efbfd31
Support ignoring enum with IgnoredAny 2019-06-27 10:29:55 -07:00
David Tolnay
1c97a7ecb3
Add comprehensive test for deserializing IgnoredAny from enum 2019-06-27 10:23:39 -07:00
David Tolnay
fccd3e9fba
Add deserialization tests for IgnoredAny 2019-06-27 10:07:06 -07:00
David Tolnay
4cb13b33e0
Release 1.0.93 2019-06-23 12:50:17 -07:00
David Tolnay
629802f2ab
Merge pull request #1555 from serde-rs/int
Allow integer key in untagged flattened map
2019-06-23 12:49:21 -07:00
David Tolnay
afb1754528
Allow integer key in untagged flattened map 2019-06-23 12:09:15 -07:00
David Tolnay
dbd67c6c89
Clippy const_static_lifetime lint has been renamed 2019-06-19 01:34:13 -07:00
David Tolnay
ed01bdb9dd
Remove fixed cast_precision_loss lint 2019-06-15 10:13:05 -07:00
David Tolnay
b54821d8ab
Alloc feature has been stabilized
warning: the feature `alloc` has been stable since 1.36.0 and no longer requires an attribute to enable
      --> serde/src/lib.rs:84:40
       |
    84 | #![cfg_attr(feature = "alloc", feature(alloc))]
       |                                        ^^^^^
       |
       = note: #[warn(stable_features)] on by default
2019-05-31 21:26:43 -07:00
David Tolnay
89c6a79b6e
Suppress a new pedantic lint 2019-05-31 21:25:36 -07:00
David Tolnay
cd0412bddc
Release 1.0.92 2019-05-31 13:44:01 -07:00
David Tolnay
e42262f0f5
Provide ToString for re-export by serde::export 2019-05-31 13:42:22 -07:00
David Tolnay
0a3eeab273
Merge pull request #1543 from jplatte/alloc-de-compile-fix
Fix a compile error in derive(Deserialize) with no_std + alloc
2019-05-31 13:41:07 -07:00
Jonas Platte
e4e110e28f Fix a compile error in derive(Deserialize) with no_std + alloc 2019-05-31 22:16:40 +02:00
David Tolnay
0726623389
Ignore bare_trait_objects lint to support old compilers 2019-05-31 11:34:18 -07:00
David Tolnay
fd9d334d01
Smaller format for license section 2019-05-18 17:35:47 -07:00
David Tolnay
840eb14121
Merge pull request #1528 from est31/no_variable_names
Don't use variable names
2019-05-17 08:57:14 -07:00
est31
8fef196ee4 Don't use variable names
They aren't needed. This makes the macro a bit simpler
2019-05-17 16:50:41 +02:00
David Tolnay
9c756f1ec0
Disable ui tests on emscripten
These hit a strange error in our Emscripten builder in Travis as well as
locally through cargo web:

    ERROR: failed to execute cargo: Resource temporarily unavailable (os error 11)
2019-05-12 00:28:22 -07:00
Zeyi Fan
4c29eea790 add attribute try_from 2019-05-11 23:31:24 -07:00
David Tolnay
6dd2b4607f
Switch to SPDX 2.1 license expression 2019-05-09 15:21:20 -07:00
David Tolnay
1e9ae88f53
Work around "failed to select a version for serde_test_suite"
Without this:

    error: failed to select a version for `serde_test_suite`.
        ... required by package `serde_test_suite-tests v0.0.0`
    versions that meet the requirements `= 0.0.0` are: 0.0.0

    the package `serde_test_suite-tests` depends on `serde_test_suite`, with features: `serde` but `serde_test_suite` does not have these features.

    failed to select a version for `serde_test_suite` which could resolve this conflict

Seems like a Cargo bug -- I will minimize and report.
2019-05-06 22:53:38 -07:00
David Tolnay
5cc3902ab9
Release 1.0.91 2019-05-06 16:27:04 -07:00
David Tolnay
c8e09e2d6d
Merge pull request #1522 from dtolnay/enum
Support deserializing enum out of MapAccessDeserializer
2019-05-06 16:26:43 -07:00
David Tolnay
e2a2ba116c
Remove old instructions intended for compiletest 2019-05-06 16:17:30 -07:00
David Tolnay
0a9d24a218
Support deserializing enum out of MapAccessDeserializer 2019-05-06 16:11:28 -07:00
David Tolnay
c222183669
Merge pull request #1521 from serde-rs/trybuild
Switch ui tests to trybuild
2019-05-06 10:44:25 -07:00
David Tolnay
140f9beee7
Switch ui tests to trybuild 2019-05-06 10:25:47 -07:00
David Tolnay
28ce892617
Disable compiletest in appveyor
error[E0464]: multiple matching crates for `serde`
      --> $DIR/wrong_getter.rs:15:10
       |
    15 | #[derive(Serialize)]
       |          ^^^^^^^^^
       |
       = note: candidates:
               crate `serde`: /?/C:/projects/serde/test_suite/deps/target/debug/deps/libserde-a1a28acc73b0edde.rlib
               crate `serde`: /?/C:/Users/appveyor/.
2019-04-22 23:18:21 -07:00
David Tolnay
1e6d3ff99b
Merge pull request #1512 from dtolnay/off
Temporarily disable compiletest testing in CI
2019-04-22 23:05:54 -07:00
David Tolnay
fba1b92cbf
Temporarily disable compiletest testing in CI
The nightly compiler just added a dependency on serde so libserde ends
up in the sysroot, breaking crate resolution inside of compiletest. We
will need to figure out how else to run these tests.

    error[E0464]: multiple matching crates for `serde`
      --> $DIR/wrong_ser.rs:9:10
       |
     9 | #[derive(Serialize)]
       |          ^^^^^^^^^
       |
       = note: candidates:
               crate `serde`: /rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libserde-2b75907288aa7c40.rlib
               crate `serde`: /serde/test_suite/deps/target/debug/deps/libserde-33e0a319242344ce.rlib
2019-04-22 22:42:36 -07:00
David Tolnay
ce1686379d
Update test suite to nightly-2019-04-20 2019-04-19 22:54:59 -07:00
David Tolnay
79a20e9e33
Resolve option_map_unwrap_or_else lint 2019-04-10 22:57:47 -07:00
David Tolnay
e9cd73f78e
Remove link to hjson
This project has still not been updated to Serde 1.0.
2019-04-08 10:39:55 -07:00
David Tolnay
0be7f36d51
Release 1.0.90 2019-04-03 09:41:38 -07:00
David Tolnay
4c6cb6e359
Match on serde_path to handle Some(path) and None
I find this a bit easier to follow than map + unwrap_or_else.
2019-04-03 09:40:25 -07:00
David Tolnay
82bde8d166
Format with rustfmt 2019-03-27 2019-04-03 09:40:12 -07:00
David Tolnay
465392b618
Merge pull request #1499 from sgrif/sg-custom-serde-path
Allow `#[serde(crate = "...")]` to override `extern crate serde`
2019-04-03 09:32:07 -07:00
David Tolnay
f3c6b9f05a
Simplify signature of Container::serde_path 2019-04-03 09:18:45 -07:00
David Tolnay
2f1945eaf2
Refer directly to serde_path in Deserialize impl
This makes it not a breaking change if we later want to eliminate
the `use #serde_path as _serde;` line.
2019-04-03 09:16:21 -07:00
Sean Griffin
b4d8a55b2a Change serde_path to crate
Also changed the generated code to have at least one thing refer to the
path directly, rather than via `use` -- This shows that the impl *can*
work without `use`, but doesn't actually do all the work to remove the
`use` lines unless we decide we need this feature to work on the 2015
edition
2019-03-28 11:42:50 -06:00
Sean Griffin
0e6ce8fa50 Fix for Rust 1.15 2019-03-20 14:31:49 -06:00
Sean Griffin
a295c38ba3 Allow #[serde(serde_path = "...")] to override extern crate serde
This is intended to be used by other crates which provide their own proc
macros and use serde internally. Today there's no consistent way to put
`#[derive(Deserialize)]` on a struct that consistently works, since
crates may be using either `features = ["derive"]` or relying on
`serde_derive` separately.

Even if we assume that everyone is using `features = ["derive"]`,
without this commit, any crate which generates
`#[derive(serde::Deserialize)]` forces its consumers to put `serde` in
their `Cargo.toml`, even if they aren't otherwise using serde for
anything.

Examples of crates which suffer from this in the real world are
tower-web and swirl.

With this feature, it's expected that these crates would have `pub
extern crate serde;` in some accessible path, and add
`#[serde(serde_path = "that_crate::wherever::serde")]` anywhere they
place serde's derives. Those crates would also have to derive
`that_crate::whatever::serde::Deserialize`, or `use` the macros
explicitly beforehand.

The test for this is a little funky, as it's testing this in a way that
is not the intended use case, or even one we want to support. It has its
own module which re-exports all of serde, but defines its own
`Serialize` and `Deserialize` traits. We then test that we generated
impls for those traits, instead of serde's. The only other way to test
this would be to create a new test crate which does not depend on serde,
but instead depends on `serde_derive` and a third crate which publicly
re-exports serde. This feels like way too much overhead for a single
test case, hence the funky test given.

I didn't see anywhere in this repo to document this attribute, so I
assume the docs will have to be done as a separate PR to a separate
repo.

Fixes #1487
2019-03-18 15:20:19 -06:00
David Tolnay
295730ba1e
Clippy cyclomatic complexity lint has been renamed 2019-03-09 16:36:51 -08:00
David Tolnay
ac0d8f61c5
Use non-preview name of Clippy rustup component 2019-03-01 23:11:06 -08:00
David Tolnay
b811588fa0
Release 1.0.89 2019-02-28 17:09:10 -08:00
David Tolnay
5fcdf0ff2b
Sort version-conditional imports at the bottom 2019-02-28 16:53:13 -08:00
David Tolnay
650b723da3
Format with rustfmt 2019-02-14 2019-02-28 16:40:54 -08:00
David Tolnay
97920be33a
Merge pull request #1486 from vorot93/reverse
impl Serialize and Deserialize for core::cmp::Reverse
2019-02-28 16:39:54 -08:00