forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#73101 - jyn514:rustdoc-absolute-module, r=M…
…anishearth Resolve items for cross-crate imports relative to the original module ~~Blocked on rust-lang#73103 and rust-lang#73566 Closes rust-lang#65983. I tested on the following code (as mentioned in rust-lang#65983 (comment)): ``` pub use rand::Rng; ``` and rustdoc generated the following link: https://rust-random.github.io/rand/rand_core/trait.RngCore.html
- Loading branch information
Showing
21 changed files
with
233 additions
and
48 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// aux-build:additional_doc.rs | ||
// build-aux-docs | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
extern crate my_rand; | ||
|
||
// @has 'additional_doc/trait.Rng.html' '//a[@href="../additional_doc/trait.Rng.html"]' 'Rng' | ||
// @has 'additional_doc/trait.Rng.html' '//a[@href="../my_rand/trait.RngCore.html"]' 'RngCore' | ||
/// This is an [`Rng`]. | ||
pub use my_rand::Rng; |
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,6 @@ | ||
#![crate_name = "my_rand"] | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
pub trait RngCore {} | ||
/// Rng extends [`RngCore`]. | ||
pub trait Rng: RngCore {} |
7 changes: 7 additions & 0 deletions
7
src/test/rustdoc/intra-doc-crate/auxiliary/intra-doc-basic.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,7 @@ | ||
#![crate_name = "a"] | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
pub struct Foo; | ||
|
||
/// Link to [Foo] | ||
pub struct Bar; |
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,10 @@ | ||
#![crate_name = "macro_inner"] | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
pub struct Foo; | ||
|
||
/// See also [`Foo`] | ||
#[macro_export] | ||
macro_rules! my_macro { | ||
() => {} | ||
} |
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,7 @@ | ||
#![crate_name = "module_inner"] | ||
#![deny(intra_doc_link_resolution_failure)] | ||
/// [SomeType] links to [bar] | ||
pub struct SomeType; | ||
pub trait SomeTrait {} | ||
/// [bar] links to [SomeTrait] and also [SomeType] | ||
pub mod bar {} |
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,20 @@ | ||
// force-host | ||
// no-prefer-dynamic | ||
// compile-flags: --crate-type proc-macro | ||
#![crate_type="proc-macro"] | ||
#![crate_name="proc_macro_inner"] | ||
|
||
extern crate proc_macro; | ||
|
||
use proc_macro::TokenStream; | ||
|
||
/// Links to [`OtherDerive`] | ||
#[proc_macro_derive(DeriveA)] | ||
pub fn a_derive(input: TokenStream) -> TokenStream { | ||
input | ||
} | ||
|
||
#[proc_macro_derive(OtherDerive)] | ||
pub fn other_derive(input: TokenStream) -> TokenStream { | ||
input | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/rustdoc/intra-doc-crate/auxiliary/submodule-inner.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,12 @@ | ||
#![crate_name = "a"] | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
pub mod bar { | ||
pub struct Bar; | ||
} | ||
|
||
pub mod foo { | ||
use crate::bar; | ||
/// link to [bar::Bar] | ||
pub struct Foo; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/test/rustdoc/intra-doc-crate/auxiliary/submodule-outer.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,13 @@ | ||
#![crate_name = "bar"] | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
pub trait Foo { | ||
/// [`Bar`] [`Baz`] | ||
fn foo(); | ||
} | ||
|
||
pub trait Bar { | ||
} | ||
|
||
pub trait Baz { | ||
} |
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,16 @@ | ||
#![crate_name = "inner"] | ||
/// this is a trait | ||
pub trait SomeTrait { | ||
/// this is a method for [a trait][SomeTrait] | ||
fn foo(); | ||
} | ||
|
||
pub mod bar { | ||
use super::SomeTrait; | ||
|
||
pub struct BarStruct; | ||
|
||
impl SomeTrait for BarStruct { | ||
fn foo() {} | ||
} | ||
} |
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,9 @@ | ||
// aux-build:intra-doc-basic.rs | ||
// build-aux-docs | ||
#![deny(intra_doc_link_resolution_failure)] | ||
|
||
// from https://github.com/rust-lang/rust/issues/65983 | ||
extern crate a; | ||
|
||
// @has 'basic/struct.Bar.html' '//a[@href="../a/struct.Foo.html"]' 'Foo' | ||
pub use a::Bar; |
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,12 @@ | ||
// ignore-tidy-linelength | ||
// aux-build:macro_inner.rs | ||
// aux-build:proc_macro.rs | ||
// build-aux-docs | ||
#![deny(intra_doc_link_resolution_failure)] | ||
extern crate macro_inner; | ||
extern crate proc_macro_inner; | ||
|
||
// @has 'macro/macro.my_macro.html' '//a[@href="../macro_inner/struct.Foo.html"]' 'Foo' | ||
pub use macro_inner::my_macro; | ||
// @has 'macro/derive.DeriveA.html' '//a[@href="../proc_macro_inner/derive.OtherDerive.html"]' 'OtherDerive' | ||
pub use proc_macro_inner::DeriveA; |
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 @@ | ||
// outer.rs | ||
// aux-build: module.rs | ||
// build-aux-docs | ||
#![deny(intra_doc_link_resolution_failure)] | ||
extern crate module_inner; | ||
// @has 'module/bar/index.html' '//a[@href="../../module_inner/trait.SomeTrait.html"]' 'SomeTrait' | ||
// @has 'module/bar/index.html' '//a[@href="../../module_inner/struct.SomeType.html"]' 'SomeType' | ||
pub use module_inner::bar; |
Oops, something went wrong.