Uh oh!
There was an error while loading. Please reload this page.
rustdoc: Fix cosmetic issues when reporting unresolved paths in broken_intra_doc_links - #156022
Conversation
- Add a check while trying to resolve parents, so that for links like [`::unresolved::path`], rustdoc will say: "no item named `unresolved` in scope" instead of: "no item named `` in scope" - Update corresponding test
rustbot
commented
May 1, 2026
rustbot has assigned @lolbinarycat. Use Why was this reviewer chosen?The reviewer was selected based on:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
rustbot
commented
May 8, 2026
Reminder, once the PR becomes ready for a review, use |
- Check whether an unresolved path is in fact invalid. This prevents rustdoc from emitting nonsensical diagnostics like: - "no item named `std:` in scope" - "no item named `` in scope" Instead rustdoc will now say "has invalid path separator" (the same message from `MalformedGenerics::InvalidPathSeparator`) This is done by checking whether each path segment is empty or contains extra ":" after it's been split by the path separator "::". - Add a dedicated test `tests/rustdoc-ui/intra-doc/invalid-path-separator.rs` for this. - Some unrelated test snapshots have been updated because of this new check.
Uh oh!
There was an error while loading. Please reload this page.
Replace a hardcoded constant with `mem::variant_count` to keep in-sync with the `ResolutionFailure` enum.
Uh oh!
There was an error while loading. Please reload this page.
tonywu6
commented
May 11, 2026
@rustbot ready |
lolbinarycat
commented
May 11, 2026
@bors r+ rollup Thanks! |
rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links` Fix some minor issues with how the `rustdoc::broken_intra_doc_links` lint labels unresolved items: - [`a469a4a`] For unresolved "extern prelude" links like `::unresolved::item` - Previously: ```no item named `` in scope``` - Now: ```no item named `unresolved` in scope``` - [`eeb96fa`] Some malformed paths are now accounted for, for example: - `std:::path` - Previously: ```no item named `std:` in scope``` - Now: `has invalid path separator` - `std::::path` - Previously: ```no item named `` in scope``` - Now: `has invalid path separator` This PR is broken down into a few commits with their own descriptions, which I hope makes reviewing easier! Fixesrust-lang#141095 [`a469a4a`]: rust-lang@a469a4a [`eeb96fa`]: rust-lang@eeb96fa
…uwer Rollup of 11 pull requests Successful merges: - #156448 (miri subtree update) - #155023 (Introduce move expressions (`move($expr)`) ) - #156429 (Simplify `intrinsic::raw_eq` in MIR when possible) - #147672 (LLBC-linker: Do not strip debug symbols for the nvptx target anymore) - #155169 (jsondoclint: simplify code using idiomatic Rust) - #155184 ( Have arrays' `drop_glue` just unsize and call the slice version) - #156022 (rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links`) - #156442 (Show intrinsics::gpu in docs) - #156461 (LLVM 23: Specify `returnaddress` intrinsic return type) - #156462 (LLVM 23: Accept float (instead of hex) literals in codegen tests) - #156466 (Refactor `CheckAttrVisitor` so rustfmt can format it.)
Uh oh!
There was an error while loading. Please reload this page.
Rollup merge of #156022 - tonywu6:main, r=lolbinarycat rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links` Fix some minor issues with how the `rustdoc::broken_intra_doc_links` lint labels unresolved items: - [`a469a4a`] For unresolved "extern prelude" links like `::unresolved::item` - Previously: ```no item named `` in scope``` - Now: ```no item named `unresolved` in scope``` - [`eeb96fa`] Some malformed paths are now accounted for, for example: - `std:::path` - Previously: ```no item named `std:` in scope``` - Now: `has invalid path separator` - `std::::path` - Previously: ```no item named `` in scope``` - Now: `has invalid path separator` This PR is broken down into a few commits with their own descriptions, which I hope makes reviewing easier! Fixes#141095 [`a469a4a`]: a469a4a [`eeb96fa`]: eeb96fa
…uwer Rollup of 11 pull requests Successful merges: - rust-lang/rust#156448 (miri subtree update) - rust-lang/rust#155023 (Introduce move expressions (`move($expr)`) ) - rust-lang/rust#156429 (Simplify `intrinsic::raw_eq` in MIR when possible) - rust-lang/rust#147672 (LLBC-linker: Do not strip debug symbols for the nvptx target anymore) - rust-lang/rust#155169 (jsondoclint: simplify code using idiomatic Rust) - rust-lang/rust#155184 ( Have arrays' `drop_glue` just unsize and call the slice version) - rust-lang/rust#156022 (rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links`) - rust-lang/rust#156442 (Show intrinsics::gpu in docs) - rust-lang/rust#156461 (LLVM 23: Specify `returnaddress` intrinsic return type) - rust-lang/rust#156462 (LLVM 23: Accept float (instead of hex) literals in codegen tests) - rust-lang/rust#156466 (Refactor `CheckAttrVisitor` so rustfmt can format it.)
…uwer Rollup of 11 pull requests Successful merges: - rust-lang/rust#156448 (miri subtree update) - rust-lang/rust#155023 (Introduce move expressions (`move($expr)`) ) - rust-lang/rust#156429 (Simplify `intrinsic::raw_eq` in MIR when possible) - rust-lang/rust#147672 (LLBC-linker: Do not strip debug symbols for the nvptx target anymore) - rust-lang/rust#155169 (jsondoclint: simplify code using idiomatic Rust) - rust-lang/rust#155184 ( Have arrays' `drop_glue` just unsize and call the slice version) - rust-lang/rust#156022 (rustdoc: Fix cosmetic issues when reporting unresolved paths in `broken_intra_doc_links`) - rust-lang/rust#156442 (Show intrinsics::gpu in docs) - rust-lang/rust#156461 (LLVM 23: Specify `returnaddress` intrinsic return type) - rust-lang/rust#156462 (LLVM 23: Accept float (instead of hex) literals in codegen tests) - rust-lang/rust#156466 (Refactor `CheckAttrVisitor` so rustfmt can format it.)
Fix some minor issues with how the
rustdoc::broken_intra_doc_linkslint labels unresolved items:a469a4aFor unresolved "extern prelude" links like::unresolved::itemno item named `` in scopeno item named `unresolved` in scopeeeb96faSome malformed paths are now accounted for, for example:std:::pathno item named `std:` in scopehas invalid path separatorstd::::pathno item named `` in scopehas invalid path separatorThis PR is broken down into a few commits with their own descriptions, which I hope makes reviewing easier!
Fixes#141095