diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-18 02:49:42 +0000 |
commit | 837b550238aa671a591ccf282dddeab29cadb206 (patch) | |
tree | 914b6b8862bace72bd3245ca184d374b08d8a672 /vendor/thiserror-impl | |
parent | Adding debian version 1.70.0+dfsg2-1. (diff) | |
download | rustc-837b550238aa671a591ccf282dddeab29cadb206.tar.xz rustc-837b550238aa671a591ccf282dddeab29cadb206.zip |
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/thiserror-impl')
-rw-r--r-- | vendor/thiserror-impl/.cargo-checksum.json | 2 | ||||
-rw-r--r-- | vendor/thiserror-impl/Cargo.toml | 6 | ||||
-rw-r--r-- | vendor/thiserror-impl/LICENSE-APACHE | 25 | ||||
-rw-r--r-- | vendor/thiserror-impl/src/attr.rs | 38 | ||||
-rw-r--r-- | vendor/thiserror-impl/src/expand.rs | 11 |
5 files changed, 33 insertions, 49 deletions
diff --git a/vendor/thiserror-impl/.cargo-checksum.json b/vendor/thiserror-impl/.cargo-checksum.json index 4005c4c07..a05c1451f 100644 --- a/vendor/thiserror-impl/.cargo-checksum.json +++ b/vendor/thiserror-impl/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"5431537713726199373bc09d8044cde83911dcf02c38a03534f1ea937be2e333","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","src/ast.rs":"c7601e8394f5ee304365c520181f0dbeaa807ddaa71ce4a8618ea1a70f81b3b2","src/attr.rs":"d1fe75dde04cb8df6da4e1aaec5b38c2b0f634fa3432877993b3fec4cc08b6b5","src/expand.rs":"8e2bc7ca24e8f8d9b179b792e772d3699154b750a08dcb942be298b7cc032563","src/fmt.rs":"d63d39120c18712596f9f2a1715821148c2becd4d8bad5bc1b307210a84dbe98","src/generics.rs":"2076cde22271be355a8131a77add4b93f83ab0af4317cd2df5471fffa4f95c66","src/lib.rs":"7d023310cd3db670554ce108a6afd94e1ae3c55c83661d4b9fcebdf1865b9e4b","src/prop.rs":"6709932aee8f9d217f40cd644629c0ecb2f46d333ae8a1398e8d745534f4e028","src/valid.rs":"ac95253944fd360d3578d0643a7baabb2cfa6bf9fbced7a6ce1f7b0529a3bb98"},"package":"1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"}
\ No newline at end of file +{"files":{"Cargo.toml":"f0ec2f02a8e4b3d1ba232448e49f5ab3865f89dff475a10cae26d498c9b43b04","LICENSE-APACHE":"62c7a1e35f56406896d7aa7ca52d0cc0d272ac022b5d2796e7d6905db8a3636a","LICENSE-MIT":"23f18e03dc49df91622fe2a76176497404e46ced8a715d9d2b67a7446571cca3","src/ast.rs":"c7601e8394f5ee304365c520181f0dbeaa807ddaa71ce4a8618ea1a70f81b3b2","src/attr.rs":"26dca4c6b2ae3a2457bb4ed8e7e869539f4fdfd9e92e29b36c2bbc2c072b387d","src/expand.rs":"cb5ce6771c95eccd9c2137c02550a1d575c50607168d4a7d82edb5cd32d9b36b","src/fmt.rs":"d63d39120c18712596f9f2a1715821148c2becd4d8bad5bc1b307210a84dbe98","src/generics.rs":"2076cde22271be355a8131a77add4b93f83ab0af4317cd2df5471fffa4f95c66","src/lib.rs":"7d023310cd3db670554ce108a6afd94e1ae3c55c83661d4b9fcebdf1865b9e4b","src/prop.rs":"6709932aee8f9d217f40cd644629c0ecb2f46d333ae8a1398e8d745534f4e028","src/valid.rs":"ac95253944fd360d3578d0643a7baabb2cfa6bf9fbced7a6ce1f7b0529a3bb98"},"package":"f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f"}
\ No newline at end of file diff --git a/vendor/thiserror-impl/Cargo.toml b/vendor/thiserror-impl/Cargo.toml index ca2a0b4f4..bf6147075 100644 --- a/vendor/thiserror-impl/Cargo.toml +++ b/vendor/thiserror-impl/Cargo.toml @@ -11,9 +11,9 @@ [package] edition = "2018" -rust-version = "1.31" +rust-version = "1.56" name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" authors = ["David Tolnay <dtolnay@gmail.com>"] description = "Implementation detail of the `thiserror` crate" license = "MIT OR Apache-2.0" @@ -32,4 +32,4 @@ version = "1.0" version = "1.0" [dependencies.syn] -version = "1.0.45" +version = "2.0" diff --git a/vendor/thiserror-impl/LICENSE-APACHE b/vendor/thiserror-impl/LICENSE-APACHE index 16fe87b06..1b5ec8b78 100644 --- a/vendor/thiserror-impl/LICENSE-APACHE +++ b/vendor/thiserror-impl/LICENSE-APACHE @@ -174,28 +174,3 @@ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS - -APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - -Copyright [yyyy] [name of copyright owner] - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/vendor/thiserror-impl/src/attr.rs b/vendor/thiserror-impl/src/attr.rs index 9963fd6db..0b1b89dce 100644 --- a/vendor/thiserror-impl/src/attr.rs +++ b/vendor/thiserror-impl/src/attr.rs @@ -2,9 +2,9 @@ use proc_macro2::{Delimiter, Group, Span, TokenStream, TokenTree}; use quote::{format_ident, quote, ToTokens}; use std::collections::BTreeSet as Set; use std::iter::FromIterator; -use syn::parse::{Nothing, ParseStream}; +use syn::parse::ParseStream; use syn::{ - braced, bracketed, parenthesized, token, Attribute, Error, Ident, Index, LitInt, LitStr, + braced, bracketed, parenthesized, token, Attribute, Error, Ident, Index, LitInt, LitStr, Meta, Result, Token, }; @@ -54,24 +54,27 @@ pub fn get(input: &[Attribute]) -> Result<Attrs> { }; for attr in input { - if attr.path.is_ident("error") { + if attr.path().is_ident("error") { parse_error_attribute(&mut attrs, attr)?; - } else if attr.path.is_ident("source") { + } else if attr.path().is_ident("source") { require_empty_attribute(attr)?; if attrs.source.is_some() { return Err(Error::new_spanned(attr, "duplicate #[source] attribute")); } attrs.source = Some(attr); - } else if attr.path.is_ident("backtrace") { + } else if attr.path().is_ident("backtrace") { require_empty_attribute(attr)?; if attrs.backtrace.is_some() { return Err(Error::new_spanned(attr, "duplicate #[backtrace] attribute")); } attrs.backtrace = Some(attr); - } else if attr.path.is_ident("from") { - if !attr.tokens.is_empty() { - // Assume this is meant for derive_more crate or something. - continue; + } else if attr.path().is_ident("from") { + match attr.meta { + Meta::Path(_) => {} + Meta::List(_) | Meta::NameValue(_) => { + // Assume this is meant for derive_more crate or something. + continue; + } } if attrs.from.is_some() { return Err(Error::new_spanned(attr, "duplicate #[from] attribute")); @@ -166,21 +169,21 @@ fn parse_token_expr(input: ParseStream, mut begin_expr: bool) -> Result<TokenStr let delimiter = parenthesized!(content in input); let nested = parse_token_expr(&content, true)?; let mut group = Group::new(Delimiter::Parenthesis, nested); - group.set_span(delimiter.span); + group.set_span(delimiter.span.join()); TokenTree::Group(group) } else if input.peek(token::Brace) { let content; let delimiter = braced!(content in input); let nested = parse_token_expr(&content, true)?; let mut group = Group::new(Delimiter::Brace, nested); - group.set_span(delimiter.span); + group.set_span(delimiter.span.join()); TokenTree::Group(group) } else if input.peek(token::Bracket) { let content; let delimiter = bracketed!(content in input); let nested = parse_token_expr(&content, true)?; let mut group = Group::new(Delimiter::Bracket, nested); - group.set_span(delimiter.span); + group.set_span(delimiter.span.join()); TokenTree::Group(group) } else { input.parse()? @@ -191,8 +194,15 @@ fn parse_token_expr(input: ParseStream, mut begin_expr: bool) -> Result<TokenStr } fn require_empty_attribute(attr: &Attribute) -> Result<()> { - syn::parse2::<Nothing>(attr.tokens.clone())?; - Ok(()) + let error_span = match &attr.meta { + Meta::Path(_) => return Ok(()), + Meta::List(meta) => meta.delimiter.span().open(), + Meta::NameValue(meta) => meta.eq_token.span, + }; + Err(Error::new( + error_span, + "unexpected token in thiserror attribute", + )) } impl ToTokens for Display<'_> { diff --git a/vendor/thiserror-impl/src/expand.rs b/vendor/thiserror-impl/src/expand.rs index 43522096a..ef8eaf31b 100644 --- a/vendor/thiserror-impl/src/expand.rs +++ b/vendor/thiserror-impl/src/expand.rs @@ -528,15 +528,14 @@ fn type_parameter_of_option(ty: &Type) -> Option<&Type> { fn spanned_error_trait(input: &DeriveInput) -> TokenStream { let vis_span = match &input.vis { - Visibility::Public(vis) => Some(vis.pub_token.span()), - Visibility::Crate(vis) => Some(vis.crate_token.span()), - Visibility::Restricted(vis) => Some(vis.pub_token.span()), + Visibility::Public(vis) => Some(vis.span), + Visibility::Restricted(vis) => Some(vis.pub_token.span), Visibility::Inherited => None, }; let data_span = match &input.data { - Data::Struct(data) => data.struct_token.span(), - Data::Enum(data) => data.enum_token.span(), - Data::Union(data) => data.union_token.span(), + Data::Struct(data) => data.struct_token.span, + Data::Enum(data) => data.enum_token.span, + Data::Union(data) => data.union_token.span, }; let first_span = vis_span.unwrap_or(data_span); let last_span = input.ident.span(); |