diff options
| author | Michael Goulet <michael@errs.io> | 2023-05-03 23:53:44 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-05-08 03:34:46 +0000 |
| commit | a156bd771457110415b1eec74cf52c9502d461a3 (patch) | |
| tree | eefcd36e3289030d0c1589b36d78a60795d3a543 /compiler/rustc_macros/src/diagnostics/utils.rs | |
| parent | 2b9279f3131056a1a1dd5de7513de4eb98987770 (diff) | |
| download | rust-a156bd771457110415b1eec74cf52c9502d461a3.tar.gz rust-a156bd771457110415b1eec74cf52c9502d461a3.zip | |
Make spans a bit better
Diffstat (limited to 'compiler/rustc_macros/src/diagnostics/utils.rs')
| -rw-r--r-- | compiler/rustc_macros/src/diagnostics/utils.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_macros/src/diagnostics/utils.rs b/compiler/rustc_macros/src/diagnostics/utils.rs index bc97e39bebd..e2434981f8d 100644 --- a/compiler/rustc_macros/src/diagnostics/utils.rs +++ b/compiler/rustc_macros/src/diagnostics/utils.rs @@ -207,6 +207,12 @@ impl<'ty> FieldInnerTy<'ty> { FieldInnerTy::Plain(..) => quote! { #inner }, } } + + pub fn span(&self) -> proc_macro2::Span { + match self { + FieldInnerTy::Option(ty) | FieldInnerTy::Vec(ty) | FieldInnerTy::Plain(ty) => ty.span(), + } + } } /// Field information passed to the builder. Deliberately omits attrs to discourage the |
