Bug 1716518 - Upgrade serde_repr to v0.1.7.

Differential Revision: https://phabricator.services.mozilla.com/D117856

Depends on D117855
This commit is contained in:
Mike Hommey 2021-06-15 09:25:10 +00:00
parent 9250541d22
commit 1f48529352
10 changed files with 35 additions and 11 deletions

4
Cargo.lock generated
View File

@ -4540,9 +4540,9 @@ dependencies = [
[[package]]
name = "serde_repr"
version = "0.1.5"
version = "0.1.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573"
checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5"
dependencies = [
"proc-macro2",
"quote",

View File

@ -1 +1 @@
{"files":{"Cargo.toml":"12f7a0095ab071bd65e931e934729b20c4cb59f71f8363ee6242220f08f7fa0f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"1c365193e71eca0287ed4514768ef0d9a41b26f36afd8576068c611814864d1e","src/lib.rs":"63e3e8c186e362636e0f2026169bfa1c5731cb7f48e98ef0084b50dae8834ec1","src/parse.rs":"687cf1436d12c0c26b1c6d06f80e56b4ec0d63a38d71e1f175b981c0fdc10c68","tests/compiletest.rs":"0a52a44786aea1c299c695bf948b2ed2081e4cc344e5c2cadceab4eb03d0010d","tests/test.rs":"69deba0db55c4014b27fe5686b79f67e4926ff31f1655fd8dce0c45a6b3b6b36","tests/ui/empty_enum.rs":"fe1166f2f92ee213d26a23e57572a99c65c163d446fd8d67e1520bab34f4b859","tests/ui/empty_enum.stderr":"c9c64b6126987a255bab90197ae1a39b6666cad437a5d83e21e6ea651be83130","tests/ui/missing_repr.rs":"b7ba9341111582cad52e761b82f14778c60352014c4265566e4d4d01ccdcb306","tests/ui/missing_repr.stderr":"71f1dc0094b13fbbf4eb8d3bdd4c3bb25bf150ea5aa9cd991827482071a381f8","tests/ui/multiple_others.rs":"569658516619719f21e5071873a37125d5390edb77558e4381401f03efda0c83","tests/ui/multiple_others.stderr":"b5eb2b8887e9a234365f8686dfdc0584f2a7a106c3f884ac6386de64559f1b48","tests/ui/non_unit_variant.rs":"0d8295ae08d882fc3ef4164857240038c5b0674ff0811da9b6ea7343e8bb955c","tests/ui/non_unit_variant.stderr":"ba863a840fae03b5b41e09e6dddf5773873b95d0b39775baacb04301b648a8b8","tests/ui/not_enum.rs":"ada7637821c924a6b99175363c820375991be60223f96ca553d304fde2721386","tests/ui/not_enum.stderr":"f55f707b8038a6f491c302b8b00ae6e96bf11fee24ab5b7c16cc97f5fa8ea241"},"package":"cd02c7587ec314570041b2754829f84d873ced14a96d1fd1823531e11db40573"}
{"files":{"Cargo.toml":"5f6731ef252f93527cbc11edebf1f2a87f858239fb2dbd1cfa3561336811c4ca","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"18848980d7a8fc120c0c03fbf02a79ea7cd9e6f446f4c76aad48782c76967634","src/lib.rs":"2d004a5df906b909beda035ee675637492b01dfa3997dfc0ed1d0ccbb64b2ff7","src/parse.rs":"687cf1436d12c0c26b1c6d06f80e56b4ec0d63a38d71e1f175b981c0fdc10c68","tests/compiletest.rs":"0a52a44786aea1c299c695bf948b2ed2081e4cc344e5c2cadceab4eb03d0010d","tests/test.rs":"79e01e1402be4640bb99aeba28d036fd7d3563bfc5645fcaf369386f86f8de37","tests/ui/empty_enum.rs":"fe1166f2f92ee213d26a23e57572a99c65c163d446fd8d67e1520bab34f4b859","tests/ui/empty_enum.stderr":"57b6c133657599fb24bbf03dd527830bade36ba9588f1f2343513987e11f0528","tests/ui/missing_repr.rs":"b7ba9341111582cad52e761b82f14778c60352014c4265566e4d4d01ccdcb306","tests/ui/missing_repr.stderr":"c36cd08ec99cad86bb0571b201c4c9c83e624049f5ebca3277be9dbdbe1cc39c","tests/ui/multiple_others.rs":"569658516619719f21e5071873a37125d5390edb77558e4381401f03efda0c83","tests/ui/multiple_others.stderr":"36732a497a9aaf7214eab412bae08d75afe2e3cee697fc5e890cb8f078e1a8ff","tests/ui/non_unit_variant.rs":"0d8295ae08d882fc3ef4164857240038c5b0674ff0811da9b6ea7343e8bb955c","tests/ui/non_unit_variant.stderr":"ba863a840fae03b5b41e09e6dddf5773873b95d0b39775baacb04301b648a8b8","tests/ui/not_enum.rs":"ada7637821c924a6b99175363c820375991be60223f96ca553d304fde2721386","tests/ui/not_enum.stderr":"c49c4c6a01c2705118868fb72746f4e70aeba23f2a0b98157af3fb363c572276"},"package":"98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5"}

View File

@ -13,13 +13,15 @@
[package]
edition = "2018"
name = "serde_repr"
version = "0.1.5"
version = "0.1.7"
authors = ["David Tolnay <dtolnay@gmail.com>"]
description = "Derive Serialize and Deserialize that delegates to the underlying repr of a C-like enum."
documentation = "https://docs.rs/serde_repr"
readme = "README.md"
license = "MIT OR Apache-2.0"
repository = "https://github.com/dtolnay/serde-repr"
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[lib]
proc-macro = true
@ -32,7 +34,7 @@ version = "1.0"
[dependencies.syn]
version = "1.0"
[dev-dependencies.rustversion]
version = "0.1"
version = "1.0"
[dev-dependencies.serde]
version = "1.0"
@ -41,4 +43,5 @@ version = "1.0"
version = "1.0"
[dev-dependencies.trybuild]
version = "1.0"
version = "1.0.19"
features = ["diff"]

View File

@ -1,9 +1,10 @@
Serde repr derive
=================
[![Build Status](https://api.travis-ci.com/dtolnay/serde-repr.svg?branch=master)](https://travis-ci.com/dtolnay/serde-repr)
[![Latest Version](https://img.shields.io/crates/v/serde_repr.svg)](https://crates.io/crates/serde_repr)
[![Rust Documentation](https://img.shields.io/badge/api-rustdoc-blue.svg)](https://docs.rs/serde_repr)
[<img alt="github" src="https://img.shields.io/badge/github-dtolnay/serde--repr-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/dtolnay/serde-repr)
[<img alt="crates.io" src="https://img.shields.io/crates/v/serde_repr.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/serde_repr)
[<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-serde__repr-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K" height="20">](https://docs.rs/serde_repr)
[<img alt="build status" src="https://img.shields.io/github/workflow/status/dtolnay/serde-repr/CI/master?style=for-the-badge" height="20">](https://github.com/dtolnay/serde-repr/actions?query=branch%3Amaster)
This crate provides a derive macro to derive Serde's `Serialize` and
`Deserialize` traits in a way that delegates to the underlying repr of a C-like

View File

@ -1,3 +1,11 @@
//! [![github]](https://github.com/dtolnay/serde-repr)&ensp;[![crates-io]](https://crates.io/crates/serde_repr)&ensp;[![docs-rs]](https://docs.rs/serde_repr)
//!
//! [github]: https://img.shields.io/badge/github-8da0cb?style=for-the-badge&labelColor=555555&logo=github
//! [crates-io]: https://img.shields.io/badge/crates.io-fc8d62?style=for-the-badge&labelColor=555555&logo=rust
//! [docs-rs]: https://img.shields.io/badge/docs.rs-66c2a5?style=for-the-badge&labelColor=555555&logoColor=white&logo=data:image/svg+xml;base64,PHN2ZyByb2xlPSJpbWciIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoIGZpbGw9IiNmNWY1ZjUiIGQ9Ik00ODguNiAyNTAuMkwzOTIgMjE0VjEwNS41YzAtMTUtOS4zLTI4LjQtMjMuNC0zMy43bC0xMDAtMzcuNWMtOC4xLTMuMS0xNy4xLTMuMS0yNS4zIDBsLTEwMCAzNy41Yy0xNC4xIDUuMy0yMy40IDE4LjctMjMuNCAzMy43VjIxNGwtOTYuNiAzNi4yQzkuMyAyNTUuNSAwIDI2OC45IDAgMjgzLjlWMzk0YzAgMTMuNiA3LjcgMjYuMSAxOS45IDMyLjJsMTAwIDUwYzEwLjEgNS4xIDIyLjEgNS4xIDMyLjIgMGwxMDMuOS01MiAxMDMuOSA1MmMxMC4xIDUuMSAyMi4xIDUuMSAzMi4yIDBsMTAwLTUwYzEyLjItNi4xIDE5LjktMTguNiAxOS45LTMyLjJWMjgzLjljMC0xNS05LjMtMjguNC0yMy40LTMzLjd6TTM1OCAyMTQuOGwtODUgMzEuOXYtNjguMmw4NS0zN3Y3My4zek0xNTQgMTA0LjFsMTAyLTM4LjIgMTAyIDM4LjJ2LjZsLTEwMiA0MS40LTEwMi00MS40di0uNnptODQgMjkxLjFsLTg1IDQyLjV2LTc5LjFsODUtMzguOHY3NS40em0wLTExMmwtMTAyIDQxLjQtMTAyLTQxLjR2LS42bDEwMi0zOC4yIDEwMiAzOC4ydi42em0yNDAgMTEybC04NSA0Mi41di03OS4xbDg1LTM4Ljh2NzUuNHptMC0xMTJsLTEwMiA0MS40LTEwMi00MS40di0uNmwxMDItMzguMiAxMDIgMzguMnYuNnoiPjwvcGF0aD48L3N2Zz4K
//!
//! <br>
//!
//! Derive `Serialize` and `Deserialize` that delegates to the underlying repr
//! of a C-like enum.
//!
@ -26,7 +34,7 @@
//! }
//! ```
#![recursion_limit = "128"]
#![allow(clippy::single_match_else)]
extern crate proc_macro;
@ -55,6 +63,7 @@ pub fn derive_serialize(input: TokenStream) -> TokenStream {
TokenStream::from(quote! {
impl serde::Serialize for #ident {
#[allow(clippy::use_self)]
fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
where
S: serde::Serializer
@ -78,7 +87,6 @@ pub fn derive_deserialize(input: TokenStream) -> TokenStream {
let declare_discriminants = input.variants.iter().map(|variant| {
let variant = &variant.ident;
quote! {
#[allow(non_upper_case_globals)]
const #variant: #repr = #ident::#variant as #repr;
}
});
@ -115,12 +123,14 @@ pub fn derive_deserialize(input: TokenStream) -> TokenStream {
TokenStream::from(quote! {
impl<'de> serde::Deserialize<'de> for #ident {
#[allow(clippy::use_self)]
fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
struct discriminant;
#[allow(non_upper_case_globals)]
impl discriminant {
#(#declare_discriminants)*
}

View File

@ -1,3 +1,5 @@
#![allow(clippy::wildcard_imports)]
use serde_repr::{Deserialize_repr, Serialize_repr};
mod small_prime {

View File

@ -3,3 +3,5 @@ error: there must be at least one variant
|
3 | #[derive(Serialize_repr)]
| ^^^^^^^^^^^^^^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -3,3 +3,5 @@ error: missing #[repr(...)] attribute
|
3 | #[derive(Serialize_repr)]
| ^^^^^^^^^^^^^^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -3,3 +3,5 @@ error: only one variant can be #[serde(other)]
|
3 | #[derive(Deserialize_repr)]
| ^^^^^^^^^^^^^^^^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)

View File

@ -3,3 +3,5 @@ error: input must be an enum
|
3 | #[derive(Serialize_repr)]
| ^^^^^^^^^^^^^^
|
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)