-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Rustdoc render public underscore_imports as Re-exports #80267
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
Closed
Closed
Changes from 5 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
799e822
Rustdoc render public underscore_imports as Re-exports
0urobor0s f502263
Improve test
0urobor0s 0c217a6
Add error code
0urobor0s d261176
Formatting
0urobor0s b3b74a9
Refactor
0urobor0s 8a4e7a7
Fix tests
0urobor0s 1990713
Fix tests
0urobor0s File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,21 @@ | ||
Cannot use `doc(inline)` with anonymous imports | ||
|
||
Erroneous code example: | ||
|
||
```compile_fail,E0780,edition2018 | ||
extern crate foo; | ||
|
||
#[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) | ||
extern crate foo; | ||
|
||
pub use foo::Foo as _; | ||
``` |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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]: inline with wildcard import | ||
--> $DIR/issue-61592.rs:5:7 | ||
| | ||
LL | #[doc(inline)] | ||
| ^^^^^^ | ||
LL | pub use foo::Foo as _; | ||
| ---------------------- wildcard import | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0780`. |
This file contains hidden or 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 hidden or 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 _; |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.