Revert stabilization of never type by nikomatsakis · Pull Request #67224 · rust-lang/rust (original) (raw)
This PR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
serde | |||
(source) | dependencies | patch | |
1.0 -> 1.0.200 |
|||
serde_json | dependencies | ||
patch | 1.0 -> 1.0.116 |
Release Notes
serde-rs/serde (serde)
- Fix formatting of "invalid type" and "invalid value" deserialization error messages containing NaN or infinite floats (#2733, thanks
- Fix ambiguous associated item when
forward_to_deserialize_any!
is used on an enum withError
variant (#2732, thanks
- Support serializing and deserializing
Saturating<T>
(#2709, thanks
- Fix unused_imports warnings when compiled by rustc 1.78
- Optimize code size of some Display impls (#2697, thanks
- Improve formatting of "invalid type" error messages involving floats (#2682)
- Prevent remote definitions of tuple struct or tuple variant from triggering dead_code warning (#2671)
- Update proc-macro2 to fix caching issue when using a rustc-wrapper such as sccache
- Fix field names used for the deserialization of
RangeFrom
andRangeTo
(#2653,
#2654, #2655, thanks @emilbonnek)
- Allow internal tag field in untagged variant (#2646, thanks
- Documentation improvements
- Preserve NaN sign when deserializing f32 from f64 or vice versa (#2637)
- Fix "cannot infer type" error when internally tagged enum contains untagged variant (#2613, thanks
- Fix "failed to parse manifest" error when building serde using a Cargo version between 1.45 and 1.50 (#2603)
- Remove support for Emscripten targets on rustc older than 1.40 (#2600)
- Disallow incompatible versions of
serde_derive
andserde
in the dependency graph (#2588, thanks
- Fix error "cannot move out of
*self
which is behind a shared reference" deriving Serialize on a non_exhaustive enum (#2591)
- Restore from-source
serde_derive
build on all platforms — eventually we'd like to use a first-class precompiled macro if such a thing becomes supported by cargo / crates.io
- Support deserializing
Box<OsStr>
with an equivalent representation asOsString
(#2556, thanks
- Render field aliases in sorted order in error messages (#2458, thanks
- Support
serde(default)
on tuple structs (#2553, thanks
- Make
serde(alias)
work in combination withflatten
when using in-place deserialization (#2443, thanks
- Improve the representation of adjacently tagged enums in formats where enum tags are serialized by index, as opposed to by string name (#2505,
#2496, thanks @Baptistemontan)
- Update to 2018 edition
- Support serialization of tuple variants inside a flattened field (#2448, thanks
- Fix build error when using serde with "std" feature turned off and "unstable" feature turned on (#2541)
- Add
serde(rename_all_fields = "...")
attribute to apply arename_all
on every struct variant of an enum (#1695, thanks
- Improve diagnostics for attribute parse errors (#2536, thanks
- Allow tag field of an internally tagged enum to have same name as a field inside a skipped struct variant (#2266, thanks
- Restore missing LICENSE files in serde_derive crate (#2527, thanks
- Documentation improvements
- Fix missing trait implementations when using serde derive macro on a
macro-generated data structure, such as via the
bitflags
crate (#2516)
- Experiment with precompiling the serde_derive macros to reduce build time (#2514)
- Support
derive(Deserialize)
on unit structs that have const generics (#2500, thanks
- Produce error message on suffixed string literals inside serde attributes (#2242)
- Support single identifier as unbraced default value for const generic parameter (#2449)
- Add Deserializer::deserialize_identifier support for adjacently tagged enums (#2475, thanks @Baptistemontan)
- Fix unused_braces lint in generated Deserialize impl that uses braced const generic expressions (#2414)
- Allow
serde::de::IgnoredAny
to be the type for aserde(flatten)
field (#2436, thanks @Mingun) - Allow larger preallocated capacity for smaller elements (#2494)
- Add serialize and deserialize impls for
RangeFrom
andRangeTo
(#2471, thanks
- Add
no-alloc
category to crates.io metadata
- Fix incorrect count of fields passed to tuple deserialization methods
when using
serde(skip_deserializing)
attributes (#2466, thanks
- Fix
-Zminimal-versions
build
- Allowed enum variants to be individually marked as untagged (#2403, thanks
- Eliminate build script from serde_derive crate to slightly reduce build time (#2442, thanks
- Support deserializing flattened adjacently tagged enums from data
formats which represent fields as bytes, such as the
csv
crate (#2377, thanks
```rust
#[derive(Deserialize)]
pub struct Record {
common: u64,
#[serde(flatten)]
kind: Kind,
}
#[derive(Deserialize)]
#[serde(tag = "kind", content = "parameter", rename_all = "lowercase")] enum Kind { Foo(u64), Bar(bool), } ```
```csv
common,kind,parameter
1,foo,42
2,bar,true
```
- Improve error messages produced by serde_test on test failure (#2435, thanks
- Make derived serializer/deserializer internals
doc(hidden)
(#2426, thanks
- Accept empty #[serde()] attribute (#2422)
- Fix "expected serde crate attribute to be a string" error when using
macro_rules metavariable inside of serde attribute:
#[serde(crate = $serde_path)]
(#2409)
- Update syn dependency to 2.x
- Documentation improvements
- Support
Serialize
andDeserialize
impls forcore::ffi::CStr
andalloc::ffi::CString
without "std" feature (#2374, thanks
- Fix "undeclared lifetime" error in generated code when deriving
Deserialize for an enum with both
flatten
and'static
fields (#2383, thanks
- Support
serde(alias = "…")
attribute used inside of flattened struct (#2387, thanks
- Documentation improvements
- Update
serde::
{ser
,de
}::StdError
to re-exportcore::error::Error
when serde is built withfeature="std"
off andfeature="unstable"
on (#2344)
- Relax some trait bounds from the
Serialize
impl ofHashMap
andBTreeMap
(#2334) - Enable
Serialize
andDeserialize
impls ofstd::sync::atomic
types on more platforms (#2337, thanks
- Relax some trait bounds from the
Serialize
impl ofBinaryHeap
,BTreeSet
, andHashSet
(#2333, thanks
- Support
remote
derive for generic types that have private fields (#2327)
- Add
serde::de::value::EnumAccessDeserializer
which transforms anEnumAccess
into aDeserializer
(#2305)
- Allow internally tagged newtype variant to contain unit (#2303, thanks
- Allow RefCell<T>, Mutex<T>, and RwLock<T> to be serialized
regardless of whether T is
Sized
(#2282, thanks
- Change atomic ordering used by Serialize impl of atomic types to match ordering used by Debug impl of those same types (#2263, thanks
- Invert build.rs cfgs in serde_test to produce the most modern configuration in the default case (#2253, thanks
- Add keywords to crates.io metadata
- Add
no-std
category to crates.io metadata
- Invert serde_derive cfgs to convenience non-Cargo builds on a modern toolchain (#2251, thanks
- Add
new
constructor function for allIntoDeserializer
impls (#2246)
- Documentation improvements
- Update documentation links to some data formats whose repos have moved (#2201, thanks
- Fix declared
rust-version
of serde and serde_test (#2168)
- Improve default error message when
Visitor
fails to deserialize a u128 or i128 (#2167)
- Update discord channels listed in readme
- Improve error messages on deserializing NonZero integers from a 0 value (#2158)
- Optimize deserialization of data structures that contain recursive use
of
flatten
fields ortag
oruntagged
enums (#2148)
- Enable Serialize and Deserialize impls for
std::sync::atomic::{AtomicI64, AtomicU64}
on riscv64 arch (#2141, thanks
- Avoid
unused_results
being triggered in generated code for adjacently tagged enum (#2116, thanks
- Provide
MapAccess
andSeqAccess
impl for reference to a dynamically sized existing impl (#2081)
- Support deserialization of remote structs that used packed repr (#2078,
- Enable 128-bit integers on emscripten in Rust 1.40+ (#2076, thanks
- Resolve warning in rustc nightly-2021-07-31+ compiling serde_test
- Resolve conflict with
forbid(future_incompatible)
lint setting in generated code (#2026, thanks
- Improve performance of serializing
Ipv4Addr
(#2001, thanks
- Fix possible panic deserializing invalid data as
SystemTime
(#1997, thanks
- Support
Self
keywords in fields of types that derive Deserialize (#1830, thanks
- Allow floats to be deserialized from ints in tagged unions (#1842, thanks
- Support
Self
inside fields that use serialize_with (#1970)
- Add IntoDeserializer impl for &[u8] (#1898, thanks
- Handle unrecognized numeric field keys during deserialization of a field_identifier, equivalently to string field keys (#1914, thanks
- Add attribute to override default deserialization failure expectation message (#1916, thanks
```rust
#[derive(Deserialize)]
#[serde(untagged, expecting = "single version or array of versions")] struct VersionSpec { One(Version), Many(Vec), } ```
- Improve
serde_test
handling of map entries and error message construction (#1918, thanks
- Produce more accurate location information on test failures from
serde_test
crate (#1920, thanks
- Improve diagnostic on failure to parse a
rename_all
attribute (#1960,
- Eliminate unnecessary trait bounds on some value Deserializer impls (#1963)
- Support borrowed data during deserialization of a field identifier (#1917, thanks
- Fix panic when deserializing
Duration
with nanoseconds that cause the seconds counter to overflow (#1958, thanks
- Fix deserialization of ignored fields containing 128-bit integer (#1955, thanks
- Support serialization of core::num::Wrapping in no_std mode (#1926, thanks
- Allow serialization of std:🥅:SocketAddrV6 to include a scope id if present (based on https://github.com/rust-lang/rust/pull/77426)
- Fix deserialization of IpAddr, SocketAddr, Bound, Result, OsString in formats which process variant identifiers as u64 (#1888, thanks
- Support
#[serde(flatten)]
on a field whose type is a type parameter and concrete type is()
(#1873)
- Improve
packed
repr matching to support deriving Serialize for structs havingrepr(C, packed)
(#1813, thanks
- Improve diagnostic when a serde trait is not implemented (#1827, thanks
- Support
serde(flatten)
on map types where the Serializer only works with serialize_entry (#1837)
- Process borrowed lifetimes inside of interpolated macro_rules
metavariables, such as in the case of
#[derive(Deserialize)] struct S<'a> { field: $field }
(#1821)
- Support deriving Serialize impl for a
repr(packed)
struct (#1791, thanks
- Allow adjacently tagged newtype variants containing
Option
to omit the content field when deserializing (#1553,
- Avoid panicking when a SystemTime older than UNIX_EPOCH is serialized (#1702, thanks
- Provide a
Serializer
impl that can write primitives and unit variants to a&mut fmt::Formatter
(#1705, thanks
```rust
use serde::Serialize;
use std::fmt::{self, Display};
#[derive(Serialize)]
#[serde(rename_all = "kebab-case")]
pub enum MessageType {
StartRequest,
EndRequest,
}
impl Display for MessageType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.serialize(f)
}
}
```
- Fix panic during macro expansion when using
serde(skip)
andserde(other)
in the same enum (#1804)
- Hide dummy const implementation detail from rustdoc when documenting a binary crate (#1768, thanks
- Allow #[serde(borrow)] to work on non-standard
Cow
types (#1754, thanks
- Revert stabilization of Serialize/Deserialize impls for
!
to account for https://github.com/rust-lang/rust/pull/67224
- Support deserializing untagged unit variants from formats that treat unit as None (#1668)
- Support deserializing
PathBuf
from bytes like&Path
already did, and support deserializingBox<Path>
(#1656, thanks
Report errors on malformed serde attributes, like
#[serde(rename =)]
-- the compiler used to reject these itself, but when the compiler relaxed its requirements on attribute syntax these malformed attributes began silently being ignored by serde_deriveEliminate unused variable warning when using skip_serializing inside a tuple variant of an adjacently tagged enum (#1617, thanks
- Support skip attribute inside of newtype variants (#1622, thanks
Provide
serde::ser::StdError
andserde::de::StdError
which are either a re-export ofstd::error::Error
(if Serde's "std" feature is enabled) or a new identical trait (otherwise).#[cfg(feature = "std")] pub use std::error::Error as StdError; #[cfg(not(feature = "std"))] pub trait StdError: Debug + Display { fn source(&self) -> Option<&(StdError + 'static)> { None } }
Serde's error traits serde::ser::Error
and serde::de::Error
require
std::error::Error
as a supertrait, but only when Serde is built with
"std" enabled. Data formats that don't care about no_std support should
generally provide their error types with a std::error::Error
impl
directly:
```rust
#[derive(Debug)]
struct MySerError {...}
impl serde::ser::Error for MySerError {...}
impl std::fmt::Display for MySerError {...}
// We don't support no_std!
impl std::error::Error for MySerError {}
```
Data formats that do support no_std may either have a "std" feature of their own as has been required in the past:
```toml
[features]
std = ["serde/std"]
```
```rust
#[cfg(feature = "std")]
impl std::error::Error for MySerError {}
```
... or else now may provide the std Error impl unconditionally via Serde's re-export:
```rust
impl serde::ser::StdError for MySerError {}
```
- Update Syn dependency to 1.0.
Note: This raises the minimum required compiler version for serde_derive from rustc 1.15 to rustc 1.31. The minimum required compiler version for serde remains at rustc 1.13.
- Add support for NonZeroI* types (#1589, thanks
- Introduce
serde(try_from = "...")
attribute to derive Deserialize based on a given implementation ofstd::convert::TryFrom
(#1526, thanks
```rust
#[derive(Deserialize)]
#[serde(try_from = "u32")]
enum N {
Zero,
One,
Two,
}
impl TryFrom<u32> for N {
type Error = String;
fn try_from(u: u32) -> Result<Self, Self::Error> {
match u {
0 => Ok(Self::Zero),
1 => Ok(Self::One),
2 => Ok(Self::Two),
other => Err(format!("out of range: {}", other)),
}
}
}
```
- Implement serialization and deserialization for std::sync::atomic types (#1572 and #1581, thanks @Roguelazer)
- Make "alloc" feature work on stable Rust 1.36+ (#1576, thanks
yanked
- Accept enums in input data when deserializing IgnoredAny (#1558)
- Allow integer keys in untagged flattened map (#1545)
- Support using
serde(flatten)
in no_std + alloc mode (#1543, thanks
- Support deserializing from MapAccessDeserializer into an enum (#1522)
- Add an attribute
#[serde(crate = "path::to::serde")]
which replaces the use ofextern crate serde
in the generated code; this is intended for crates that invoke Serde derives from a macro and need to refer toserde
through their own re-export rather than requiring callers to list Serde in Cargo.toml (#1499, thanks
```rust
#[derive(Deserialize)]
#[serde(crate = "__tw::codegen::serde")]
struct S { ... }
```
```rust
// expands to:
impl<'de> __tw::codegen::serde::Deserialize<'de> for S {
...
}
```
- Implement Serialize and Deserialize for core::cmp::Reverse<T> (#1486, thanks
- Fix a Clippy lint triggered within generated code involving flatten + deny_unknown_fields (#1492, thanks
- Support
flatten
andskip_serializing
/skip_deserializing
attributes on the same field
- Fix inclusion of tag in struct containing flattened fields (#1468, thanks
- Implement Serialize and Deserialize for core::ops::Bound<T> (#1466, thanks
- Accept
#[serde(alias = "...")]
attribute on fields and variants which allows the same field or variant to be deserialized from any of multiple different names in the input (#1458, thanks
```rust
#[derive(Deserialize)]
struct S {
#[serde(alias = "old_name")]
new_name: String, // will deserialize from either of "old_name" or "new_name" } ```
- Update example code in documentation to 2018 edition
- Support a
rename_all
specification that applies only to the Serialize impl or only to the Deserialize impl (#1447, thanks
```rust
#[derive(Serialize, Deserialize)]
#[serde(rename_all(
serialize = "camelCase",
deserialize = "SCREAMING_SNAKE_CASE",
))]
struct S { /* ... */ }
```
- Allow serializing struct name inside of structs with named fields (#1448, thanks
```rust
#[derive(Serialize)]
#[serde(tag = "type")]
struct S { /* ... */ } // serializes as {"type":"S",...}
```
- Support
serde(default)
attribute inside of tuple structs and tuple variants (#1442, thanks
- Better error messages when using an invalid combination of serde attributes (#1424, thanks
- Support deserializing tagged enums inside of untagged enums in formats that encode tagged enum variants by index, like MessagePack (#1437, thanks
- Performance optimization for
Vec::deserialize_in_place
to deserialize elements in place (#1411)
Add
serde(other)
variant attribute for deserializing any variant that is not one of the others (#1382)#[derive(Deserialize)] #[serde(tag = "variant")] enum MyEnum { A(ModelA), B(ModelB), #[serde(other)] Unknown, }
In this internally tagged enum the MyEnum::Unknown
variant would be
produced if the "variant"
tag in the input is neither "A"
nor "B"
.
This feature is currently limited to externally tagged and adjacently
tagged enums in which the other
variant is a unit variant.
- Fix panic deserializing flattened Value after flattened struct (#1379)
- Fix internally tagged enum deserialization with unknown fields (#1376, thanks
- Provide impls for
NonZeroU128
(#1371, thanks
- Adjust dependency version requirement to support building with
-Z minimal-versions
in CI (#1367)
- Disable i128 integers on Emscripten targets (#1365, thanks
- Fix the names of serialized fields when the Rust data structure uses a raw identifier (#1362)
- Fix compilation of
default-features = false, features = ["alloc", "rc"]
feature combination (#1359, thanks
- Provide impls for
core::ops::RangeInclusive
(#1347, thanks
- Provide impls for
core::ops::Range
whether or not"std"
feature is enabled (#1348)
- Update
--features alloc
to work with nightly-2018-07-07 (#1335)
- Support Rust 2018
use_extern_macros
(https://github.com/rust-lang/rust/pull/51496)
- Suppress 'extern crate' warning for rust 2018 (#1324, thanks
- Implement Serialize for core::fmt::Arguments (#1319)
- Implement Serialize and Deserialize for
!
(#544,
unstable)
- Support Duration in no-std mode on sufficiently new compilers (#1123)
- Improve compiler error messages (#1297, thanks
- Do not panic when serializing a RefCell that is currently mutably borrowed (#1300, thanks
- Allow flattened fields after a flattened map to receive input fields (#1299)
- Second attempt to work around docs.rs old compiler version (#1295)
- Workaround to get docs.rs successfully building our docs with its old compiler (#1294)
- Implement
IntoDeserializer
for i128 and u128 (#1280) - Implement Copy for the primitive value deserializers (#1287)
- Implement Clone for primitive value deserializers even when the error type cannot be cloned (#1287)
- Stabilize Deserialize impls for dynamically sized Rc / Arc (#1266)
- Stabilize Deserialize impl for Box<CStr> (#1267)
- Add Serde impls for i128 and u128 when compiling with Rust 1.26+ (#1263)
- Stabilize Serde impls for std::num::NonZero* on Rust 1.28+ (#1278, thanks
- Add a
serde(transparent)
container attribute to indicate that a struct serializes and deserializes the same as its only field -- analogous torepr(transparent)
(#1054)
- Fix generated code for deserializing untagged newtype variant (#1268)
- Remove unstable Serialize and Deserialize impls for
NonZero<T>
which has been removed from the most recent nightly compiler (#1265)
- Add a Serde build.rs script for rustc version detection in preparation for adding i128 / u128 primitive support on sufficiently new compilers. Please let us know in #1136 if having a build script causes undue complication in your environment. We will begin using the build script to enable observable functionality after a week o
Configuration
📅 Schedule: Branch creation - "after 9pm,before 6am" in timezone Europe/Zurich, Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
- If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>