From d1b2d29528b7794b41e66fc2136e395a02f8529b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Thu, 30 May 2024 05:59:35 +0200 Subject: Merging upstream version 1.73.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/quote/src/ident_fragment.rs | 6 +++--- vendor/quote/src/lib.rs | 4 +++- vendor/quote/src/runtime.rs | 8 ++++---- vendor/quote/src/spanned.rs | 12 ------------ vendor/quote/src/to_tokens.rs | 4 ++-- 5 files changed, 12 insertions(+), 22 deletions(-) (limited to 'vendor/quote/src') diff --git a/vendor/quote/src/ident_fragment.rs b/vendor/quote/src/ident_fragment.rs index e7e8a3d94..6c2a9a87a 100644 --- a/vendor/quote/src/ident_fragment.rs +++ b/vendor/quote/src/ident_fragment.rs @@ -1,6 +1,6 @@ +use alloc::borrow::Cow; use core::fmt; use proc_macro2::{Ident, Span}; -use std::borrow::Cow; /// Specialized formatting trait used by `format_ident!`. /// @@ -49,8 +49,8 @@ impl IdentFragment for Ident { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let id = self.to_string(); - if id.starts_with("r#") { - fmt::Display::fmt(&id[2..], f) + if let Some(id) = id.strip_prefix("r#") { + fmt::Display::fmt(id, f) } else { fmt::Display::fmt(&id[..], f) } diff --git a/vendor/quote/src/lib.rs b/vendor/quote/src/lib.rs index d871fb080..1cd7cd626 100644 --- a/vendor/quote/src/lib.rs +++ b/vendor/quote/src/lib.rs @@ -92,7 +92,7 @@ //! [prettyplease]: https://github.com/dtolnay/prettyplease // Quote types in rustdoc of other crates get linked to here. -#![doc(html_root_url = "https://docs.rs/quote/1.0.29")] +#![doc(html_root_url = "https://docs.rs/quote/1.0.32")] #![allow( clippy::doc_markdown, clippy::missing_errors_doc, @@ -102,6 +102,8 @@ clippy::wrong_self_convention, )] +extern crate alloc; + #[cfg(feature = "proc-macro")] extern crate proc_macro; diff --git a/vendor/quote/src/runtime.rs b/vendor/quote/src/runtime.rs index 4e3d4fd03..ce893ebec 100644 --- a/vendor/quote/src/runtime.rs +++ b/vendor/quote/src/runtime.rs @@ -5,9 +5,9 @@ use core::iter; use core::ops::BitOr; use proc_macro2::{Group, Ident, Punct, Spacing, TokenTree}; +pub use alloc::format; pub use core::option::Option; pub use proc_macro2::{Delimiter, Span, TokenStream}; -pub use std::format; pub struct HasIterator; // True pub struct ThereIsNoIteratorInRepetition; // False @@ -50,8 +50,8 @@ pub mod ext { use super::RepInterp; use super::{HasIterator as HasIter, ThereIsNoIteratorInRepetition as DoesNotHaveIter}; use crate::ToTokens; + use alloc::collections::btree_set::{self, BTreeSet}; use core::slice; - use std::collections::btree_set::{self, BTreeSet}; /// Extension trait providing the `quote_into_iter` method on iterators. pub trait RepIteratorExt: Iterator + Sized { @@ -443,8 +443,8 @@ pub fn mk_ident(id: &str, span: Option) -> Ident { } fn ident_maybe_raw(id: &str, span: Span) -> Ident { - if id.starts_with("r#") { - Ident::new_raw(&id[2..], span) + if let Some(id) = id.strip_prefix("r#") { + Ident::new_raw(id, span) } else { Ident::new(id, span) } diff --git a/vendor/quote/src/spanned.rs b/vendor/quote/src/spanned.rs index efc2e8bce..6eba64445 100644 --- a/vendor/quote/src/spanned.rs +++ b/vendor/quote/src/spanned.rs @@ -26,20 +26,8 @@ impl Spanned for T { } fn join_spans(tokens: TokenStream) -> Span { - #[cfg(not(needs_invalid_span_workaround))] let mut iter = tokens.into_iter().map(|tt| tt.span()); - #[cfg(needs_invalid_span_workaround)] - let mut iter = tokens.into_iter().filter_map(|tt| { - let span = tt.span(); - let debug = format!("{:?}", span); - if debug.ends_with("bytes(0..0)") { - None - } else { - Some(span) - } - }); - let first = match iter.next() { Some(span) => span, None => return Span::call_site(), diff --git a/vendor/quote/src/to_tokens.rs b/vendor/quote/src/to_tokens.rs index 57487217e..23b6ec2c0 100644 --- a/vendor/quote/src/to_tokens.rs +++ b/vendor/quote/src/to_tokens.rs @@ -1,8 +1,8 @@ use super::TokenStreamExt; +use alloc::borrow::Cow; +use alloc::rc::Rc; use core::iter; use proc_macro2::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree}; -use std::borrow::Cow; -use std::rc::Rc; /// Types that can be interpolated inside a `quote!` invocation. /// -- cgit v1.2.3