diff options
Diffstat (limited to 'third_party/rust/thiserror-impl/src/span.rs')
-rw-r--r-- | third_party/rust/thiserror-impl/src/span.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/third_party/rust/thiserror-impl/src/span.rs b/third_party/rust/thiserror-impl/src/span.rs new file mode 100644 index 0000000000..c1237ddfc5 --- /dev/null +++ b/third_party/rust/thiserror-impl/src/span.rs @@ -0,0 +1,15 @@ +use proc_macro2::Span; +use syn::Member; + +pub trait MemberSpan { + fn member_span(&self) -> Span; +} + +impl MemberSpan for Member { + fn member_span(&self) -> Span { + match self { + Member::Named(ident) => ident.span(), + Member::Unnamed(index) => index.span, + } + } +} |