| { | ||
| "git": { | ||
| "sha1": "842ffde933fdd76cd1681a288bed136d8b95a97a" | ||
| "sha1": "bc4caf255fa9e58e025e5ff5a11ca948442c0f7a" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
@@ -27,6 +27,6 @@ name: CI | ||
| matrix: | ||
| rust: [nightly, stable, beta, 1.83.0, 1.71.0] | ||
| rust: [nightly, stable, beta, 1.85.0, 1.71.0] | ||
| timeout-minutes: 45 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@master | ||
@@ -57,3 +57,3 @@ with: | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@nightly | ||
@@ -72,3 +72,3 @@ - run: cargo generate-lockfile -Z minimal-versions | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@nightly | ||
@@ -86,3 +86,3 @@ with: | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@nightly | ||
@@ -100,3 +100,3 @@ with: | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@miri | ||
@@ -114,5 +114,5 @@ - run: cargo miri setup | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - uses: actions/checkout@v7 | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: dtolnay/install@cargo-outdated | ||
| - run: cargo outdated --workspace --exit-code 1 |
+33
-33
@@ -7,5 +7,5 @@ # This file is automatically @generated by Cargo. | ||
| name = "dissimilar" | ||
| version = "1.0.10" | ||
| version = "1.0.11" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "8975ffdaa0ef3661bfe02dbdcc06c9f829dfafe6a3c474de366a8d5e44276921" | ||
| checksum = "aeda16ab4059c5fd2a83f2b9c9e9c981327b18aa8e3b313f7e6563799d4f093e" | ||
@@ -26,11 +26,11 @@ [[package]] | ||
| name = "hashbrown" | ||
| version = "0.16.1" | ||
| version = "0.17.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" | ||
| checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" | ||
| [[package]] | ||
| name = "indexmap" | ||
| version = "2.13.0" | ||
| version = "2.14.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" | ||
| checksum = "d466e9454f08e4a911e14806c24e16fba1b4c121d1ea474396f396069cf949d9" | ||
| dependencies = [ | ||
@@ -43,11 +43,11 @@ "equivalent", | ||
| name = "itoa" | ||
| version = "1.0.17" | ||
| version = "1.0.18" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" | ||
| checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" | ||
| [[package]] | ||
| name = "memchr" | ||
| version = "2.8.0" | ||
| version = "2.8.2" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" | ||
| checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" | ||
@@ -65,5 +65,5 @@ [[package]] | ||
| name = "quote" | ||
| version = "1.0.44" | ||
| version = "1.0.45" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" | ||
| checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" | ||
| dependencies = [ | ||
@@ -75,3 +75,3 @@ "proc-macro2", | ||
| name = "quote" | ||
| version = "1.0.45" | ||
| version = "1.0.46" | ||
| dependencies = [ | ||
@@ -114,3 +114,3 @@ "proc-macro2", | ||
| "proc-macro2", | ||
| "quote 1.0.44", | ||
| "quote 1.0.45", | ||
| "syn", | ||
@@ -121,5 +121,5 @@ ] | ||
| name = "serde_json" | ||
| version = "1.0.149" | ||
| version = "1.0.150" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" | ||
| checksum = "e8014e44b4736ed0538adeecded0fce2a272f22dc9578a7eb6b2d9993c74cfb9" | ||
| dependencies = [ | ||
@@ -135,5 +135,5 @@ "itoa", | ||
| name = "serde_spanned" | ||
| version = "1.0.4" | ||
| version = "1.1.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "f8bbf91e5a4d6315eee45e704372590b30e260ee83af6639d64557f51b067776" | ||
| checksum = "6662b5879511e06e8999a8a235d848113e942c9124f211511b16466ee2995f26" | ||
| dependencies = [ | ||
@@ -145,8 +145,8 @@ "serde_core", | ||
| name = "syn" | ||
| version = "2.0.117" | ||
| version = "2.0.118" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" | ||
| checksum = "1b9ae57f904213ebb649ce6895b8a66c66f0203b9319718f69a5612a065b1422" | ||
| dependencies = [ | ||
| "proc-macro2", | ||
| "quote 1.0.44", | ||
| "quote 1.0.45", | ||
| "unicode-ident", | ||
@@ -172,5 +172,5 @@ ] | ||
| name = "toml" | ||
| version = "1.0.3+spec-1.1.0" | ||
| version = "1.1.2+spec-1.1.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "c7614eaf19ad818347db24addfa201729cf2a9b6fdfd9eb0ab870fcacc606c0c" | ||
| checksum = "81f3d15e84cbcd896376e6730314d59fb5a87f31e4b038454184435cd57defee" | ||
| dependencies = [ | ||
@@ -188,5 +188,5 @@ "indexmap", | ||
| name = "toml_datetime" | ||
| version = "1.0.0+spec-1.1.0" | ||
| version = "1.1.1+spec-1.1.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "32c2555c699578a4f59f0cc68e5116c8d7cabbd45e1409b989d4be085b53f13e" | ||
| checksum = "3165f65f62e28e0115a00b2ebdd37eb6f3b641855f9d636d3cd4103767159ad7" | ||
| dependencies = [ | ||
@@ -198,5 +198,5 @@ "serde_core", | ||
| name = "toml_parser" | ||
| version = "1.0.9+spec-1.1.0" | ||
| version = "1.1.2+spec-1.1.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "702d4415e08923e7e1ef96cd5727c0dfed80b4d2fa25db9647fe5eb6f7c5a4c4" | ||
| checksum = "a2abe9b86193656635d2411dc43050282ca48aa31c2451210f4202550afb7526" | ||
| dependencies = [ | ||
@@ -208,11 +208,11 @@ "winnow", | ||
| name = "toml_writer" | ||
| version = "1.0.6+spec-1.1.0" | ||
| version = "1.1.1+spec-1.1.0" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "ab16f14aed21ee8bfd8ec22513f7287cd4a91aa92e44edfe2c17ddd004e92607" | ||
| checksum = "756daf9b1013ebe47a8776667b466417e2d4c5679d441c26230efd9ef78692db" | ||
| [[package]] | ||
| name = "trybuild" | ||
| version = "1.0.116" | ||
| version = "1.0.117" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "47c635f0191bd3a2941013e5062667100969f8c4e9cd787c14f977265d73616e" | ||
| checksum = "0710d4dfbeae4f9c390baa784c49858a7468fa433f3fe5d0ec5ebef651cf59f9" | ||
| dependencies = [ | ||
@@ -261,5 +261,5 @@ "dissimilar", | ||
| name = "winnow" | ||
| version = "0.7.14" | ||
| version = "1.0.3" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" | ||
| checksum = "0592e1c9d151f854e6fd382574c3a0855250e1d9b2f99d9281c6e6391af352f1" | ||
@@ -266,0 +266,0 @@ [[package]] |
+1
-1
@@ -16,3 +16,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| name = "quote" | ||
| version = "1.0.45" | ||
| version = "1.0.46" | ||
| authors = ["David Tolnay <dtolnay@gmail.com>"] | ||
@@ -19,0 +19,0 @@ build = "build.rs" |
+144
-150
@@ -92,3 +92,3 @@ //! [![github]](https://github.com/dtolnay/quote) [![crates-io]](https://crates.io/crates/quote) [![docs-rs]](https://docs.rs/quote) | ||
| #![no_std] | ||
| #![doc(html_root_url = "https://docs.rs/quote/1.0.45")] | ||
| #![doc(html_root_url = "https://docs.rs/quote/1.0.46")] | ||
| #![allow( | ||
@@ -529,154 +529,142 @@ clippy::doc_markdown, | ||
| macro_rules! __quote_spanned { | ||
| ($quote_spanned:item) => { | ||
| /// Same as `quote!`, but applies a given span to all tokens originating within | ||
| /// the macro invocation. | ||
| /// | ||
| /// <br> | ||
| /// | ||
| /// # Syntax | ||
| /// | ||
| /// A span expression of type [`Span`], followed by `=>`, followed by the tokens | ||
| /// to quote. The span expression should be brief — use a variable for | ||
| /// anything more than a few characters. There should be no space before the | ||
| /// `=>` token. | ||
| /// | ||
| /// [`Span`]: proc_macro2::Span | ||
| /// | ||
| /// ``` | ||
| /// # use proc_macro2::Span; | ||
| /// # use quote::quote_spanned; | ||
| /// # | ||
| /// # const IGNORE_TOKENS: &'static str = stringify! { | ||
| /// let span = /* ... */; | ||
| /// # }; | ||
| /// # let span = Span::call_site(); | ||
| /// # let init = 0; | ||
| /// | ||
| /// // On one line, use parentheses. | ||
| /// let tokens = quote_spanned!(span=> Box::into_raw(Box::new(#init))); | ||
| /// | ||
| /// // On multiple lines, place the span at the top and use braces. | ||
| /// let tokens = quote_spanned! {span=> | ||
| /// Box::into_raw(Box::new(#init)) | ||
| /// }; | ||
| /// ``` | ||
| /// | ||
| /// The lack of space before the `=>` should look jarring to Rust programmers | ||
| /// and this is intentional. The formatting is designed to be visibly | ||
| /// off-balance and draw the eye a particular way, due to the span expression | ||
| /// being evaluated in the context of the procedural macro and the remaining | ||
| /// tokens being evaluated in the generated code. | ||
| /// | ||
| /// <br> | ||
| /// | ||
| /// # Hygiene | ||
| /// | ||
| /// Any interpolated tokens preserve the `Span` information provided by their | ||
| /// `ToTokens` implementation. Tokens that originate within the `quote_spanned!` | ||
| /// invocation are spanned with the given span argument. | ||
| /// | ||
| /// <br> | ||
| /// | ||
| /// # Example | ||
| /// | ||
| /// The following procedural macro code uses `quote_spanned!` to assert that a | ||
| /// particular Rust type implements the [`Sync`] trait so that references can be | ||
| /// safely shared between threads. | ||
| /// | ||
| /// ``` | ||
| /// # use quote::{quote_spanned, TokenStreamExt, ToTokens}; | ||
| /// # use proc_macro2::{Span, TokenStream}; | ||
| /// # | ||
| /// # struct Type; | ||
| /// # | ||
| /// # impl Type { | ||
| /// # fn span(&self) -> Span { | ||
| /// # Span::call_site() | ||
| /// # } | ||
| /// # } | ||
| /// # | ||
| /// # impl ToTokens for Type { | ||
| /// # fn to_tokens(&self, _tokens: &mut TokenStream) {} | ||
| /// # } | ||
| /// # | ||
| /// # let ty = Type; | ||
| /// # let call_site = Span::call_site(); | ||
| /// # | ||
| /// let ty_span = ty.span(); | ||
| /// let assert_sync = quote_spanned! {ty_span=> | ||
| /// struct _AssertSync where #ty: Sync; | ||
| /// }; | ||
| /// ``` | ||
| /// | ||
| /// If the assertion fails, the user will see an error like the following. The | ||
| /// input span of their type is highlighted in the error. | ||
| /// | ||
| /// ```text | ||
| /// error[E0277]: the trait bound `*const (): std::marker::Sync` is not satisfied | ||
| /// --> src/main.rs:10:21 | ||
| /// | | ||
| /// 10 | static ref PTR: *const () = &(); | ||
| /// | ^^^^^^^^^ `*const ()` cannot be shared between threads safely | ||
| /// ``` | ||
| /// | ||
| /// In this example it is important for the where-clause to be spanned with the | ||
| /// line/column information of the user's input type so that error messages are | ||
| /// placed appropriately by the compiler. | ||
| $quote_spanned | ||
| }; | ||
| /// Same as `quote!`, but applies a given span to all tokens originating within | ||
| /// the macro invocation. | ||
| /// | ||
| /// <br> | ||
| /// | ||
| /// # Syntax | ||
| /// | ||
| /// A span expression of type [`Span`], followed by `=>`, followed by the tokens | ||
| /// to quote. The span expression should be brief — use a variable for | ||
| /// anything more than a few characters. There should be no space before the | ||
| /// `=>` token. | ||
| /// | ||
| /// [`Span`]: proc_macro2::Span | ||
| /// | ||
| /// ``` | ||
| /// # use proc_macro2::Span; | ||
| /// # use quote::quote_spanned; | ||
| /// # | ||
| /// # const IGNORE_TOKENS: &'static str = stringify! { | ||
| /// let span = /* ... */; | ||
| /// # }; | ||
| /// # let span = Span::call_site(); | ||
| /// # let init = 0; | ||
| /// | ||
| /// // On one line, use parentheses. | ||
| /// let tokens = quote_spanned!(span=> Box::into_raw(Box::new(#init))); | ||
| /// | ||
| /// // On multiple lines, place the span at the top and use braces. | ||
| /// let tokens = quote_spanned! {span=> | ||
| /// Box::into_raw(Box::new(#init)) | ||
| /// }; | ||
| /// ``` | ||
| /// | ||
| /// The lack of space before the `=>` should look jarring to Rust programmers | ||
| /// and this is intentional. The formatting is designed to be visibly | ||
| /// off-balance and draw the eye a particular way, due to the span expression | ||
| /// being evaluated in the context of the procedural macro and the remaining | ||
| /// tokens being evaluated in the generated code. | ||
| /// | ||
| /// <br> | ||
| /// | ||
| /// # Hygiene | ||
| /// | ||
| /// Any interpolated tokens preserve the `Span` information provided by their | ||
| /// `ToTokens` implementation. Tokens that originate within the `quote_spanned!` | ||
| /// invocation are spanned with the given span argument. | ||
| /// | ||
| /// <br> | ||
| /// | ||
| /// # Example | ||
| /// | ||
| /// The following procedural macro code uses `quote_spanned!` to assert that a | ||
| /// particular Rust type implements the [`Sync`] trait so that references can be | ||
| /// safely shared between threads. | ||
| /// | ||
| /// ``` | ||
| /// # use quote::{quote_spanned, TokenStreamExt, ToTokens}; | ||
| /// # use proc_macro2::{Span, TokenStream}; | ||
| /// # | ||
| /// # struct Type; | ||
| /// # | ||
| /// # impl Type { | ||
| /// # fn span(&self) -> Span { | ||
| /// # Span::call_site() | ||
| /// # } | ||
| /// # } | ||
| /// # | ||
| /// # impl ToTokens for Type { | ||
| /// # fn to_tokens(&self, _tokens: &mut TokenStream) {} | ||
| /// # } | ||
| /// # | ||
| /// # let ty = Type; | ||
| /// # let call_site = Span::call_site(); | ||
| /// # | ||
| /// let ty_span = ty.span(); | ||
| /// let assert_sync = quote_spanned! {ty_span=> | ||
| /// struct _AssertSync where #ty: Sync; | ||
| /// }; | ||
| /// ``` | ||
| /// | ||
| /// If the assertion fails, the user will see an error like the following. The | ||
| /// input span of their type is highlighted in the error. | ||
| /// | ||
| /// ```text | ||
| /// error[E0277]: the trait bound `*const (): std::marker::Sync` is not satisfied | ||
| /// --> src/main.rs:10:21 | ||
| /// | | ||
| /// 10 | static ref PTR: *const () = &(); | ||
| /// | ^^^^^^^^^ `*const ()` cannot be shared between threads safely | ||
| /// ``` | ||
| /// | ||
| /// In this example it is important for the where-clause to be spanned with the | ||
| /// line/column information of the user's input type so that error messages are | ||
| /// placed appropriately by the compiler. | ||
| #[macro_export] | ||
| macro_rules! quote_spanned { | ||
| ($span:expr=> $($tt:tt)*) => {{ | ||
| let _span: $crate::__private::Span = $crate::__private::get_span($span).__into_span(); | ||
| $crate::quote_spanned_with_expanded_span!{_span $($tt)*} | ||
| }}; | ||
| } | ||
| #[cfg(doc)] | ||
| __quote_spanned![ | ||
| #[macro_export] | ||
| macro_rules! quote_spanned { | ||
| ($span:expr=> $($tt:tt)*) => { | ||
| ... | ||
| }; | ||
| } | ||
| ]; | ||
| // We want to ensure that `get_span` only gets called for the actual user | ||
| // invocation and not for recursive calls from groups, which will call this | ||
| // inner macro instead. | ||
| #[macro_export] | ||
| #[doc(hidden)] | ||
| macro_rules! quote_spanned_with_expanded_span { | ||
| ($span:ident) => { | ||
| $crate::__private::TokenStream::new() | ||
| }; | ||
| #[cfg(not(doc))] | ||
| __quote_spanned![ | ||
| #[macro_export] | ||
| macro_rules! quote_spanned { | ||
| ($span:expr=>) => {{ | ||
| let _: $crate::__private::Span = $crate::__private::get_span($span).__into_span(); | ||
| $crate::__private::TokenStream::new() | ||
| }}; | ||
| // Special case rule for a single tt, for performance. | ||
| ($span:ident $tt:tt) => { | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| $crate::quote_token_spanned!{$tt _s $span} | ||
| _s | ||
| }; | ||
| // Special case rule for a single tt, for performance. | ||
| ($span:expr=> $tt:tt) => {{ | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| let _span: $crate::__private::Span = $crate::__private::get_span($span).__into_span(); | ||
| $crate::quote_token_spanned!{$tt _s _span} | ||
| _s | ||
| }}; | ||
| // Special case rules for two tts, for performance. | ||
| ($span:ident # $var:ident) => { | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| $crate::ToTokens::to_tokens(&$var, &mut _s); | ||
| _s | ||
| }; | ||
| ($span:ident $tt1:tt $tt2:tt) => { | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| $crate::quote_token_spanned!{$tt1 _s $span} | ||
| $crate::quote_token_spanned!{$tt2 _s $span} | ||
| _s | ||
| }; | ||
| // Special case rules for two tts, for performance. | ||
| ($span:expr=> # $var:ident) => {{ | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| let _: $crate::__private::Span = $crate::__private::get_span($span).__into_span(); | ||
| $crate::ToTokens::to_tokens(&$var, &mut _s); | ||
| _s | ||
| }}; | ||
| ($span:expr=> $tt1:tt $tt2:tt) => {{ | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| let _span: $crate::__private::Span = $crate::__private::get_span($span).__into_span(); | ||
| $crate::quote_token_spanned!{$tt1 _s _span} | ||
| $crate::quote_token_spanned!{$tt2 _s _span} | ||
| _s | ||
| }}; | ||
| // Rule for any other number of tokens. | ||
| ($span:ident $($tt:tt)*) => { | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| $crate::quote_each_token_spanned!{_s $span $($tt)*} | ||
| _s | ||
| }; | ||
| } | ||
| // Rule for any other number of tokens. | ||
| ($span:expr=> $($tt:tt)*) => {{ | ||
| let mut _s = $crate::__private::TokenStream::new(); | ||
| let _span: $crate::__private::Span = $crate::__private::get_span($span).__into_span(); | ||
| $crate::quote_each_token_spanned!{_s _span $($tt)*} | ||
| _s | ||
| }}; | ||
| } | ||
| ]; | ||
| // Extract the names of all #metavariables and pass them to the $call macro. | ||
@@ -1266,3 +1254,5 @@ // | ||
| $crate::__private::Delimiter::Parenthesis, | ||
| $crate::quote_spanned!($span=> $($inner)*), | ||
| { | ||
| $crate::quote_spanned_with_expanded_span!{$span $($inner)*} | ||
| }, | ||
| ); | ||
@@ -1276,3 +1266,5 @@ }; | ||
| $crate::__private::Delimiter::Bracket, | ||
| $crate::quote_spanned!($span=> $($inner)*), | ||
| { | ||
| $crate::quote_spanned_with_expanded_span!{$span $($inner)*} | ||
| }, | ||
| ); | ||
@@ -1286,3 +1278,5 @@ }; | ||
| $crate::__private::Delimiter::Brace, | ||
| $crate::quote_spanned!($span=> $($inner)*), | ||
| { | ||
| $crate::quote_spanned_with_expanded_span!{$span $($inner)*} | ||
| }, | ||
| ); | ||
@@ -1289,0 +1283,0 @@ }; |
+1
-1
| use super::TokenStreamExt; | ||
| use std::sync::Arc; | ||
| use alloc::borrow::{Cow, ToOwned}; | ||
@@ -11,2 +10,3 @@ use alloc::boxed::Box; | ||
| use proc_macro2::{Group, Ident, Literal, Punct, Span, TokenStream, TokenTree}; | ||
| use std::sync::Arc; | ||
@@ -13,0 +13,0 @@ /// Types that can be interpolated inside a `quote!` invocation. |
Sorry, the diff of this file is not supported yet