From c599df340a61adce71cc0a9bb31211cedcf4dacf Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 12 Mar 2023 14:19:04 -0700 Subject: [PATCH] Add spanned support for DelimSpan --- Cargo.toml | 2 +- src/spanned.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index f99b48f..1454ec9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ repository = "https://github.com/dtolnay/quote" rust-version = "1.31" [dependencies] -proc-macro2 = { version = "1.0.40", default-features = false } +proc-macro2 = { version = "1.0.52", default-features = false } [dev-dependencies] rustversion = "1.0" diff --git a/src/spanned.rs b/src/spanned.rs index f64c8f5..316d0b7 100644 --- a/src/spanned.rs +++ b/src/spanned.rs @@ -1,4 +1,5 @@ use crate::ToTokens; +use proc_macro2::extra::DelimSpan; use proc_macro2::{Span, TokenStream}; pub trait Spanned { @@ -11,6 +12,12 @@ impl Spanned for Span { } } +impl Spanned for DelimSpan { + fn __span(&self) -> Span { + self.join() + } +} + impl Spanned for T { fn __span(&self) -> Span { join_spans(self.into_token_stream())