Skip to content

Commit

Permalink
Document hackiness around primitive associated item disambiguators
Browse files Browse the repository at this point in the history
  • Loading branch information
max-heller committed Jan 5, 2021
1 parent 6f04133 commit 2bdbb0d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1193,6 +1193,14 @@ impl LinkCollector<'_, '_> {
match res {
Res::Primitive(_) => {
if let Some((kind, id)) = self.kind_side_channel.take() {
// We're actually resolving an associated item of a primitive, so we need to
// verify the disambiguator (if any) matches the type of the associated item.
// This case should really follow the same flow as the `Res::Def` branch below,
// but attempting to add a call to `clean::register_res` causes an ICE. @jyn514
// thinks `register_res` is only needed for cross-crate re-exports, but Rust
// doesn't allow statements like `use str::trim;`, making this a (hopefully)
// valid omission. See https://github.com/rust-lang/rust/pull/80660#discussion_r551585677
// for discussion on the matter.
verify(kind, id)?;
} else {
match disambiguator {
Expand Down

0 comments on commit 2bdbb0d

Please sign in to comment.