Skip to content

Commit 07e7d99

Browse files
committed
Add "in this derive macro expansion" to missing Display errors
1 parent 714229d commit 07e7d99

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

impl/src/expand.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ fn impl_enum(input: Enum) -> TokenStream {
496496
// deprecated type without triggering deprecation warning on the generated impl.
497497
fn call_site_ident(ident: &Ident) -> Ident {
498498
let mut ident = ident.clone();
499-
ident.set_span(Span::call_site());
499+
ident.set_span(ident.span().resolved_at(Span::call_site()));
500500
ident
501501
}
502502

tests/ui/missing-display.stderr

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
error[E0277]: `MyError` doesn't implement `std::fmt::Display`
2-
--> tests/ui/missing-display.rs:3:10
2+
--> tests/ui/missing-display.rs:4:10
33
|
44
3 | #[derive(Error, Debug)]
5-
| ^^^^^ `MyError` cannot be formatted with the default formatter
5+
| ----- in this derive macro expansion
6+
4 | pub enum MyError {
7+
| ^^^^^^^ `MyError` cannot be formatted with the default formatter
68
|
79
= help: the trait `std::fmt::Display` is not implemented for `MyError`
810
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead

0 commit comments

Comments
 (0)