Skip to content

Commit

Permalink
Merge pull request #237 from dtolnay/delim
Browse files Browse the repository at this point in the history
Add spanned support for DelimSpan
  • Loading branch information
dtolnay authored Mar 12, 2023
2 parents 77f5f2e + c599df3 commit d8551a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions src/spanned.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::ToTokens;
use proc_macro2::extra::DelimSpan;
use proc_macro2::{Span, TokenStream};

pub trait Spanned {
Expand All @@ -11,6 +12,12 @@ impl Spanned for Span {
}
}

impl Spanned for DelimSpan {
fn __span(&self) -> Span {
self.join()
}
}

impl<T: ?Sized + ToTokens> Spanned for T {
fn __span(&self) -> Span {
join_spans(self.into_token_stream())
Expand Down

0 comments on commit d8551a9

Please sign in to comment.