-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Some macro errors now include file names into the standard library (JSON). #70396
Comments
pre-triage: prioritized as @Centril should we assign to you?. |
Let's not assign it to me, but let's cc @eddyb and @petrochenkov :) |
This is #53486, maybe we should prioritize it?
I hope not, it was always a hack that we've been wanting to get rid for years (#49511) and even used to be even more useless (e.g. We shouldn't treat this as a regression unless we have some evidence of misuse in the wild. |
Hmm, I'm pretty sure that I've seen paths like this before #66364, but probably in debuginfo rather than in spans. It still seems to be better than no paths at all because some tools have an option to remap paths like this to a different directory with actual sources, or |
Just a quick perusal of projects:
I imagine there are others. I wouldn't call it "misuse". It is how stable rustc behaves, and tools have to deal with it. The immediate issue for me, is that I need to find the invocation site. It was previously easy to skip over the Nor do I understand under which scenarios this happens. If someone could explain in clear terms what the change is, that would be helpful. I can probably update the documentation if this really is a permanent change. It was also useful for emitting the message "this error originates in a macro outside of the current crate", but now I don't see a way to detect that? Regardless, this is a breaking change. I'm not so sensitive about them, I can adapt, but it will likely have some impact on other projects, too. |
hmm I wonder if we should bump the priority to |
(I want to push back on the notion of "breaking change" here, as it is typically associated with "you broke some stability guarantees", which isn't the case here AFAIK, and it would be pretty dangerous if we would have given such guarantees. That said, it would be nice to make more robust improvements here, but I agree with @petrochenkov re. "better than nothing".) For now I think P-medium is appropriate. |
Isn't that what the macro backtrace is for?
The change is that the No tools should've relied on Paths starting with e.g.
"crate" is likely the wrong granularity here, if you have the ability you should probably do this for "outside of the current workspace" instead. |
I think the resolution here is that I'll wait for #70642 to land, and then I'll send a PR to update the documentation. I think at a minimum this should be included in the release notes. It would be nice to try to communicate this to tool developers, but I don't know if there is a single way to do that, maybe an internals post? |
The error message for the following has changed so that that JSON spans include file names into the standard library:
With JSON output, previously this had a span that looked like this:
Pay attention to the "file_name" field, it now includes a span that references
macros.rs
instead of<::alloc::macros::vec macros>
. There are other differences, such as missingtext
rendering. The new output is:This is a problem because the path
/rustc/38114ff16e7856f98b2b4be7ab4cd29b38bed59a
doesn't exist, so there is nothing to point to. Additionally, tools may be expecting the previous behavior of a… macros>
value in the "file_name".Note that this seems particular to using a const expression in the example above (a literal such as
3
doesn't have the same effect).This seems to have started with #66364 (cc @Centril).
rustc 1.44.0-nightly (38114ff16 2020-03-21)
The text was updated successfully, but these errors were encountered: