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/quote/src | |
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/quote/src')
-rw-r--r-- | vendor/quote/src/ident_fragment.rs | 6 | ||||
-rw-r--r-- | vendor/quote/src/lib.rs | 4 | ||||
-rw-r--r-- | vendor/quote/src/runtime.rs | 8 | ||||
-rw-r--r-- | vendor/quote/src/spanned.rs | 12 | ||||
-rw-r--r-- | vendor/quote/src/to_tokens.rs | 4 |
5 files changed, 12 insertions, 22 deletions
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<Span>) -> 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<T: ?Sized + ToTokens> 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. /// |