-
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.
Rollup merge of #99287 - GuillaumeGomez:rustdoc-json-double-export, r…
…=notriddle [rustdoc-json] JSON no longer inlines Fixes #98007. Fixes #96161. Fixes #83057. Fixes #83720. I took over #93518 and applied the comments and added more tests. There was one thing missing (which is in the second commit): if a non-exported item was used in a public API but not reexported, it was still missing. cc `@CraftSpider` `@Urgau` `@Enselic` r? `@notriddle`
- Loading branch information
Showing
20 changed files
with
194 additions
and
35 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
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,22 @@ | ||
// Regression test for <https://github.com/rust-lang/rust/issues/98007>. | ||
|
||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
mod auto { | ||
mod action_row { | ||
pub struct ActionRowBuilder; | ||
} | ||
|
||
#[doc(hidden)] | ||
pub mod builders { | ||
pub use super::action_row::ActionRowBuilder; | ||
} | ||
} | ||
|
||
// @count doc_hidden_failure.json "$.index[*][?(@.name=='builders')]" 2 | ||
pub use auto::*; | ||
|
||
pub mod builders { | ||
pub use crate::auto::builders::*; | ||
} |
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,17 @@ | ||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
// @is in_root_and_mod.json "$.index[*][?(@.name=='foo')].kind" \"module\" | ||
// @is in_root_and_mod.json "$.index[*][?(@.name=='foo')].inner.is_stripped" "true" | ||
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,17 @@ | ||
// 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" \"module\" | ||
// @is private_two_names.json "$.index[*][?(@.name=='style')].inner.is_stripped" "true" | ||
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
8 changes: 3 additions & 5 deletions
8
src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.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
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,13 +1,15 @@ | ||
// edition:2018 | ||
|
||
#![no_core] | ||
#![feature(no_core)] | ||
|
||
// @!has simple_private.json "$.index[*][?(@.name=='inner')]" | ||
// @is simple_private.json "$.index[*][?(@.name=='inner')].kind" \"module\" | ||
// @is simple_private.json "$.index[*][?(@.name=='inner')].inner.is_stripped" "true" | ||
mod inner { | ||
// @set pub_id = - "$.index[*][?(@.name=='Public')].id" | ||
pub struct Public; | ||
} | ||
|
||
// @has - "$.index[*][?(@.name=='simple_private')].inner.items[*]" $pub_id | ||
// @is - "$.index[*][?(@.kind=='import')].inner.name" \"Public\" | ||
pub use inner::Public; | ||
|
||
// @has - "$.index[*][?(@.name=='inner')].inner.items[*]" $pub_id |
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 @@ | ||
// Regression test for <https://github.com/rust-lang/rust/issues/96161>. | ||
// ignore-tidy-linelength | ||
|
||
#![feature(no_core)] | ||
#![no_core] | ||
|
||
mod secret { | ||
pub struct Secret; | ||
} | ||
|
||
// @is return_private.json "$.index[*][?(@.name=='get_secret')].kind" \"function\" | ||
// @is return_private.json "$.index[*][?(@.name=='get_secret')].inner.decl.output.inner.name" \"secret::Secret\" | ||
pub fn get_secret() -> secret::Secret { | ||
secret::Secret | ||
} |
Oops, something went wrong.