-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Updated error message for accidental uses of derive attribute as a crate attribute #89701
Conversation
r? @oli-obk (rust-highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
e770989
to
5b5362a
Compare
The issue is not about #![test] // error: cannot determine resolution for the attribute macro `test`
fn main() {} and we certainly shouldn't hardcode the list of standard library macros in the compiler. It is reported as a resolution error because it is a resolution error - we see some resolution candidate for the macro in the prelude, but we are not sure that it's the definitive result and at the same time cannot make any further progress either. |
Great thank you for taking a look at this! I thought it might be the wrong way to go about it honestly and would prefer to be able to give more concrete advice on the resolution error so I'm happy to close this out. Obviously I'll look out for any fixes you might implement so I can learn from it, please do let me know in the meantime if I can help out! |
This comment has been minimized.
This comment has been minimized.
Blocked on #91313. |
I don't think this is the right fix for |
281d399
to
9876569
Compare
No longer relying on BytePos to generate the replacement suggestion - the resolution error is still there but I'm not sure exactly what's causing that and I believe you are working on it. I think this is more of a stopgap personally and if it would be better to fix it another way it may not even be worth changing but take a look and let me know what you think! |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
ccc393b
to
262c254
Compare
262c254
to
64d61d5
Compare
This comment has been minimized.
This comment has been minimized.
64d61d5
to
dd7b075
Compare
This comment has been minimized.
This comment has been minimized.
tidy run update invalid crate attributes, improve error update test outputs de-capitalise error update tests Update invalid crate attributes, add help message Update - generate span without using BytePos Add correct dependancies Update - generate suggestion without BytePos Tidy run update tests Generate Suggestion without BytePos Add all builtin attributes add err builtin inner attr at top of crate fix tests add err builtin inner attr at top of crate tidy fix add err builtin inner attr at top of crate
dd7b075
to
3827b64
Compare
@bors r+ |
📌 Commit 3827b64 has been approved by |
…askrgr Rollup of 3 pull requests Successful merges: - rust-lang#87054 (Add a `try_reduce` method to the Iterator trait) - rust-lang#89701 (Updated error message for accidental uses of derive attribute as a crate attribute) - rust-lang#90519 (Keep spans for generics in `#[derive(_)]` desugaring) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This partially fixes the original issue #89566 by adding derive to the list of invalid crate attributes and then providing an updated error message however I'm not sure how to prevent the resolution error message from emitting without causing the compiler to just abort when it finds an invalid crate attribute (which I'd prefer not to do so we can find and emit other errors).
@petrochenkov I have been told you may have some insight on why it's emitting the resolution error though honestly I'm not sure if we need to worry about fixing it as long as we can provide the invalid crate attribute error also (which happens first anyway)