-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #80267 - 0urobor0s:ouro/61592, r=jyn514
Rustdoc render public underscore_imports as Re-exports Fixes #61592
- Loading branch information
Showing
11 changed files
with
109 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Cannot use `doc(inline)` with anonymous imports | ||
|
||
Erroneous code example: | ||
|
||
```ignore (cannot-doctest-multicrate-project) | ||
#[doc(inline)] // error: invalid doc argument | ||
pub use foo::Foo as _; | ||
``` | ||
|
||
Anonymous imports are always rendered with `#[doc(no_inline)]`. To fix this | ||
error, remove the `#[doc(inline)]` attribute. | ||
|
||
Example: | ||
|
||
```ignore (cannot-doctest-multicrate-project) | ||
pub use foo::Foo as _; | ||
``` |
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,3 @@ | ||
#![crate_name = "foo"] | ||
|
||
pub trait 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,10 @@ | ||
// aux-build:issue-61592.rs | ||
|
||
extern crate foo; | ||
|
||
#[doc = "bar"] | ||
#[doc(inline)] //~ ERROR | ||
#[doc = "baz"] | ||
pub use foo::Foo as _; | ||
|
||
fn main() {} |
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 @@ | ||
error[E0780]: anonymous imports cannot be inlined | ||
--> $DIR/issue-61592-2.rs:6:7 | ||
| | ||
LL | #[doc(inline)] | ||
| ^^^^^^ | ||
LL | #[doc = "baz"] | ||
LL | pub use foo::Foo as _; | ||
| ---------------------- anonymous import | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0780`. |
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 @@ | ||
// aux-build:issue-61592.rs | ||
|
||
extern crate foo; | ||
|
||
#[doc(inline)] //~ ERROR | ||
pub use foo::Foo as _; | ||
|
||
fn main() {} |
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 @@ | ||
error[E0780]: anonymous imports cannot be inlined | ||
--> $DIR/issue-61592.rs:5:7 | ||
| | ||
LL | #[doc(inline)] | ||
| ^^^^^^ | ||
LL | pub use foo::Foo as _; | ||
| ---------------------- anonymous import | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0780`. |
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,4 @@ | ||
#![crate_name = "foo"] | ||
|
||
pub trait FooTrait {} | ||
pub struct FooStruct; |
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,15 @@ | ||
// aux-build:issue-61592.rs | ||
|
||
extern crate foo; | ||
|
||
// @has issue_61592/index.html | ||
// @has - '//a[@href="#reexports"]' 'Re-exports' | ||
// @has - '//code' 'pub use foo::FooTrait as _;' | ||
// @!has - '//a[@href="trait._.html"]' | ||
pub use foo::FooTrait as _; | ||
|
||
// @has issue_61592/index.html | ||
// @has - '//a[@href="#reexports"]' 'Re-exports' | ||
// @has - '//code' 'pub use foo::FooStruct as _;' | ||
// @!has - '//a[@href="struct._.html"]' | ||
pub use foo::FooStruct as _; |