-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrumenting async_trait
methods drops location of compilation errors
#768
Comments
This is pretty weird. I'm CCing @nightmared, who wrote the original |
At a glance, I think that maybe this tracing/tracing-attributes/src/lib.rs Lines 231 to 237 in 7bc225a
needs to be a quote_spanned! to propagate the span of the input function, but I'm not sure --- haven't tested it or anything.
|
I fear this may be the same underlying issue as #755.
TL;DR: works in nightly, but not on stable. |
Hmm, that's interesting --- @kleimkuhler, do you have a minute to try with a nightly compiler? |
Yep it looks like this is not an error on nightly. The example I provided:
In the original situation I came across this error, it also provides the file and line number. |
In that case, this seems like a compiler bug --- we can check rust-lang/rust for issues related to spans in nested proc-macros? |
This is due to rust-lang/rust#43081, and should be fixed by rust-lang/rust#72287, rust-lang/rust#72393, rust-lang/rust#72388, or rust-lang/rust#72306 (see rust-lang/rust#43081 (comment)) |
Thanks @taiki-e! |
Closing this, since it's an upstream issue and the fix should make it to stable eventually. |
Bug Report
Version
Platform
Linux
Crates
Description
Instrumenting an
async_trait
method drops the location of compilation errors.I expected to see the following error from the above:
Instead, this is the error:
Extra details
I originally came across this error in a less minimal reproduction, but the
error had even less location details as the above.
Note that there is no file or code location mentioned!
It was unable to point at the actual
#[tracing::instrument]
attribute, and ontop of that the error ended up being in a subdirectory of the crate.
I haven't been able to reproduce that in this example.
The text was updated successfully, but these errors were encountered: