-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #93539 - petrochenkov:doclink, r=camelid,michaelwoerister
rustdoc: Collect traits in scope for foreign inherent impls Inherent impls can be inlined for variety of reasons (impls of reexported types, impls available through `Deref`, impls inlined for unclear reasons like in #88679 (comment)). If an impl is inlined, then doc links in its comments are resolved and we may need the set of traits that are in scope at that impl's definition point. So in this PR we simply collect traits in scope for *all* inherent impls from other crates if their `Self` type is public, which is very similar for the strategy for trait impls previously used in #88679. Fixes #93476 Fixes #88679 (comment) Fixes #88679 (comment)
- Loading branch information
Showing
5 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/test/rustdoc/intra-doc/auxiliary/extern-inherent-impl-dep.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#[derive(Clone)] | ||
pub struct PublicStruct; | ||
|
||
mod inner { | ||
use super::PublicStruct; | ||
|
||
impl PublicStruct { | ||
/// [PublicStruct::clone] | ||
pub fn method() {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Reexport of a structure with public inherent impls having doc links in their comments. The doc | ||
// link points to an associated item, so we check that traits in scope for that link are populated. | ||
|
||
// aux-build:extern-inherent-impl-dep.rs | ||
|
||
extern crate extern_inherent_impl_dep; | ||
|
||
pub use extern_inherent_impl_dep::PublicStruct; |