-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
[rustdoc-json] JSON no longer inlines #93518
Closed
CraftSpider
wants to merge
2
commits into
rust-lang:master
from
CraftSpider:rustdoc-json-double-export
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 @@ | ||
pub struct 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
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 |
---|---|---|
@@ -1,15 +1,16 @@ | ||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
// @is in_root_and_mod.json "$.index[*][?(@.name=='foo')].kind" \"stripped_module\" | ||
mod foo { | ||
// @set foo_id = in_root_and_mod.json "$.index[*][?(@.name=='Foo')].id" | ||
// @has - "$.index[*][?(@.name=='Foo')]" | ||
pub struct Foo; | ||
} | ||
|
||
// @has - "$.index[*][?(@.name=='in_root_and_mod')].inner.items[*]" $foo_id | ||
// @has - "$.index[*][?(@.kind=='import' && @.inner.source=='foo::Foo')]" | ||
pub use foo::Foo; | ||
|
||
pub mod bar { | ||
// @has - "$.index[*][?(@.name=='bar')].inner.items[*]" $foo_id | ||
// @has - "$.index[*][?(@.kind=='import' && @.inner.source=='crate::foo::Foo')]" | ||
pub use crate::foo::Foo; | ||
} |
18 changes: 18 additions & 0 deletions
18
src/test/rustdoc-json/reexport/private_twice_one_inline.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,18 @@ | ||
// aux-build:pub-struct.rs | ||
|
||
// Test for the ICE in rust/83057 | ||
// Am external type re-exported with different attributes shouldn't cause an error | ||
|
||
#![no_core] | ||
#![feature(no_core)] | ||
|
||
extern crate pub_struct as foo; | ||
|
||
#[doc(inline)] | ||
pub use foo::Foo; | ||
|
||
pub mod bar { | ||
pub use foo::Foo; | ||
} | ||
|
||
// @count private_twice_one_inline.json "$.index[*][?(@.kind=='import')]" 2 |
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 @@ | ||
// Test for the ICE in rust/83720 | ||
// A pub-in-private type re-exported under two different names shouldn't cause an error | ||
|
||
#![no_core] | ||
#![feature(no_core)] | ||
|
||
// @is private_two_names.json "$.index[*][?(@.name=='style')].kind" \"stripped_module\" | ||
mod style { | ||
// @has - "$.index[*](?(@.name=='Color'))" | ||
pub struct Color; | ||
} | ||
|
||
// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='Color')]" | ||
pub use style::Color; | ||
// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')]" | ||
pub use style::Color as Colour; |
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,21 @@ | ||
#![no_core] | ||
#![feature(no_core)] | ||
|
||
// @!has stripped_modules.json "$.index[*][?(@.name=='no_pub_inner')]" | ||
mod no_pub_inner { | ||
fn priv_inner() {} | ||
} | ||
|
||
// @!has - "$.index[*][?(@.name=='pub_inner_unreachable')]" | ||
mod pub_inner_unreachable { | ||
// @!has - "$.index[*][?(@.name=='pub_inner_1')]" | ||
pub fn pub_inner_1() {} | ||
} | ||
|
||
// @has - "$.index[*][?(@.name=='pub_inner_reachable')]" | ||
mod pub_inner_reachable { | ||
// @has - "$.index[*][?(@.name=='pub_inner_2')]" | ||
pub fn pub_inner_2() {} | ||
} | ||
|
||
pub use pub_inner_reachable::pub_inner_2; |
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.
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.
For symmetry with most other enum variants, most notably
Module(Module)
, this should beStrippedModule(StrippedModule)
.Another option that I find even more attractive since it removes the need for more types and enum variants is to simply add
is_stripped
tostruct Module
, so it becomes:That would be even more symmetric with existing code, since there is no
CrateModule
(which would be an alternative to having the currentis_crate
field inModule
).