-
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
rustdoc: Special-case macro lookups less #93721
Conversation
7384636
to
8c7422c
Compare
Previously, rustdoc had 3 fallbacks it used: 1. `resolve_macro_path` 2. `all_macros` 3. `resolve_str_path_error` Ideally, it would only use `resolve_str_path_error`, to be consistent with other namespaces. Unfortunately, that doesn't consider macros that aren't defined at module scope; consider for instance ```rust { struct S; macro_rules! mac { () => {} } // `mac`'s scope starts here /// `mac` <- `resolve_str_path_error` won't see this struct Z; //`mac`'s scope ends here } ``` This changes it to only use `all_macros` and `resolve_str_path_error`, and gives `resolve_str_path_error` precedence over `all_macros` in case there are two macros with the same name in the same module. This also adds a failing test case which will catch trying to remove `all_macros`.
8c7422c
to
f026550
Compare
The job Click to see the possible cause of the failure (guessed by this bot)
|
oh fun, cc @GuillaumeGomez |
The CI failure looks spurious? |
📌 Commit f026550 has been approved by |
…askrgr Rollup of 9 pull requests Successful merges: - rust-lang#86497 (Add {floor,ceil}_char_boundary methods to str) - rust-lang#92695 (Add `#[no_coverage]` tests for nested functions) - rust-lang#93521 (Fix hover effects in sidebar) - rust-lang#93568 (Include all contents of first line of scraped item in Rustdoc) - rust-lang#93569 (rustdoc: correct unclosed HTML tags as generics) - rust-lang#93672 (update comment wrt const param defaults) - rust-lang#93715 (Fix horizontal trim for block doc comments) - rust-lang#93721 (rustdoc: Special-case macro lookups less) - rust-lang#93728 (Add in ValuePair::Term) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Previously, rustdoc had 3 fallbacks it used:
resolve_macro_path
all_macros
resolve_str_path_error
Ideally, it would only use
resolve_str_path_error
, to be consistent with other namespaces.Unfortunately, that doesn't consider macros that aren't defined at module scope;
consider for instance
This changes it to only use
all_macros
andresolve_str_path_error
, and givesresolve_str_path_error
precedence overall_macros
in case there are two macros with the samename in the same module.
This is a smaller version of #91427.
r? @petrochenkov