Look at proc-macro attributes when encountering unknown attribute#109278
Look at proc-macro attributes when encountering unknown attribute#109278estebank wants to merge 2 commits intorust-lang:masterfrom
Conversation
|
r? @TaKO8Ki (rustbot has picked a reviewer for you, use r? to override) |
This comment was marked as outdated.
This comment was marked as outdated.
7c116fc to
51fbd0a
Compare
This comment has been minimized.
This comment has been minimized.
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
r? compiler |
|
The PR is large and does multiple unrelated things. Could you first move the emitter change ("show one more line") to a separate PR for someone else to review? |
``` error: cannot find attribute `sede` in this scope --> src/main.rs:18:7 | 18 | #[sede(untagged)] | ^^^^ | help: the derive macros `Serialize` and `Deserialize` accept the similarly named `serde` attribute | 18 | #[serde(untagged)] | ~~~~~ error: cannot find attribute `serde` in this scope --> src/main.rs:12:7 | 12 | #[serde(untagged)] | ^^^^^ | = note: `serde` is in scope, but it is a crate, not an attribute help: `serde` is an attribute that can be used by the derive macros `Serialize` and `Deserialize`, you might be missing a `derive` attribute | 10 | #[derive(Serialize, Deserialize)] | ``` Mitigate rust-lang#47608.
|
Moved last commit to #109786. |
This comment has been minimized.
This comment has been minimized.
| /// Visit every module reachable from `start_module` and bring any proc and derive macro | ||
| /// encountered into `self.macro_map` to be used for suggestions. | ||
| fn lookup_macros_from_module(&mut self) { |
There was a problem hiding this comment.
This is so that the case in tests/ui/macros/missing-derive-4.rs (use serde;, but no use serde::Serialize;) is handled.
|
|
||
| /// Visit every module reachable from `start_module` and bring any proc and derive macro | ||
| /// encountered into `self.macro_map` to be used for suggestions. | ||
| fn lookup_macros_from_module(&mut self) { |
There was a problem hiding this comment.
How is this different from lookup_import_candidates_from_module?
Only macros that would be suggested as imports (and their helper attributes) can be suggested here.
So I suggest removing this separate logic and retrieve helper attributes in the lookup_import_candidates_from_module pass if the import candidate happens to be a derive macro and helper attributes satisfy filter_fn.
Same for typo suggestions, in addition for checking any visited item for being typo-suggestable we also need to check its helper attributes for the same thing, as a part of the regular early_lookup_typo_candidate pass.
There was a problem hiding this comment.
I suggest landing the core change first - extending the set of regular import and typo suggestions with helper attributes, and leave all the beautifications for later.
|
☔ The latest upstream changes (presumably #110579) made this pull request unmergeable. Please resolve the merge conflicts. |
Fix #47608.