-
Notifications
You must be signed in to change notification settings - Fork 13.8k
fix dead link for method in trait of blanket impl from third party crate #86662
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 all commits
53447d8
fc97fbe
afb5b21
441a350
a75e629
c6ae96d
450c28a
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 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -472,15 +472,27 @@ impl clean::GenericArgs { | |||||||||||||
} | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
crate fn href(did: DefId, cx: &Context<'_>) -> Option<(String, ItemType, Vec<String>)> { | ||||||||||||||
// Possible errors when computing href link source for a `DefId` | ||||||||||||||
crate enum HrefError { | ||||||||||||||
/// This item is known to rustdoc, but from a crate that does not have documentation generated. | ||||||||||||||
/// | ||||||||||||||
/// This can only happen for non-local items. | ||||||||||||||
DocumentationNotBuilt, | ||||||||||||||
/// This can only happen for non-local items when `--document-private-items` is not passed. | ||||||||||||||
Private, | ||||||||||||||
// Not in external cache, href link should be in same page | ||||||||||||||
NotInExternalCache, | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
crate fn href(did: DefId, cx: &Context<'_>) -> Result<(String, ItemType, Vec<String>), HrefError> { | ||||||||||||||
let cache = &cx.cache(); | ||||||||||||||
let relative_to = &cx.current; | ||||||||||||||
fn to_module_fqp(shortty: ItemType, fqp: &[String]) -> &[String] { | ||||||||||||||
if shortty == ItemType::Module { &fqp[..] } else { &fqp[..fqp.len() - 1] } | ||||||||||||||
} | ||||||||||||||
|
||||||||||||||
if !did.is_local() && !cache.access_levels.is_public(did) && !cache.document_private { | ||||||||||||||
|
if !did.is_local() && !cache.access_levels.is_public(did) && !cache.document_private { | |
if did.is_local() { | |
// Private items should have already been stripped. | |
assert!(cache.access_levels.is_public(did) || cache.document_private); | |
} | |
if !cache.access_levels.is_public(did) && !cache.document_private { |
(I know this is unrelated to your change - I can make a separate PR for this if you like.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
adding this assert made the following tests fail:
failures:
[rustdoc] rustdoc/all.rs
[rustdoc] rustdoc/async-fn.rs
[rustdoc] rustdoc/blanket-reexport-item.rs
[rustdoc] rustdoc/impl-trait-alias.rs
[rustdoc] rustdoc/inline_cross/renamed-via-module.rs
[rustdoc] rustdoc/inline_local/glob-private-no-defaults.rs
[rustdoc] rustdoc/inline_local/glob-private.rs
[rustdoc] rustdoc/inline_local/issue-28537.rs
[rustdoc] rustdoc/inline_local/issue-32343.rs
[rustdoc] rustdoc/inline_local/trait-vis.rs
[rustdoc] rustdoc/intra-doc/cross-crate/hidden.rs
[rustdoc] rustdoc/issue-34473.rs
[rustdoc] rustdoc/issue-35488.rs
[rustdoc] rustdoc/issue-46767.rs
[rustdoc] rustdoc/namespaces.rs
[rustdoc] rustdoc/redirect-map.rs
[rustdoc] rustdoc/redirect-rename.rs
[rustdoc] rustdoc/redirect.rs
[rustdoc] rustdoc/search-index.rs
[rustdoc] rustdoc/struct-arg-pattern.rs
[rustdoc] rustdoc/synthetic_auto/complex.rs
[rustdoc] rustdoc/synthetic_auto/project.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahhhh of course it did :( I'll open an issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I was just confused: the proper assert is
assert!(cache.access_levels.is_public(did) || cache.document_private || cache.paths.get(&did).is_none(), "{:?}", did);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, there was a bug after all: #87048
jyn514 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![crate_name = "issue_86620_1"] | ||
|
||
pub trait VZip { | ||
fn vzip() -> usize; | ||
} | ||
|
||
impl<T> VZip for T { | ||
fn vzip() -> usize { | ||
0 | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// aux-build:issue-86620-1.rs | ||
|
||
extern crate issue_86620_1; | ||
|
||
use issue_86620_1::*; | ||
|
||
// @!has issue_86620/struct.S.html '//div[@id="method.vzip"]//a[@class="fnname"]/@href' #tymethod.vzip | ||
// @has issue_86620/struct.S.html '//div[@id="method.vzip"]//a[@class="anchor"]/@href' #method.vzip | ||
pub struct S; |
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would help quite a lot with #82014 I think :) good idea.
(So I remember: the perma-link for this is 8f19606)