diff --git a/impl/src/expand.rs b/impl/src/expand.rs index d657da7..52782e3 100644 --- a/impl/src/expand.rs +++ b/impl/src/expand.rs @@ -496,7 +496,7 @@ fn impl_enum(input: Enum) -> TokenStream { // deprecated type without triggering deprecation warning on the generated impl. fn call_site_ident(ident: &Ident) -> Ident { let mut ident = ident.clone(); - ident.set_span(Span::call_site()); + ident.set_span(ident.span().resolved_at(Span::call_site())); ident } diff --git a/tests/ui/missing-display.stderr b/tests/ui/missing-display.stderr index 7b55ad3..f7a044b 100644 --- a/tests/ui/missing-display.stderr +++ b/tests/ui/missing-display.stderr @@ -1,8 +1,10 @@ error[E0277]: `MyError` doesn't implement `std::fmt::Display` - --> tests/ui/missing-display.rs:3:10 + --> tests/ui/missing-display.rs:4:10 | 3 | #[derive(Error, Debug)] - | ^^^^^ `MyError` cannot be formatted with the default formatter + | ----- in this derive macro expansion +4 | pub enum MyError { + | ^^^^^^^ `MyError` cannot be formatted with the default formatter | = help: the trait `std::fmt::Display` is not implemented for `MyError` = note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead