This makes it slightly more convenient to use the following as a
Reindeer fixup for those that prefer to build from source:
extra_mapped_srcs = { "src/lib_from_source.rs" = "src/lib.rs" }
[platform_fixups.'cfg(all(target_arch = "x86_64", target_os = "linux", target_env = "gnu"))']
extra_deps = [":proc-macro2", ":quote", ":syn"]
as opposed to checking in a whole new file containing the `extern crate
proc_macro` + `include!("lib_from_source.rs")`.
In old versions of rustc (1.15 through 1.29) it would cause a warning if
this #[macro_use] was not present.
warning: proc macro crates and `#[no_link]` crates have no effect without `#[macro_use]`
--> serde/src/lib.rs:340:1
|
340 | extern crate serde_derive;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
These days serde_derive requires a newer compiler than that, so the
bogus warning would never occur.
error: field `option` is never read
--> test_suite/tests/test_gen.rs:666:9
|
665 | struct ImplicitlyBorrowedOption<'a> {
| ------------------------ field in this struct
666 | option: std::option::Option<&'a str>,
| ^^^^^^
|
note: the lint level is defined here
--> test_suite/tests/test_gen.rs:5:9
|
5 | #![deny(warnings)]
| ^^^^^^^^
= note: `#[deny(dead_code)]` implied by `#[deny(warnings)]`
error: fields `ty` and `id` are never read
--> test_suite/tests/test_gen.rs:696:9
|
695 | struct RelObject<'a> {
| --------- fields in this struct
696 | ty: &'a str,
| ^^
697 | id: String,
| ^^
error: field `field` is never read
--> test_suite/tests/test_gen.rs:740:17
|
739 | struct MacroRules<'a> {
| ---------- field in this struct
740 | field: $field,
| ^^^^^
...
745 | deriving!(&'a str);
| ------------------ in this macro invocation
|
= note: this error originates in the macro `deriving` (in Nightly builds, run with -Z macro-backtrace for more info)
error: field `f` is never read
--> test_suite/tests/test_gen.rs:756:9
|
754 | struct BorrowLifetimeInsideMacro<'a> {
| ------------------------- field in this struct
755 | #[serde(borrow = "'a")]
756 | f: mac!(Cow<'a, str>),
| ^
warning: fields `question` and `answer` are never read
--> test_suite/tests/test_annotations.rs:2969:9
|
2968 | struct Struct {
| ------ fields in this struct
2969 | question: String,
| ^^^^^^^^
2970 | answer: u32,
| ^^^^^^
|
= note: `#[warn(dead_code)]` on by default
Those deserializers are used to deserialize tuple or struct variants from Content
which is used by internally tagged enums and by flatten
FlatMapDeserializer is reached in the following tests:
flatten::enum_::externally_tagged::newtype
flatten::enum_::externally_tagged::struct_from_map
flatten::enum_::externally_tagged::struct_from_seq
flatten::enum_::externally_tagged::tuple
ContentDeserializer is reached in the following tests:
test_enum_in_internally_tagged_enum
test_internally_tagged_struct_variant_containing_unit_variant
The Container struct
struct Container {
#[serde(flatten)]
enum_field: Enum,
}
enum Enum {
Tuple(u32, u32),
}
now can be serialized to JSON as
{ "enum_field": [1, 2] }
Deserialization already works
Fixes (1):
flatten::enum_::externally_tagged::tuple