David Tolnay
dd1f4b483e
Make it clearer that the private implementation details are private
...
Both of these modules are doc(hidden) and commented "Not public API",
but incorrect downstream code sometimes still references them. Naming
the module __private will make it more likely to be noticed in code
review.
2021-01-08 19:55:31 -08:00
David Tolnay
91bfa8f947
Refresh expandtest files with most recent rustfmt
2021-01-08 19:54:21 -08:00
David Tolnay
8847800ce2
Ignore from_over_into clippy lint in test suite
2021-01-03 19:05:43 -08:00
David Tolnay
e3d871ff7b
Opt in to experimental trybuild diffs
2020-10-31 13:28:19 -07:00
Taiki Endo
a227a87865
Collect lifetimes inside macro invocations
2020-10-24 05:29:47 +09:00
Mingun
7a7a182ab6
Allow borrow for field identifiers
2020-10-23 19:03:18 +05:00
Mingun
104ad9a7dd
Allow to define custom expectation message for type with #[serde(expecting = "...")]
...
Closes #1883
2020-10-23 01:23:01 +05:00
Mingun
e80571751d
Allow borrowed and owned strings and bytes and u8, u16, u64 for variant keys in serde_test
2020-10-22 20:43:14 +05:00
Mingun
0737474640
Allow field identifiers be any numbers if #[serde(other)]
is used
...
Thus behavior synchronized between string/bytes identifiers and numeric identifiers
2020-10-22 16:35:28 +05:00
Mingun
f6eb34a830
Assert that numeric field identifiers correctly deserialized (now failing)
2020-10-22 16:35:28 +05:00
David Tolnay
8084258a3e
Update ui tests to nightly-2020-10-20
2020-10-20 19:17:50 -07:00
David Tolnay
26186bddd1
Add test for flattened unit
2020-08-10 15:06:34 -07:00
David Tolnay
29c5a50935
Suppress unused_attributes warning in test suite
...
This test has multiple #[ignore] attributes in some configurations.
$ cargo +beta check --test expandtest
warning: unused attribute
--> test_suite/tests/expandtest.rs:2:29
|
2 | #[cfg_attr(not(expandtest), ignore)]
| ^^^^^^
|
= note: `#[warn(unused_attributes)]` on by default
2020-06-26 21:37:30 -07:00
David Tolnay
c619b2a7c4
Suppress unknown_lints warning in test suite
...
When building with beta and older rustc:
error: unknown lint: `mixed_script_confusables`
--> test_suite/tests/test_gen.rs:7:10
|
7 | #![allow(mixed_script_confusables, clippy::trivially_copy_pass_by_ref)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:5:9
|
5 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(unknown_lints)]` implied by `#[deny(warnings)]`
2020-06-26 21:37:26 -07:00
David Tolnay
764ebd9b17
Suppress mixed_script_confusables in test suite
...
error: The usage of Script Group `Greek` in this crate consists solely of mixed script confusables
--> test_suite/tests/test_gen.rs:269:9
|
269 | σ: f64,
| ^
|
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:5:9
|
5 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(mixed_script_confusables)]` implied by `#[deny(warnings)]`
= note: The usage includes 'σ' (U+03C3).
= note: Please recheck to make sure their usages are indeed what you want.
2020-06-26 19:06:13 -07:00
Tanner Rogalsky
7e5701ad2b
add alignment specific packed repr tests
2020-06-21 16:46:27 -07:00
Tanner Rogalsky
d5e6436b28
Add tests validating Serialize derivation for packed structs.
2020-06-21 16:46:27 -07:00
Taiki Endo
a50e1c20e9
Use underscore consts on Rust 1.37+
2020-06-19 15:55:43 +09:00
David Tolnay
f7d06cae4c
Add failing test involving macro_rules metavariable
2020-05-29 17:58:10 -07:00
David Tolnay
c2114491ca
Add test of Serialize impl for packed struct
2020-05-09 22:52:49 -07:00
asdsad
172edc4cf4
Allow optional content field for adjacently tagged newtype variants
...
* Deserialize adjacently tagged newtype variants with optional content as None instead of erroring when content field is missing
* refactor to remove duplicate code and remove panic
2020-05-09 20:58:28 -07:00
David Tolnay
f44402e224
Add regression test for issue 1804
2020-05-08 15:38:44 -07:00
David Tolnay
115c1b4830
Exclude expansion tests from test suite by default
...
This test isn't high enough signal to have all contributors run it.
2020-05-05 21:52:37 -07:00
David Tolnay
23db3a41e7
Run expansion tests only if rustfmt is present
2020-05-05 21:50:14 -07:00
David Tolnay
19a11237b8
Regenerate macrotest *.expanded.rs files
...
This picks up changes from a135199ab1
and 1b35c9e27e
.
2020-05-05 17:23:30 -07:00
David Tolnay
732544aed6
Update to macrotest 1.0
2020-05-05 17:23:30 -07:00
David Tolnay
65dfa607c8
Update to rustversion 1.0
2020-05-05 17:23:30 -07:00
David Tolnay
03addbae55
Format with rustfmt 2020-03-11
2020-04-19 17:32:11 -07:00
David Tolnay
a61cd0f236
Update ui tests to nightly-2020-02-08
2020-02-08 00:10:00 -08:00
David Tolnay
895eb2ba6c
Update ui tests to nightly-2019-12-19
2019-12-18 23:46:29 -08:00
David Tolnay
cd365de70c
Update ui tests to nightly-2019-12-18
2019-12-17 23:47:40 -08:00
David Tolnay
b9909cef3d
Revert "Remove never_type feature gate"
...
This reverts commit 533fb9cc44
.
2019-12-15 19:52:59 -08:00
David Tolnay
d540e72fc7
Format with rustfmt 2019-10-07
2019-11-26 00:02:11 -08:00
David Tolnay
13d0899776
Add missing import in de_enum expand test
2019-11-26 00:00:05 -08:00
David Tolnay
4fefa7a01d
Format imports in expandtest inputs
2019-11-25 23:57:34 -08:00
David Tolnay
90486607a1
Update test suite to nightly-2019-11-26
2019-11-25 23:51:43 -08:00
David Tolnay
0b303c766c
Mark tests ignored on emscripten rather than omitting
...
This way they still appear in `cargo test`'s output.
2019-11-24 17:27:30 -08:00
David Tolnay
c371563bfc
Reduce nesting of macrotest test cases
2019-11-24 17:25:44 -08:00
David Tolnay
d17d8eb3ee
Rely on std::process::Command's path search
2019-11-24 17:23:02 -08:00
David Tolnay
bcaebdb2b7
Merge pull request #1662 from eupn/use-macrotest
...
Implement expansion tests
2019-11-24 17:14:35 -08:00
David Tolnay
ff70409215
Merge pull request #1669 from H2CO3/master
...
Allow untagged unit variants to deserialize from `Visitor::visit_none()`
2019-11-24 16:13:37 -08:00
David Tolnay
97a98a7031
Test only deser for untagged unit visit_none
2019-11-24 15:59:08 -08:00
David Tolnay
533fb9cc44
Remove never_type feature gate
...
The stabilization for this feature has landed in nightly.
2019-11-23 19:30:39 -08:00
Árpád Goretity
59b99d2d60
Move test for untagged-variant-from-unit where it belongs
2019-11-07 21:18:12 +01:00
Árpád Goretity
c796daed7c
Fix test for untagged unit variant
2019-11-07 12:58:09 +01:00
Árpád Goretity
6e2c385fa5
Allow untagged unit variants to deserialize from Visitor::visit_none()
2019-11-06 17:31:27 +01:00
Evgenii P
9a0e4e0176
Ignore expansion test if cargo-expand subcommand isn't present
2019-11-03 20:31:08 +08:00
Evgenii P
640f8e0e82
Remove stdlib derives and fix expanded files to have newlines at the end
2019-11-03 20:08:39 +08:00
Evgenii P
4dda90502a
Add *.expanded.rs files
2019-11-01 02:32:34 +08:00
Evgenii P
dc6dbba47c
Implement derive macros expansion tests using macrotest
2019-11-01 02:32:06 +08:00
Jan Alexander Steffens (heftig)
b8772a1e40
Deserialize Box<Path> through PathBuf::into_boxed_path
...
Including Rc<Path> et al.
Fixes https://github.com/serde-rs/serde/issues/1633
2019-10-22 22:31:51 +02:00
Jan Alexander Steffens (heftig)
42990d8264
Deserialize PathBuf from bytes
...
&Path already allows this. Also complete the tests for Path/PathBuf.
2019-10-22 22:30:53 +02:00
David Tolnay
44fa7b0f6b
Remove unused rustc-serialize dependency from test suite
2019-10-04 21:29:06 -04:00
David Tolnay
bda561df4e
Update test suite to nightly-2019-10-04
2019-10-03 21:45:09 -04:00
David Tolnay
8955420baf
Update test suite to nightly-2019-10-02
2019-10-02 09:45:00 -04:00
David Tolnay
21ee256911
Update test suite to nightly-2019-09-30
2019-09-30 15:56:04 -04:00
David Tolnay
e46463e69f
Add tests for attribute parse errors
2019-09-07 22:57:27 -07:00
David Tolnay
187a0a3ec0
Format with rustfmt 2019-08-19
2019-09-07 22:16:49 -07:00
Jake Kiesel
acc8640c1e
Fix (de)serialization of new types where the internal type is skipped
2019-09-07 03:20:43 -06:00
David Tolnay
273ecdb786
Update ui tests on nightly-2019-08-16
2019-08-16 11:30:49 -07:00
David Tolnay
d0fb958e99
Remove unneeded explicit type parameters in test_from_into_traits
2019-07-17 12:32:34 -07:00
David Tolnay
b941c63a53
More typical TryFrom usage for test
2019-07-17 12:31:41 -07:00
David Tolnay
cf70c3fb05
Format with rustfmt 2019-06-09
2019-07-17 12:27:26 -07:00
David Tolnay
92e0b62c6b
Merge pull request 1526 from fanzeyi/try_from
2019-07-17 12:16:31 -07:00
David Tolnay
7b0e06c825
Provide 32 bit atomic impls for emscripten
2019-07-17 11:44:24 -07:00
David Tolnay
f3e2bb5104
Disable 64 bit atomic tests on emscripten
2019-07-16 10:00:44 -07:00
David Tolnay
e89feb9635
Test atomics without needing a macro
...
As a secondary benefit, this avoids a congnitive_complexity lint from
Clippy.
2019-07-16 09:17:36 -07:00
David Tolnay
5f72766c27
Ignore unreadable_literal lint in test code
2019-07-16 09:04:43 -07:00
David Tolnay
102a332616
Format with rustfmt 2019-06-09
2019-07-16 07:32:13 -07:00
James Brown
4e5f63ff45
gate atomic serde on rust 1.34 or higher
2019-07-12 13:44:42 -07:00
James Brown
de709e72a8
implement deserialization for atomic integer types
2019-07-11 18:18:54 -07:00
James Brown
56d3c8f071
implement serialization for atomic integer types
2019-07-11 17:34:53 -07:00
David Tolnay
bc7a85063d
Switch to rustversion
2019-07-07 21:14:11 -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
afb1754528
Allow integer key in untagged flattened map
2019-06-23 12:09:15 -07: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
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
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
140f9beee7
Switch ui tests to trybuild
2019-05-06 10:25:47 -07:00
David Tolnay
ce1686379d
Update test suite to nightly-2019-04-20
2019-04-19 22:54:59 -07:00
David Tolnay
82bde8d166
Format with rustfmt 2019-03-27
2019-04-03 09:40:12 -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
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
58bbaa9e80
Refer to Option through serde::export in generated code
2019-02-28 16:36:17 -08:00
David Tolnay
bf27b28554
Simplify running update-references.sh
2019-02-17 10:58:46 -08:00
David Tolnay
ef9028d798
Remove conflict between flatten and skip
2019-02-15 18:39:15 -08:00
David Tolnay
c473633676
Format with rustfmt 2018-12-10
2019-02-04 00:39:32 +01:00
David Tolnay
6a3a82007c
Merge pull request #1474 from jwillbold/master
...
Fixed #1468 , flattened struct fields made structs ignore their tag
2019-02-03 15:37:44 -08:00
Johannes Willbold
1d6ef76cfb
Fixed #1468 , flattened struct fields made structs ignore their tag
2019-02-03 02:09:37 +01:00
David Tolnay
fa854a2108
Format with rustfmt 2018-12-10
2019-02-01 21:04:08 -08:00
David Tolnay
8463bfc1e5
Remove as yet unrequested range impls
2019-02-01 21:04:06 -08:00
Dmitry Shlagoff
0def7da5a8
Impl Ser/De for RangeFrom, RangeTo, RangeToInclusive
2019-01-29 20:29:14 +07:00
Dmitry Shlagoff
4bb45c8252
Impl Serialize for Bound<T>
2019-01-29 15:20:27 +07:00
Lymia Aluysia
1ed228b92b
Implements alias annotation and allow multiple deserialization renames.
2019-01-15 11:15:01 -06:00
David Tolnay
b605cd1bb9
Make compiletest setup consistent with serde_json
2019-01-12 16:22:23 -08:00
David Tolnay
95d0f437e3
Update ui tests to nightly 2019-01-01
2018-12-31 22:09:07 -05:00
David Tolnay
c95ee3968a
Format with rustfmt 2018-12-10
2018-12-31 22:09:06 -05:00
David Tolnay
c22dd4ada5
Suppress trivially_copy_pass_by_ref lint on fn is_zero
2018-12-31 22:09:05 -05:00
David Tolnay
727a40fc5a
Update test suite to use tool attrs
2018-12-31 21:59:40 -05:00
David Tolnay
294dccc5be
Update test suite to 2018 edition
2018-12-31 21:53:37 -05:00
David Tolnay
da346a8878
Replace try!
macro in test suite
2018-12-31 21:46:14 -05:00
David Tolnay
c5ccb995ad
Update no_std test to 2018 edition
2018-12-31 21:42:22 -05:00
David Tolnay
05ab569a80
Update ui tests to 2018 edition
2018-12-31 21:38:13 -05:00
David Tolnay
ab3f4971f0
Move compiletest out of the unstable feature flag
2018-12-31 21:28:39 -05:00
David Tolnay
47e238aa13
Add missing imports in ui tests
...
There is a new fallback as of nightly-2018-12-29 that makes these emit a
new error unrelated to Serde.
2018-12-29 00:19:29 -05:00
David Tolnay
e49b6c708b
Add main function to ui tests without main
...
These emit a new error not relevant to Serde as of nightly-2018-12-29.
2018-12-29 00:18:55 -05:00
David Tolnay
eb7250792b
Format with rustfmt 2018-12-10
2018-12-28 12:19:32 -05:00
David Tolnay
7e5066b878
Merge pull request #1450 from motu42/master
...
Bug fix to support the tag attribute on braced structs with zero fields
2018-12-27 21:48:14 -05:00
Johannes Willbold
889e17816f
Bug fix for #1449
...
Modified serialize_struct_as_struct.
Added test test_internally_tagged_braced_struct_with_zero_fields
2018-12-28 02:50:24 +01:00
David Tolnay
32728d2f1d
Format with rustfmt 2018-12-10
2018-12-27 19:52:26 -05:00
David Tolnay
807a097387
Fix spelling in ui test name
2018-12-27 19:51:53 -05:00
Johannes Willbold
2359417804
Added ui tests, Limited serde(tag = "...") to structs with named field
...
Added ui test struct-representation/internally-tagged-unit
Added ui test struct-representation/internally-tagged-tuple
Limited the serde(tag = "...") to enums and structs with named field
2018-12-28 01:29:33 +01:00
Johannes Willbold
8aa5c2b45d
Removed deprected ui/enum-representation/internally-tagged-struct test
2018-12-27 20:53:08 +01:00
Johannes Willbold
414fd694c0
Allowed serde(tag="...") on structs
...
Added test test_internally_tagged_struct
Renamed EnumTag to TagType as it now also used for structs
Modified serialize_struct_as_struct
2018-12-27 20:18:36 +01:00
David Tolnay
16daba8ea9
Format with rustfmt 2018-11-30
2018-12-10 22:09:34 -08:00
David Tolnay
8b4074ee77
Tests for tuple default attribute
2018-12-10 22:09:33 -08:00
hcpl
14a3da9b16
Improve UI test coverage
...
With this commit I believe I've covered all `compile_error!`-based
errors.
2018-11-30 03:07:31 +02:00
hcpl
034db9f20f
Improve overall quality of compile_error!
errors
...
Also updates UI tests.
2018-11-30 02:51:49 +02:00
David Tolnay
58b3af4c29
Copyright/license headers
...
The following changes are included:
- Delete per-file license notices at the top of each file.
- Delete the first paragraph of LICENSE-MIT (an inaccurate
pseudo-copyright line), leaving only the text of the MIT license.
Nothing about the license of Serde code has changed, only our
understanding of how to correctly communicate that license has changed.
This mirrors an equivalent change being applied in the rust-lang/rust
repository.
2018-11-24 15:53:09 -08:00
David Tolnay
4821d09a48
Move all compile-fail tests to ui tests
...
The update-references.sh script makes these much easier to update in
bulk compared to compile-fail tests.
2018-11-24 15:43:19 -08:00
David Tolnay
b3d9d51b51
Simplify compiletest setup
2018-11-24 15:35:49 -08:00
David Tolnay
9afc5fef11
Format with rustfmt 1.0.0-nightly
2018-11-21 01:13:17 -08:00
David Tolnay
a51f831ae4
Drop nightly dependency of compiletest
2018-10-27 23:59:48 -07:00
David Tolnay
778e516270
Feature panic_handler has been stabilized
2018-10-06 21:12:14 -07:00
David Tolnay
f1e8dcf38e
Run test suite on asmjs
2018-09-15 15:25:55 -07:00
David Tolnay
23a53d8008
Remove unused proc-macro2 dependency in test suite
2018-09-15 15:12:47 -07:00
David Tolnay
66a9ccb10e
Ignore renamed_and_removed_lints lint
...
The recommended replacement involving clippy::all has not been
stabilized yet.
2018-09-11 23:05:33 -07:00
David Tolnay
53fe1b328e
Format with rustfmt 0.99.4
2018-09-11 23:00:08 -07:00
roblabla
0156f1355a
Remove obsolete compile-fail test
2018-09-10 17:15:22 +00:00
roblabla
7870b58356
Add tests for serde(other) in enum
2018-09-10 16:25:02 +00:00
David Tolnay
2a4b8ce42d
Fix panic deserializing flattened any after flattened struct
2018-09-08 16:55:34 -07:00
David Reid
389b9b5fe7
Add a test for an internally tagged unit enum flattened with a second internally tagged unit enum.
2018-09-06 14:55:10 -07:00
David Reid
27478b6f71
Internally tagged unit enum variants should ignore unknown fields.
2018-09-06 14:29:49 -07:00
David Tolnay
480f858fc3
Update panic_handler attribute name changed in nightly
2018-09-03 08:24:27 -07:00
David Tolnay
d0464fbff7
Add Emscripten build in Travis
2018-09-02 12:34:13 -07:00
David Tolnay
d23a40c1bb
Format with rustfmt 0.99.2
2018-09-01 23:03:41 -07:00
David Tolnay
5b7b8abf9f
Move some compile-fail errors based on proc-macro2 update
2018-08-28 20:35:49 -07:00
David Tolnay
1175d54fb7
Stabilize raw_identifiers
2018-08-24 19:49:13 -04:00
David Tolnay
a3ae14d090
Test raw identifiers
2018-08-22 21:09:37 -04:00
David Tolnay
5985b7edaf
Format with rustfmt 0.99.2
2018-08-14 19:59:20 -07:00
David Tolnay
d28a0e66c8
Fix old reference to serde_codegen
2018-08-12 10:54:59 -07:00
David Tolnay
0ca4db1616
Move untagged borrow test case into codegen tests
2018-08-12 10:54:29 -07:00
David Tolnay
72b3438dfc
Merge pull request #1338 from toidiu/ak-untagged-enum
...
test borrowing untagged enum
2018-08-12 10:49:15 -07:00
David Tolnay
e26960f7f8
Remove useless run-pass test
...
When originally added, this test used to contain a `#![plugin(clippy)]`.
This was removed at some point along the way, at which point this test
no longer tests anything. It prints:
warning: unknown lint: `identity_op`
--> src/main.rs:1:9
|
1 | #![deny(identity_op)]
| ^^^^^^^^^^^
|
= note: #[warn(unknown_lints)] on by default
which is swallowed and ignored by compiletest.
Nowadays Clippy handles warnings inside of macro expanded code
intelligently and this is something they would be responsible for
testing.
2018-08-06 22:57:46 -07:00
David Tolnay
28db9d4989
Format with rustfmt 0.99.1
2018-08-06 22:40:28 -07:00
Caio
8b2e6baf78
Implement Serialize and Deserialize for RangeInclusive
2018-08-05 10:45:50 -03:00
toidiu
3ca0597a7e
test borrowing untagged enum
2018-07-12 17:12:27 -04:00
David Tolnay
4e54aaf796
Format with rustfmt 0.8.2
2018-07-08 19:02:44 -07:00
David Tolnay
84e384196d
Implement Serialize for core::fmt::Arguments
2018-06-26 23:58:16 -07:00
David Tolnay
a1280c672a
Switch no-std panic to #[panic_implementation]
2018-06-04 10:13:29 -07:00
David Tolnay
a740f76772
Update no-std panic signature for nightly-2018-06-03
2018-06-03 23:15:16 -07:00
David Tolnay
94853752a1
Stabilize some unstable tests in test suite
2018-06-03 00:31:20 -07:00
David Tolnay
22b1af7eb3
Test never_type
2018-06-03 00:22:11 -07:00
David Tolnay
0a71fe329c
Format the compile-test sources with rustfmt 0.8.2
2018-06-02 22:30:55 -07:00
David Tolnay
a4acc83282
Place compile-fail expected errors on their own line
2018-06-02 22:28:05 -07:00
David Tolnay
7ad3d17e59
Merge pull request #1297 from adamcrume/master
...
Use compile_error! instead of panicking
2018-06-02 22:00:24 -07:00
Adam Crume
05e931b9a5
Update tests and use quote! macro
2018-06-02 21:11:42 -07:00
David Tolnay
d5ec3efe49
Merge pull request #1299 from dtolnay/flattenmap
...
Allow multiple flattened maps to see the same fields
2018-06-01 13:00:45 -07:00
David Tolnay
5ee2fc0562
Allow multiple flattened maps to see the same fields
...
Before this change, flattening anything after a flattened map was
nonsensical because the later flattened field would always observe no
input fields.
#[derive(Deserialize)]
struct S {
#[serde(flatten)]
map: Map<K, V>,
#[serde(flatten)]
other: Other, // always empty
}
This change makes a flattened map not consume any of the input fields,
leaving them available to later flattened fields in the same struct. The
new behavior is useful when two flattened fields that both use
deserialize_map care about disjoint subsets of the fields in the input.
#[derive(Deserialize)]
struct S {
// Looks at fields with a "player1_" prefix.
#[serde(flatten, with = "prefix_player1")]
player1: Player,
// Looks at fields with a "player2_" prefix.
#[serde(flatten, with = "prefix_player2")]
player2: Player,
}
2018-06-01 12:50:23 -07:00
Konrad Borowski
c3b9ee314b
Use try_borrow for serializing RefCell
2018-06-01 09:09:40 +02:00
David Tolnay
927ec7d38e
Implement Copy for value deserializers of primitive types
2018-05-26 15:56:57 -07:00
David Tolnay
ea118e11a0
Test the 128-bit IntoDeserializer impls
2018-05-26 15:21:37 -07:00
David Tolnay
b279ebb244
Merge pull request #1263 from serde-rs/integer128
...
Add Serde impls for i128 and u128
2018-05-25 16:03:08 -07:00
David Tolnay
b5f083e6f4
Update test suite to proc-macro2 0.4
2018-05-21 09:23:00 -07:00
David Tolnay
9083cf4b00
Test integer128 impls
2018-05-20 22:17:35 -07:00
David Tolnay
b13875dd97
Add compile-fail tests for transparent error messages
2018-05-20 21:55:50 -07:00
David Tolnay
1335f85213
Test transparent attribute
2018-05-20 21:55:21 -07:00
David Tolnay
4fa2a50f62
Format with rustfmt 0.7.0
2018-05-19 17:33:30 -07:00
David Tolnay
16d1265e17
Fix generated code for deserializing untagged newtype variant
2018-05-19 17:20:14 -07:00
David Tolnay
4305260174
Support flattened untagged Options in struct fields
2018-05-11 22:14:16 -07:00
David Tolnay
368961e961
Support deserializing flattened untagged enum
2018-05-10 08:33:47 -07:00
David Tolnay
b2b36e1764
Accept implicitly borrowed data inside of Option
2018-05-08 12:19:09 -07:00
David Tolnay
4ad140ea70
Improve error for struct deserialized from array that is too short
2018-05-08 12:03:35 -07:00
David Tolnay
67777eb585
Account for skip_serializing_if in tuple struct length
2018-05-08 11:49:37 -07:00
David Tolnay
b4e51fcc77
Respect skip_serializing in tuple structs and variants
2018-05-08 11:37:52 -07:00
David Tolnay
be7fe2a5eb
Introduce bound attribute on enum variants
2018-05-08 11:16:10 -07:00
David Tolnay
c4181f46be
Respect variant skip attribute in inferred bounds
2018-05-07 21:30:00 -07:00
David Tolnay
7e3efaf6c5
Improve error when a 'de lifetime parameter already exists
2018-05-07 21:15:44 -07:00
David Tolnay
12fe42ed45
Support empty adjacently tagged enum
2018-05-07 21:02:42 -07:00
David Tolnay
0025ef9aba
Detect deserialize on a struct ending in dynamically sized slice
2018-05-07 11:52:59 -07:00
David Tolnay
4687c1b52b
Test Weak deserialize impls
2018-05-07 11:23:18 -07:00
David Tolnay
a58abae193
Test Weak serialize impls
2018-05-07 11:23:17 -07:00
David Tolnay
eecc0870fc
Test for pub(restricted)
2018-05-06 23:22:27 -07:00
David Tolnay
3cd9d071c2
Fix adjacently tagged empty tuple variant or struct variant
2018-05-06 21:50:40 -07:00
David Tolnay
972cc06fed
Format the flatten tests using rustfmt 0.6.1
2018-05-06 21:38:41 -07:00
David Tolnay
2009b4da5f
Remove old flatten in enum compile-fail test
2018-05-06 21:26:40 -07:00
David Tolnay
0b72c86a35
Add tests for flatten in enums
2018-05-06 21:23:20 -07:00
David Tolnay
d8120e19bc
Support deserializing a flattened internally tagged enum
2018-05-05 21:52:16 -07:00
David Tolnay
97eff8e875
Format with rustfmt 0.6.1
2018-05-05 00:56:12 -07:00
David Tolnay
b78f434086
Pretend remote derives are not dead code
2018-05-02 14:23:59 -07:00
David Tolnay
cb2b92f828
Handle flatten + deserialize_with
2018-05-01 22:25:06 -07:00
David Tolnay
d82d1707d6
Format with rustfmt 0.6.0
2018-04-30 01:42:46 -07:00
David Tolnay
bceda5fb18
Unpack a layer of NewtypeStruct when content is newtype
2018-04-23 11:04:42 -07:00
David Tolnay
3c4961c48e
Lenient byte and string deserialization from buffered content
2018-04-19 10:21:55 -07:00
David Tolnay
202c10147e
Fix deserialize_with on a struct variant with one field
2018-04-12 23:44:53 -07:00
Osspial
4415d10c61
Fix associated types only working for first generic parameter
...
Also, removes extraneous `where for`
2018-04-12 16:44:34 -04:00
Osspial
def8d6e8af
Add associated type test
2018-04-10 11:16:32 -04:00
David Tolnay
5efb22ebee
Format no_std test code with rustfmt 0.4.1
2018-04-07 19:22:24 -07:00
David Tolnay
3e535325e1
Remove unused compiler_builtins_lib feature
2018-04-07 19:20:55 -07:00
David Tolnay
5653e5b15c
Remove eh_unwind_resume lang item
...
It appears this is no longer needed.
2018-04-07 19:20:07 -07:00
David Tolnay
8d85860064
Remove no longer needed compiler_builtins
...
The `compiler_builtins` crate is now automatically injected whenever the
`core` crate is injected.
2018-04-07 19:18:38 -07:00
David Tolnay
860241aa88
Merge pull request #1205 from mitsuhiko/bugfix/tuple-struct-flatten
...
Produce error message for use of flatten in tuple structs
2018-04-02 07:09:39 +02:00
Armin Ronacher
77376f39ea
Produce error message for use of flatten in tuple structs
2018-04-01 22:11:21 +02:00
Armin Ronacher
302fac91a3
Produce error message for use of flatten within struct variant
2018-04-01 22:01:24 +02:00
David Tolnay
801fd1dc19
Drop the patch dependencies
2018-03-31 23:09:01 +02:00
Alex Crichton
b1c1d964e1
Update to syn/quote/proc-macro2 new apis
2018-03-29 00:54:05 -07:00
David Tolnay
42430902e2
Special case remote = "Self"
2018-03-27 10:56:05 +02:00
David Tolnay
5c9c97c0ce
Remove test that fails to parse flatten attribute
2018-03-25 12:33:50 +02:00
Armin Ronacher
3d647f4063
Fixed a compilefail test for flatten on enums
2018-03-20 23:26:22 +01:00
Armin Ronacher
27f935f036
Correctly serialize newtype variants for flatten
2018-03-20 23:05:05 +01:00
Armin Ronacher
99614c7266
Added flatten on enum compile fail test
2018-03-20 22:15:47 +01:00
Armin Ronacher
bb2ecb3bc4
Added compilefail tests for flatten conflicts
2018-03-20 22:04:12 +01:00
Armin Ronacher
e4ef087735
Added support for borrowing when flattening
2018-03-20 15:19:36 +01:00
Armin Ronacher
8637dda60f
Refactored a test
2018-03-20 13:38:08 +01:00
Armin Ronacher
f02dbf381b
Added non string key support for flattening
2018-03-19 00:57:58 +01:00
Armin Ronacher
7cf184624a
Use more consistent error messages for bad flattening
2018-03-18 23:46:28 +01:00
Armin Ronacher
c5a3128492
Added a more complex flattening test
2018-03-18 23:01:13 +01:00
Armin Ronacher
58d52e784b
Remove #[serde(repr = "map")]
2018-03-18 18:30:46 +01:00
Armin Ronacher
61b167be9a
Attempted support for in_place deserialization for structs as map
2018-03-18 18:22:06 +01:00
Armin Ronacher
f1af2dc5ab
Added support for newtype variant serialization
2018-03-18 13:10:54 +01:00
Armin Ronacher
ebc61baab2
Added newtype struct support for flattening
2018-03-18 13:02:00 +01:00
Armin Ronacher
ffcde25b6e
Fixed some clippy warnings
2018-03-17 00:49:00 +01:00
Armin Ronacher
b8602a7e43
Added test for tag/content enum flattening
2018-03-16 23:05:48 +01:00
Armin Ronacher
a8c8c2028e
Added support for struct variant enum serialization
2018-03-16 23:05:48 +01:00
Armin Ronacher
b4ef7ac323
Updated tests for flatten
2018-03-16 23:05:48 +01:00
Armin Ronacher
583c0d8d14
Make proc-macro2/nightly happy
2018-03-16 23:05:22 +01:00
Armin Ronacher
77b07f3fbf
Added tests for unknown_fields_into
2018-03-16 23:05:22 +01:00
David Tolnay
72ecb9064c
Fix parsing of qself in paths in attributes
2018-03-15 10:02:40 -07:00
David Tolnay
30361ac6d0
Clean up workaround that required too many parentheses
...
The issue has been fixed in the compiler and these extra call site parentheses
are no longer required.
2018-03-09 00:22:27 -08:00
David Tolnay
f288a41768
Test the new errors on conflicting enum tags
2018-03-08 09:31:25 -08:00
David Tolnay
d6f07f2f47
Ignore redundant_field_names lint
2018-02-27 11:13:26 -08:00
David Tolnay
9db784bccd
Ignore decimal_literal_representation in test suite
2018-01-29 21:52:21 -08:00
David Tolnay
1bdf5ecec4
Ignore unused_parens warning on the proc macro workaround
2018-01-21 17:54:06 -08:00
David Tolnay
6b4625dcbb
Ignore warning in no_std test
2018-01-13 14:43:34 -08:00
David Tolnay
6e01f220b1
Ignore clippy flagging our workaround
2018-01-13 14:28:12 -08:00
David Tolnay
b313f947dc
Use call_site as the span of unnamed member access
2018-01-09 20:28:23 -08:00
Martin Lindhe
ae0373643c
fix some typos
2018-01-03 15:16:45 +01:00
David Tolnay
ed6a1de311
Auto format attributes on their own line
2017-12-23 20:24:57 -08:00
David Tolnay
ee75e6c0e9
Format with rustfmt-nightly 0.3.4
2017-12-23 20:17:52 -08:00
David Tolnay
56d5d7f761
Rename deserialize_from to deserialize_in_place
2017-12-17 10:46:44 -08:00
David Tolnay
0dac13e4db
Resolve conflict with pr 1115
2017-12-11 20:59:54 -08:00
David Tolnay
0c2e91f28a
Merge branch serde-rs/master into Gankro/deserialize_from
2017-12-11 20:49:23 -08:00
David Tolnay
a93f2ebff0
Enable deserialize_from in the test suite
2017-12-10 22:46:25 -08:00
Jeroen Bollen
c887a0b472
Solved #1105 .
...
When a field should be skipped during deserialization, it will not use its own Default implementation
when the container structure has `#[serde(default)]` set.
2017-12-06 21:14:02 +01:00
David Tolnay
e0eea551b4
Fix missing absolute paths in deserialize_seq
2017-11-29 19:45:22 -08:00
David Tolnay
c650a92bf7
Update to compiletest-rs 0.3 to fix "every suggestion should have at least one span"
2017-11-24 17:12:58 -08:00
David Tolnay
436cafb0a3
Catch wrong field names length in serde_test
2017-11-12 10:16:43 -08:00
David Tolnay
9e7a3437d9
Allow internally tagged newtype variant containing unit struct
2017-11-06 23:32:36 -08:00
David Tolnay
f6ac232580
Merge pull request #1084 from Marwes/serde_test_readable_
...
Add an API for making tests for readable/compact representations
2017-11-06 22:05:29 -08:00
Markus Westerlind
aad7a7987f
Add an example to the Configure trait
2017-11-06 10:35:22 +01:00
David Tolnay
6437167930
Merge pull request #1083 from serde-rs/ty-macro
...
Fix bounds for macro named the same as a type parameter
2017-11-05 12:56:57 -08:00
David Tolnay
b8a40551a2
Fix bounds for macro named the same as a type parameter
2017-11-05 12:18:39 -08:00
David Tolnay
40db31691a
Allow borrow attribute on newtype variants
2017-11-05 12:10:40 -08:00
David Tolnay
d5e5c520ac
Ignore skipped fields when looking for borrowed lifetimes
2017-11-03 10:08:02 -07:00
David Tolnay
2a557a1e36
Clippy false positive on needless_lifetimes has been fixed
2017-10-31 22:42:53 -07:00
David Tolnay
ab0848f780
Follow clippy advice about unreadable literal
2017-10-31 22:42:12 -07:00
David Tolnay
9b08915a18
Add tests for std::num::Wrapping impls
2017-10-31 09:32:58 -07:00
David Tolnay
aa03fd5d1a
Duplicate error messages have been fixed
2017-10-27 21:08:41 -04:00
David Tolnay
e198afb0c1
Add missing copyright notices
2017-10-22 16:01:19 -07:00
David Tolnay
99e8686189
Add error banner when running test suite without nightly compiler
2017-10-22 15:46:17 -07:00
David Tolnay
9be3d32016
Remove redundant readable/compact tests
...
This functionality is covered well enough by the std::net types.
2017-10-17 23:16:21 -07:00
David Tolnay
5daf1b89a1
Consolidate readable/compact deserialization tests
2017-10-17 23:15:35 -07:00
David Tolnay
f8f5d0ca2f
No need for readable setting for the ignore test
2017-10-17 23:09:50 -07:00
David Tolnay
4ed0362c8e
Panic by default in serde_test is_human_readable
...
The serde_test Serializer and Deserializer panic in is_human_readable unless the
readableness has been set explicitly through one of the hidden functions. This
is to force types that have distinct readable/compact representations to be
tested explicitly in one or the other, rather than with a plain assert_tokens
which arbitrarily picks one.
We need to follow up by designing a better API in serde_test to expose this
publicly. For now serde_test cannot be used to test types that rely on
is_human_readable. (The hidden functions are meant for our test suite only.)
2017-10-17 09:49:42 -07:00
David Tolnay
030459a040
Merge pull request #1044 from Marwes/human_readable
...
Serialize to binary if the serde format is not human readable
2017-10-15 16:39:58 -07:00
David Tolnay
b98a9a8f9b
Support deserializing internally tagged enum from seq
...
During serialization, internally tagged enums invoke the Serializer's
serialize_struct. In JSON this turns into a map which uses visit_map
when deserialized. But some formats employ visit_seq when
deserializing a struct. One example is rmp-serde. Such formats were
previously unable to deserialize an internally tagged enum. This
change fixes it by adding visit_seq for internally tagged enums.
2017-09-17 13:45:12 -07:00
Markus Westerlind
e36915300f
Properly deserialize non-readable IpAddr and SocketAddr
2017-09-14 17:08:17 +02:00
Markus Westerlind
85c05d301a
Fix the non-readble IpAddr serialize implementations
2017-09-11 17:40:02 +02:00
Markus Westerlind
ad3335e5d6
Serialize non-human-readble ip addresses as tuples
...
Since we know exactly how many bytes we should serialize as we can hint
to the serializer that it is not required which further reduces the
serialized size when compared to just serializing as bytes.
2017-09-11 15:54:53 +02:00
David Tolnay
8403fa018e
Merge pull request #1052 from serde-rs/static
...
Special case for 'static fields
2017-09-09 12:50:11 -07:00
David Tolnay
0085d05e55
Special case for 'static fields
2017-09-09 12:39:14 -07:00
David Tolnay
2eed855bff
Fix trivial numeric cast in visit_u64
2017-09-09 12:37:00 -07:00
David Tolnay
8a630fea7c
Suppress cast_lossless lint in test suite
2017-09-09 11:08:19 -07:00
David Tolnay
2e597ed3f0
Remove unused functions in with-variant tests
...
Macro expansion fails before it would generate code to call any of these.
2017-09-09 10:58:32 -07:00
David Tolnay
15b2714058
Merge pull request #1015 from spinda/with-variant
...
implement (de)serialize_with for variants
2017-09-09 10:49:24 -07:00
David Tolnay
9ce107de25
Merge pull request 963 from sfackler/u64-identifier
...
Conflicts:
serde_derive/src/de.rs
2017-09-08 21:35:41 -07:00
David Tolnay
e47284c0e0
Merge pull request #1043 from greyblake/screaming-kebab-case
...
SCREAMING-KEBAB-CASE support
2017-09-08 21:30:01 -07:00
Markus Westerlind
0dccbb1f11
Serialize to binary if the serde format is not human readable
...
This implements the KISS suggested in https://github.com/serde-rs/serde/issues/790 .
It is possible that one of the other approaches may be better but this
seemed like the simplest one to reignite som discussion.
Personally I find the original suggestion of adding two traits perhaps slightly
cleaner in theory but I think it ends up more complicated in the end
since the added traits also need to be duplicated to to the `Seed`
traits.
Closes #790
2017-09-07 16:20:57 +02:00
Steven Fackler
95407a4ca5
Support field ident deserialization from u32
2017-09-05 21:55:33 -07:00
Sergey Potapov
e67d941b78
Support for SCREAMING-KEBAB-CASE
2017-09-05 22:07:08 +02:00
David Tolnay
972da59ebc
Deserialize unsized Arc and Rc
2017-09-04 10:56:42 -07:00
David Tolnay
e4ea2a56e9
Serialize unsized Arc and Rc
2017-09-04 10:31:03 -07:00
Michael Smith
552971196d
Fix Clippy errors in variant serialize_with tests
2017-08-16 12:04:39 -07:00
David Tolnay
0681cd5003
Replace deprecated compiletest::default_config()
2017-08-15 22:10:18 -07:00
David Tolnay
d965367238
No longer need feature(into_boxed_c_str)
2017-08-15 22:08:23 -07:00
Michael Smith
9fc180e62f
Implement deserialize_with for variants
...
Complements variant serialize_with and closes #1013 .
2017-08-14 14:41:05 -07:00
Michael Smith
5b815b7001
Implement serialize_with for variants
...
As discussed in #1013 , serialize_with functions attached to variants receive an
argument for each inner value contained within the variant. Internally such a
function is wired up to the serializer as if the variant were a newtype variant.
2017-08-14 11:17:08 -07:00
David Tolnay
f36a1e0895
Inherit the visibility of remote struct definition
2017-07-25 23:52:06 -07:00
David Tolnay
4f2e8d5dbb
Workaround for "no bin target named serde_derive_tests_no_std"
2017-07-21 00:05:30 -07:00
Markus Westerlind
85bccf42b6
Fix SystemTime serialization test on Windows
...
Windows's `SystemTime` do not have nanosecond resolution which caused the test duration to be truncated b1363a73ed/src/libstd/sys/windows/time.rs (L177)
2017-07-16 12:16:07 +02:00
David Tolnay
fa9057fa31
Merge pull request #949 from WiSaGaN/feature/support-system-time
...
Support std::time::SystemTime
2017-07-11 21:17:56 -07:00
Wangshan Lu
0084d82a50
Add tests for SystemTime
2017-07-12 12:01:40 +08:00
David Tolnay
775e8154e7
Fix libc dependency in no_std test
2017-07-09 10:19:19 -07:00
David Tolnay
9c679d9082
Test for serializing BTreeSet
2017-07-09 10:16:49 -07:00
David Tolnay
b0f9d2a0ba
Exclude macros file from being tested by itself
2017-07-09 09:24:29 -07:00
David Tolnay
f39b1db96a
Additional errors for some reason
2017-07-09 09:22:20 -07:00