-
Notifications
You must be signed in to change notification settings - Fork 13.4k
RustDoc: Fix bounds linking trait.Foo instead of traitalias.Foo #84811
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -340,6 +340,7 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> { | |
| clean::EnumItem(..) | ||
| clean::TypedefItem(..) | ||
| clean::TraitItem(..) | ||
| clean::TraitAliasItem(..) | ||
| clean::FunctionItem(..) | ||
| clean::ModuleItem(..) | ||
| clean::ForeignFunctionItem(..) | ||
|
@@ -350,26 +351,43 @@ impl<'a, 'tcx> DocFolder for CacheBuilder<'a, 'tcx> { | |
| clean::ForeignTypeItem | ||
| clean::MacroItem(..) | ||
| clean::ProcMacroItem(..) | ||
| clean::VariantItem(..) | ||
if !self.cache.stripped_mod => | ||
{ | ||
// Re-exported items mean that the same id can show up twice | ||
// in the rustdoc ast that we're looking at. We know, | ||
// however, that a re-exported item doesn't show up in the | ||
// `public_items` map, so we can skip inserting into the | ||
// paths map if there was already an entry present and we're | ||
// not a public item. | ||
if !self.cache.paths.contains_key(&item.def_id) | ||
|| self.cache.access_levels.is_public(item.def_id) | ||
{ | ||
self.cache.paths.insert(item.def_id, (self.cache.stack.clone(), item.type_())); | ||
| clean::VariantItem(..) => { | ||
if !self.cache.stripped_mod { | ||
// Re-exported items mean that the same id can show up twice | ||
// in the rustdoc ast that we're looking at. We know, | ||
// however, that a re-exported item doesn't show up in the | ||
// `public_items` map, so we can skip inserting into the | ||
// paths map if there was already an entry present and we're | ||
// not a public item. | ||
if !self.cache.paths.contains_key(&item.def_id) | ||
|| self.cache.access_levels.is_public(item.def_id) | ||
{ | ||
self.cache | ||
.paths | ||
.insert(item.def_id, (self.cache.stack.clone(), item.type_())); | ||
} | ||
} | ||
} | ||
clean::PrimitiveItem(..) => { | ||
self.cache.paths.insert(item.def_id, (self.cache.stack.clone(), item.type_())); | ||
} | ||
|
||
_ => {} | ||
clean::ExternCrateItem { .. } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| clean::ImportItem(..) | ||
| clean::OpaqueTyItem(..) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, is this one TAIT? I would have guessed https://doc.rust-lang.org/nightly/unstable-book/language-features/extern-types.html But overall, I'd like to leave the match as-is for this PR, if that's ok. Then someone else can audit them later and move them to different sections with comments about why they're ok to be skipped, or whatever. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, that seems good to me. |
||
| clean::ImplItem(..) | ||
| clean::TyMethodItem(..) | ||
| clean::MethodItem(..) | ||
| clean::StructFieldItem(..) | ||
| clean::AssocConstItem(..) | ||
| clean::AssocTypeItem(..) | ||
| clean::StrippedItem(..) | ||
| clean::KeywordItem(..) => { | ||
// FIXME: Do these need handling? | ||
// The person writing this comment doesn't know. | ||
// So would rather leave them to an expert, | ||
// as at least the list is better than `_ => {}`. | ||
} | ||
} | ||
|
||
// Maintain the parent stack | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#![feature(trait_alias)] | ||
#![feature(ptr_metadata)] | ||
|
||
#![crate_name = "foo"] | ||
|
||
// @has foo/fn.this_never_panics.html '//a[@title="traitalias core::ptr::metadata::Thin"]' 'Thin' | ||
jyn514 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
pub fn this_never_panics<T: std::ptr::Thin>() { | ||
assert_eq!(std::mem::size_of::<&T>(), std::mem::size_of::<usize>()) | ||
} |
Uh oh!
There was an error while loading. Please reload this page.