diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-30 03:59:35 +0000 |
commit | d1b2d29528b7794b41e66fc2136e395a02f8529b (patch) | |
tree | a4a17504b260206dec3cf55b2dca82929a348ac2 /vendor/serde_repr | |
parent | Releasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff) | |
download | rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip |
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/serde_repr')
-rw-r--r-- | vendor/serde_repr/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/serde_repr/Cargo.toml | 6 | ||||
-rw-r--r-- | vendor/serde_repr/src/lib.rs | 2 | ||||
-rw-r--r-- | vendor/serde_repr/src/parse.rs | 48 |
4 files changed, 29 insertions, 29 deletions
diff --git a/vendor/serde_repr/.cargo-checksum.json b/vendor/serde_repr/.cargo-checksum.json index d9e2780f0..7e7dac63d 100644 --- a/vendor/serde_repr/.cargo-checksum.json +++ b/vendor/serde_repr/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"e2502d13691e6c3da31c5e4b7309790fb3f51a80e706f455c2abb5e05395a55a","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"eeaecee94e896222307c54e647a2ca546e3f7a778f5a37f9a33300c9a3260324","src/lib.rs":"ba837aedc2af12a6bff6176663ef3f8a4bdaf2093738e2c3c22bdd1a31df5d4a","src/parse.rs":"687cf1436d12c0c26b1c6d06f80e56b4ec0d63a38d71e1f175b981c0fdc10c68","tests/compiletest.rs":"022a8e400ef813d7ea1875b944549cee5125f6a995dc33e93b48cba3e1b57bd1","tests/test.rs":"a4ddb956ee9eafc0b50694075497a2712a347f1a682f9038e2dd654c6605af44","tests/ui/empty_enum.rs":"fe1166f2f92ee213d26a23e57572a99c65c163d446fd8d67e1520bab34f4b859","tests/ui/empty_enum.stderr":"2c8907fc146bb4dcdb926b72de4f823dae4c1c0d8de8a636c512539408f26cc7","tests/ui/missing_repr.rs":"b7ba9341111582cad52e761b82f14778c60352014c4265566e4d4d01ccdcb306","tests/ui/missing_repr.stderr":"dfcb65527963fb8962e1442e10d3c71e141f238b1732483e1739b528ae0eca43","tests/ui/multiple_others.rs":"569658516619719f21e5071873a37125d5390edb77558e4381401f03efda0c83","tests/ui/multiple_others.stderr":"a300f94d2a2049d6718866d17b5673201edc275164b9e8eba25a9ffcd71fd30f","tests/ui/non_unit_variant.rs":"0d8295ae08d882fc3ef4164857240038c5b0674ff0811da9b6ea7343e8bb955c","tests/ui/non_unit_variant.stderr":"18f2900e501b8c64b980445758ca1cb59594dc8d24a1a76abb08a48d8beb3f35","tests/ui/not_enum.rs":"ada7637821c924a6b99175363c820375991be60223f96ca553d304fde2721386","tests/ui/not_enum.stderr":"814525f9a1495225511a02ad4149c9371ea622230b8002564fe83cf52300c728"},"package":"395627de918015623b32e7669714206363a7fc00382bf477e72c1f7533e8eafc"}
\ No newline at end of file +{"files":{"Cargo.toml":"653891585fc3f0018530aa932f4003cfca763fc4c2434ca84cd17f821520c6c9","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","README.md":"eeaecee94e896222307c54e647a2ca546e3f7a778f5a37f9a33300c9a3260324","src/lib.rs":"97f0c2f3e841e0bebe76bd2935523b7204370eb8c3dd7b9b6a2876de2fbbc6fe","src/parse.rs":"960e4380ef1d8b41fcd3b4a8bc77707d90aaa4a0484d06b73a327220d3662986","tests/compiletest.rs":"022a8e400ef813d7ea1875b944549cee5125f6a995dc33e93b48cba3e1b57bd1","tests/test.rs":"a4ddb956ee9eafc0b50694075497a2712a347f1a682f9038e2dd654c6605af44","tests/ui/empty_enum.rs":"fe1166f2f92ee213d26a23e57572a99c65c163d446fd8d67e1520bab34f4b859","tests/ui/empty_enum.stderr":"2c8907fc146bb4dcdb926b72de4f823dae4c1c0d8de8a636c512539408f26cc7","tests/ui/missing_repr.rs":"b7ba9341111582cad52e761b82f14778c60352014c4265566e4d4d01ccdcb306","tests/ui/missing_repr.stderr":"dfcb65527963fb8962e1442e10d3c71e141f238b1732483e1739b528ae0eca43","tests/ui/multiple_others.rs":"569658516619719f21e5071873a37125d5390edb77558e4381401f03efda0c83","tests/ui/multiple_others.stderr":"a300f94d2a2049d6718866d17b5673201edc275164b9e8eba25a9ffcd71fd30f","tests/ui/non_unit_variant.rs":"0d8295ae08d882fc3ef4164857240038c5b0674ff0811da9b6ea7343e8bb955c","tests/ui/non_unit_variant.stderr":"18f2900e501b8c64b980445758ca1cb59594dc8d24a1a76abb08a48d8beb3f35","tests/ui/not_enum.rs":"ada7637821c924a6b99175363c820375991be60223f96ca553d304fde2721386","tests/ui/not_enum.stderr":"814525f9a1495225511a02ad4149c9371ea622230b8002564fe83cf52300c728"},"package":"bcec881020c684085e55a25f7fd888954d56609ef363479dc5a1305eb0d40cab"}
\ No newline at end of file diff --git a/vendor/serde_repr/Cargo.toml b/vendor/serde_repr/Cargo.toml index 21eb6204b..c4cc1f3f1 100644 --- a/vendor/serde_repr/Cargo.toml +++ b/vendor/serde_repr/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2018" -rust-version = "1.31" +rust-version = "1.56" name = "serde_repr" -version = "0.1.11" +version = "0.1.12" 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" @@ -43,7 +43,7 @@ version = "1.0" version = "1.0" [dependencies.syn] -version = "1.0" +version = "2.0" [dev-dependencies.rustversion] version = "1.0" diff --git a/vendor/serde_repr/src/lib.rs b/vendor/serde_repr/src/lib.rs index 0b812a79c..cd4db9dbc 100644 --- a/vendor/serde_repr/src/lib.rs +++ b/vendor/serde_repr/src/lib.rs @@ -34,7 +34,7 @@ //! } //! ``` -#![doc(html_root_url = "https://docs.rs/serde_repr/0.1.11")] +#![doc(html_root_url = "https://docs.rs/serde_repr/0.1.12")] #![allow(clippy::single_match_else)] extern crate proc_macro; diff --git a/vendor/serde_repr/src/parse.rs b/vendor/serde_repr/src/parse.rs index 2c0ad1e7d..e7ce106a7 100644 --- a/vendor/serde_repr/src/parse.rs +++ b/vendor/serde_repr/src/parse.rs @@ -1,6 +1,6 @@ -use proc_macro2::Span; -use syn::parse::{Error, Parse, ParseStream, Parser, Result}; -use syn::{parenthesized, Data, DeriveInput, Fields, Ident, Meta, NestedMeta}; +use proc_macro2::{Span, TokenTree}; +use syn::parse::{Error, Parse, ParseStream, Result}; +use syn::{token, Attribute, Data, DeriveInput, Expr, Fields, Ident, Meta, Token}; pub struct Input { pub ident: Ident, @@ -20,26 +20,29 @@ pub struct VariantAttrs { pub is_default: bool, } -fn parse_meta(attrs: &mut VariantAttrs, meta: &Meta) { - if let Meta::List(value) = meta { - for meta in &value.nested { - if let NestedMeta::Meta(Meta::Path(path)) = meta { - if path.is_ident("other") { - attrs.is_default = true; - } +fn parse_serde_attr(attrs: &mut VariantAttrs, attr: &Attribute) { + if let Meta::List(_) = attr.meta { + let _ = attr.parse_nested_meta(|meta| { + if meta.input.peek(Token![=]) { + let _value: Expr = meta.value()?.parse()?; + } else if meta.input.peek(token::Paren) { + let _group: TokenTree = meta.input.parse()?; + } else if meta.path.is_ident("other") { + attrs.is_default = true; } - } + Ok(()) + }); } } -fn parse_attrs(variant: &syn::Variant) -> Result<VariantAttrs> { +fn parse_attrs(variant: &syn::Variant) -> VariantAttrs { let mut attrs = VariantAttrs { is_default: false }; for attr in &variant.attrs { - if attr.path.is_ident("serde") { - parse_meta(&mut attrs, &attr.parse_meta()?); + if attr.path().is_ident("serde") { + parse_serde_attr(&mut attrs, attr); } } - Ok(attrs) + attrs } impl Parse for Input { @@ -59,7 +62,7 @@ impl Parse for Input { .into_iter() .map(|variant| match variant.fields { Fields::Unit => { - let attrs = parse_attrs(&variant)?; + let attrs = parse_attrs(&variant); Ok(Variant { ident: variant.ident, attrs, @@ -82,15 +85,12 @@ impl Parse for Input { let mut repr = None; for attr in derive_input.attrs { - if attr.path.is_ident("repr") { - fn repr_arg(input: ParseStream) -> Result<Ident> { - let content; - parenthesized!(content in input); - content.parse() + if attr.path().is_ident("repr") { + if let Meta::List(_) = &attr.meta { + let ty: Ident = attr.parse_args()?; + repr = Some(ty); + break; } - let ty = repr_arg.parse2(attr.tokens)?; - repr = Some(ty); - break; } } let repr = repr.ok_or_else(|| Error::new(call_site, "missing #[repr(...)] attribute"))?; |