-
Notifications
You must be signed in to change notification settings - Fork 13.5k
rustdoc: never link to unnamable items #143849
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
base: master
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
pub trait Assoc { | ||
type Ty; | ||
} | ||
|
||
pub struct Foo(<Foo as crate::Assoc>::Ty); | ||
|
||
const _X: () = { | ||
impl crate::Assoc for Foo { | ||
type Ty = Bar; | ||
} | ||
pub struct Bar; | ||
}; | ||
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. Do we need to have this as a dependency for this test? Can't it be done within the current crate? 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. Also, what happens if the const is named 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. The bug only happens during cross-crate re-exports. Otherwise a separate failsafe kicks in. I was under the impression that the 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. Ok, yeah, you're right, my assumptions were wrong. Just looking at the path isn't enough. 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. Need to check what kind of item (block more precisely) the parent is. If it's not a module, then it's likely wrong. 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. any idea what datastructure would retain that info in the cross-crate case? I'm somewhat struggling to understand how we even reconstruct path info and such from an rlib. 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. Path doesn't matter here, you need to check what is its parent. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//@ compile-flags: -Z normalize-docs --document-private-items -Zunstable-options --show-type-layout | ||
//@ aux-build:wrap-unnamable-type.rs | ||
//@ build-aux-docs | ||
|
||
// regression test for https://github.com/rust-lang/rust/issues/143222 | ||
// makes sure normalizing docs does not cause us to link to unnamable types | ||
// in cross-crate reexports. | ||
|
||
#![crate_name = "foo"] | ||
|
||
extern crate wrap_unnamable_type as helper; | ||
|
||
//@ has 'foo/struct.Foo.html' | ||
//@ !hasraw - 'struct.Bar.html' | ||
#[doc(inline)] | ||
pub use helper::Foo; |
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.
I think this code is wrong: we can link to an impl associated item even if the impl is in a const/function block.
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.
right, i think impls should break with a
return false
and only modules should continue up...well technically we can only link to an impl item if the thing being impl'd on is nameable, but i'm not sure if that's something observable.
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.
Just discovered that we can have modules in any blocks. Dark magic. XD
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.
Also, if the item is not public, it'll be stripped so should be fine. (for impl block as parents)