Allow Clippy to define duplicate extra symbols#143596
Allow Clippy to define duplicate extra symbols#143596Alexendoo wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
r? @fee1-dead rustbot has assigned @fee1-dead. Use |
|
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
This comment has been minimized.
This comment has been minimized.
393f4ae to
aebfd04
Compare
|
This seems to be quite above my personal threshold for the compiler to maintain and support this, since it isn't a mechanism used by the compiler itself. Do you think there could be an easier solution here? For example, rustc may expose the number of symbols, then clippy could scan the rustc list (either the file itself, or exposed through a constant) to error at compile time if there is a duplicate symbol. Or clippy could use a |
|
☔ The latest upstream changes (presumably #144449) made this pull request unmergeable. Please resolve the merge conflicts. |
|
An update on this:
This works with the new const In the meanwhile #146347 improves the runtime error |
Fixes #142410 (comment)
rustc_macros::symbolsnow also expands to a macroextra_symbolsthat callsrustc_macros::extra_symbols_implwith the prefill stream so that it can know which symbols are duplicatedextra_symbolsallows supplying a name to define a macro to provide even more extra symbols, this is useful for external drivers that rely onclippy_utilse.g. TheBevyFlock/bevy_cli#456There's a usage example in
compiler/rustc_span/src/symbol/tests.rsDUPLICATE_SYMBOLSis currently unused, but we can use it on the clippy side to remove duplicates without interfering withr-l/rustPRs