Skip to content

[rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods - #163360

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GuillaumeGomez:primitive-incoherent-methods
Oct 2, 2026
Merged

rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
GuillaumeGomez:primitive-incoherent-methods

Conversation

@GuillaumeGomez

Copy link
Copy Markdown
Member

Needed for #162808.
First commit comes from #163133.

This is more of a hack than a proper fix as I don't think there is a better way to handle this. So in short:

  • If a primitive incoherent impl method is implemented outside of core/alloc/std, we don't link to it.
  • If in alloc/std, we link to std

r? @Urgau

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Sep 25, 2026
@rust-bors

This comment has been minimized.

@GuillaumeGomez
GuillaumeGomez force-pushed the primitive-incoherent-methods branch from 4982ff0 to 456accc Compare September 26, 2026 16:12
@rustbot

rustbot commented Sep 26, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@Urgau

Urgau commented Sep 27, 2026

Copy link
Copy Markdown
Member

Did you try using the same trick previous the previous PR by using transitive_reexport_path? or does that also leads to the wrong path?

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

It leads to alloc, which doesn't have primitive pages. Hence the big ugly hack. :')

@Urgau

Urgau commented Sep 29, 2026 •

Copy link
Copy Markdown
Member

Wait, what? []::sort is documented in core, but is defined in alloc!

Do you know why we do that?

Can't we document []::sort in alloc and avoid this ugly hack? I guess we can't do that bc there can only be one page per primitive?

@GuillaumeGomez

Copy link
Copy Markdown
Member Author

Yep. Also, to_vec is present in std and not in core (and defined in alloc). Fun times. :)

Comment thread src/librustdoc/html/format.rs
@GuillaumeGomez
GuillaumeGomez force-pushed the primitive-incoherent-methods branch from 456accc to 2599fb7 Compare October 1, 2026 11:08
Comment thread src/librustdoc/html/format.rs

@Urgau Urgau left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like it, but this seems to be the simplest way to deal with this edge-case of an unstable feature.

@bors r+ rollup

View changes since this review

@rust-bors

rust-bors Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2599fb7 has been tentatively approved by Urgau

It will be put into the queue for this repository once PR CI succeeds.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 1, 2026
@GuillaumeGomez

Copy link
Copy Markdown
Member Author

I don't like it, but this seems to be the simplest way to deal with this edge-case of an unstable feature.

Welcome to the club. :')

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Oct 1, 2026
…t-methods, r=Urgau

[rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods

Needed for rust-lang#162808.
First commit comes from rust-lang#163133.

This is more of a hack than a proper fix as I don't think there is a better way to handle this. So in short:

 * If a primitive incoherent impl method is implemented outside of `core`/`alloc`/`std`, we don't link to it.
 * If in `alloc`/`std`, we link to `std`

r? @Urgau
rust-bors Bot pushed a commit that referenced this pull request Oct 1, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #163461 (Improve diagnostic deduplication)
 - #159021 (windows-gnu: enable native TLS)
 - #161467 (wfcheck: name the item that discards an unused type parameter)
 - #162618 (trait_selection: Preserve eager normalization failures)
 - #163064 (Avoid computing overflowed goal chains for crate dependencies)
 - #163360 ([rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods)
 - #163385 (GVN transmutes of Immediate::Uninit to Immediate::Uninit)
 - #163590 (Make `AllocatorNightly` less clever)
 - #163599 (Add union pattern reference change to relnotes)
rust-bors Bot pushed a commit that referenced this pull request Oct 1, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #163483 (Bump bootstrap compiler to 1.100.0 beta)
 - #161380 (only rerun const eval in next-solver if the const actually references opaques)
 - #162900 (Some refactorings around metadata encoding)
 - #163461 (Improve diagnostic deduplication)
 - #163580 (Provide better doc code example for `UnixDatagram::bind_addr` and `UnixListener::bind_addr`)
 - #163584 ([triagebot] Ping me for debugger visualizer changes)
 - #159021 (windows-gnu: enable native TLS)
 - #161467 (wfcheck: name the item that discards an unused type parameter)
 - #162618 (trait_selection: Preserve eager normalization failures)
 - #162904 (Fix ICE for ambiguous candidates on method probing)
 - #163064 (Avoid computing overflowed goal chains for crate dependencies)
 - #163281 (Add `f16` inline ASM support to `spirv.rs`)
 - #163314 (move `#[macro_export]` on declarative macro check to `rustc_attr_parsing`)
 - #163360 ([rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods)
 - #163385 (GVN transmutes of Immediate::Uninit to Immediate::Uninit)
 - #163405 (Remove some #[linkage] options)
 - #163530 (`const impl PartialEq` for `f16b`)
 - #163581 (do not suggest precise capturing when the opaque span is in a macro expansion)
 - #163590 (Make `AllocatorNightly` less clever)
 - #163599 (Add union pattern reference change to relnotes)
rust-bors Bot pushed a commit that referenced this pull request Oct 1, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #163483 (Bump bootstrap compiler to 1.100.0 beta)
 - #161380 (only rerun const eval in next-solver if the const actually references opaques)
 - #162900 (Some refactorings around metadata encoding)
 - #163461 (Improve diagnostic deduplication)
 - #163580 (Provide better doc code example for `UnixDatagram::bind_addr` and `UnixListener::bind_addr`)
 - #163584 ([triagebot] Ping me for debugger visualizer changes)
 - #159021 (windows-gnu: enable native TLS)
 - #161467 (wfcheck: name the item that discards an unused type parameter)
 - #162618 (trait_selection: Preserve eager normalization failures)
 - #162904 (Fix ICE for ambiguous candidates on method probing)
 - #163064 (Avoid computing overflowed goal chains for crate dependencies)
 - #163281 (Add `f16` inline ASM support to `spirv.rs`)
 - #163314 (move `#[macro_export]` on declarative macro check to `rustc_attr_parsing`)
 - #163360 ([rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods)
 - #163385 (GVN transmutes of Immediate::Uninit to Immediate::Uninit)
 - #163405 (Remove some #[linkage] options)
 - #163530 (`const impl PartialEq` for `f16b`)
 - #163581 (do not suggest precise capturing when the opaque span is in a macro expansion)
 - #163590 (Make `AllocatorNightly` less clever)
 - #163599 (Add union pattern reference change to relnotes)
rust-bors Bot pushed a commit that referenced this pull request Oct 2, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #163483 (Bump bootstrap compiler to 1.100.0 beta)
 - #161380 (only rerun const eval in next-solver if the const actually references opaques)
 - #162900 (Some refactorings around metadata encoding)
 - #163461 (Improve diagnostic deduplication)
 - #163580 (Provide better doc code example for `UnixDatagram::bind_addr` and `UnixListener::bind_addr`)
 - #163584 ([triagebot] Ping me for debugger visualizer changes)
 - #159021 (windows-gnu: enable native TLS)
 - #161467 (wfcheck: name the item that discards an unused type parameter)
 - #162618 (trait_selection: Preserve eager normalization failures)
 - #162904 (Fix ICE for ambiguous candidates on method probing)
 - #163064 (Avoid computing overflowed goal chains for crate dependencies)
 - #163281 (Add `f16` inline ASM support to `spirv.rs`)
 - #163314 (move `#[macro_export]` on declarative macro check to `rustc_attr_parsing`)
 - #163360 ([rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods)
 - #163385 (GVN transmutes of Immediate::Uninit to Immediate::Uninit)
 - #163405 (Remove some #[linkage] options)
 - #163530 (`const impl PartialEq` for `f16b`)
 - #163581 (do not suggest precise capturing when the opaque span is in a macro expansion)
 - #163590 (Make `AllocatorNightly` less clever)
 - #163599 (Add union pattern reference change to relnotes)
@rust-bors
rust-bors Bot merged commit 038dfe6 into rust-lang:main Oct 2, 2026
14 checks passed
@rustbot rustbot added this to the 1.101.0 milestone Oct 2, 2026
rust-bors Bot pushed a commit that referenced this pull request Oct 2, 2026
Rollup merge of #163360 - GuillaumeGomez:primitive-incoherent-methods, r=Urgau

[rustdoc] Correctly handle rustc_allow_incoherent_impl on primitive methods

Needed for #162808.
First commit comes from #163133.

This is more of a hack than a proper fix as I don't think there is a better way to handle this. So in short:

 * If a primitive incoherent impl method is implemented outside of `core`/`alloc`/`std`, we don't link to it.
 * If in `alloc`/`std`, we link to `std`

r? @Urgau
@GuillaumeGomez
GuillaumeGomez deleted the primitive-incoherent-methods branch October 2, 2026 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants