diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:06:31 +0000 |
commit | 2ff14448863ac1a1dd9533461708e29aae170c2d (patch) | |
tree | 85b9fea2bbfe3f06473cfa381eed11f273b57c5c /src/test/rustdoc-json/reexport | |
parent | Adding debian version 1.64.0+dfsg1-1. (diff) | |
download | rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.tar.xz rustc-2ff14448863ac1a1dd9533461708e29aae170c2d.zip |
Adding debian version 1.65.0+dfsg1-2.debian/1.65.0+dfsg1-2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/rustdoc-json/reexport')
16 files changed, 161 insertions, 76 deletions
diff --git a/src/test/rustdoc-json/reexport/export_extern_crate_as_self.rs b/src/test/rustdoc-json/reexport/export_extern_crate_as_self.rs new file mode 100644 index 000000000..f076feb71 --- /dev/null +++ b/src/test/rustdoc-json/reexport/export_extern_crate_as_self.rs @@ -0,0 +1,11 @@ +//! Regression test for <https://github.com/rust-lang/rust/issues/100531> + +#![feature(no_core)] +#![no_core] + +#![crate_name = "export_extern_crate_as_self"] + +// ignore-tidy-linelength + +// @is "$.index[*][?(@.kind=='module')].name" \"export_extern_crate_as_self\" +pub extern crate self as export_extern_crate_as_self; // Must be the same name as the crate already has diff --git a/src/test/rustdoc-json/reexport/glob_collision.rs b/src/test/rustdoc-json/reexport/glob_collision.rs new file mode 100644 index 000000000..f91144dbf --- /dev/null +++ b/src/test/rustdoc-json/reexport/glob_collision.rs @@ -0,0 +1,28 @@ +// Regression test for https://github.com/rust-lang/rust/issues/100973 + +#![feature(no_core)] +#![no_core] + +// @set m1 = "$.index[*][?(@.name == 'm1' && @.kind == 'module')].id" +// @is "$.index[*][?(@.name == 'm1' && @.kind == 'module')].inner.items" [] +// @is "$.index[*][?(@.name == 'm1' && @.kind == 'module')].inner.is_stripped" true +mod m1 { + pub fn f() {} +} +// @set m2 = "$.index[*][?(@.name == 'm2' && @.kind == 'module')].id" +// @is "$.index[*][?(@.name == 'm2' && @.kind == 'module')].inner.items" [] +// @is "$.index[*][?(@.name == 'm2' && @.kind == 'module')].inner.is_stripped" true +mod m2 { + pub fn f(_: u8) {} +} + +// @set m1_use = "$.index[*][?(@.inner.name=='m1')].id" +// @is "$.index[*][?(@.inner.name=='m1')].inner.id" $m1 +// @is "$.index[*][?(@.inner.name=='m1')].inner.glob" true +pub use m1::*; +// @set m2_use = "$.index[*][?(@.inner.name=='m2')].id" +// @is "$.index[*][?(@.inner.name=='m2')].inner.id" $m2 +// @is "$.index[*][?(@.inner.name=='m2')].inner.glob" true +pub use m2::*; + +// @ismany "$.index[*][?(@.inner.is_crate==true)].inner.items[*]" $m1_use $m2_use diff --git a/src/test/rustdoc-json/reexport/glob_empty_mod.rs b/src/test/rustdoc-json/reexport/glob_empty_mod.rs new file mode 100644 index 000000000..da6822835 --- /dev/null +++ b/src/test/rustdoc-json/reexport/glob_empty_mod.rs @@ -0,0 +1,8 @@ +// Regression test for https://github.com/rust-lang/rust/issues/100973 + +// @is "$.index[*][?(@.name=='m1' && @.kind == 'module')].inner.is_stripped" true +// @set m1 = "$.index[*][?(@.name=='m1')].id" +mod m1 {} + +// @is "$.index[*][?(@.inner.name=='m1' && @.kind=='import')].inner.id" $m1 +pub use m1::*; diff --git a/src/test/rustdoc-json/reexport/glob_extern.rs b/src/test/rustdoc-json/reexport/glob_extern.rs index ba1cfd8a0..7a1e8c11f 100644 --- a/src/test/rustdoc-json/reexport/glob_extern.rs +++ b/src/test/rustdoc-json/reexport/glob_extern.rs @@ -3,16 +3,21 @@ #![no_core] #![feature(no_core)] -// @is glob_extern.json "$.index[*][?(@.name=='mod1')].kind" \"module\" -// @is glob_extern.json "$.index[*][?(@.name=='mod1')].inner.is_stripped" "true" +// @is "$.index[*][?(@.name=='mod1')].kind" \"module\" +// @is "$.index[*][?(@.name=='mod1')].inner.is_stripped" "true" mod mod1 { extern "C" { - // @has - "$.index[*][?(@.name=='public_fn')].id" + // @set public_fn_id = "$.index[*][?(@.name=='public_fn')].id" pub fn public_fn(); - // @!has - "$.index[*][?(@.name=='private_fn')]" + // @!has "$.index[*][?(@.name=='private_fn')]" fn private_fn(); } + // @ismany "$.index[*][?(@.name=='mod1')].inner.items[*]" $public_fn_id + // @set mod1_id = "$.index[*][?(@.name=='mod1')].id" } -// @is - "$.index[*][?(@.kind=='import')].inner.glob" true +// @is "$.index[*][?(@.kind=='import')].inner.glob" true +// @is "$.index[*][?(@.kind=='import')].inner.id" $mod1_id +// @set use_id = "$.index[*][?(@.kind=='import')].id" +// @ismany "$.index[*][?(@.name=='glob_extern')].inner.items[*]" $use_id pub use mod1::*; diff --git a/src/test/rustdoc-json/reexport/glob_private.rs b/src/test/rustdoc-json/reexport/glob_private.rs index e6a44748c..3a83a2081 100644 --- a/src/test/rustdoc-json/reexport/glob_private.rs +++ b/src/test/rustdoc-json/reexport/glob_private.rs @@ -3,30 +3,31 @@ #![no_core] #![feature(no_core)] -// @is glob_private.json "$.index[*][?(@.name=='mod1')].kind" \"module\" -// @is glob_private.json "$.index[*][?(@.name=='mod1')].inner.is_stripped" "true" +// @is "$.index[*][?(@.name=='mod1')].kind" \"module\" +// @is "$.index[*][?(@.name=='mod1')].inner.is_stripped" "true" mod mod1 { - // @is - "$.index[*][?(@.name=='mod2')].kind" \"module\" - // @is - "$.index[*][?(@.name=='mod2')].inner.is_stripped" "true" + // @is "$.index[*][?(@.name=='mod2')].kind" \"module\" + // @is "$.index[*][?(@.name=='mod2')].inner.is_stripped" "true" mod mod2 { - // @set m2pub_id = - "$.index[*][?(@.name=='Mod2Public')].id" + // @set m2pub_id = "$.index[*][?(@.name=='Mod2Public')].id" pub struct Mod2Public; - // @!has - "$.index[*][?(@.name=='Mod2Private')]" + // @!has "$.index[*][?(@.name=='Mod2Private')]" struct Mod2Private; } - // @has - "$.index[*][?(@.kind=='import' && @.inner.name=='mod2')]" + // @set mod2_use_id = "$.index[*][?(@.kind=='import' && @.inner.name=='mod2')].id" pub use self::mod2::*; - // @set m1pub_id = - "$.index[*][?(@.name=='Mod1Public')].id" + // @set m1pub_id = "$.index[*][?(@.name=='Mod1Public')].id" pub struct Mod1Public; - // @!has - "$.index[*][?(@.name=='Mod1Private')]" + // @!has "$.index[*][?(@.name=='Mod1Private')]" struct Mod1Private; } -// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='mod1')]" +// @set mod1_use_id = "$.index[*][?(@.kind=='import' && @.inner.name=='mod1')].id" pub use mod1::*; -// @has - "$.index[*][?(@.name=='mod2')].inner.items[*]" $m2pub_id -// @has - "$.index[*][?(@.name=='mod1')].inner.items[*]" $m1pub_id +// @ismany "$.index[*][?(@.name=='mod2')].inner.items[*]" $m2pub_id +// @ismany "$.index[*][?(@.name=='mod1')].inner.items[*]" $m1pub_id $mod2_use_id +// @ismany "$.index[*][?(@.name=='glob_private')].inner.items[*]" $mod1_use_id diff --git a/src/test/rustdoc-json/reexport/in_root_and_mod.rs b/src/test/rustdoc-json/reexport/in_root_and_mod.rs index 7bf10a986..7b97ebf21 100644 --- a/src/test/rustdoc-json/reexport/in_root_and_mod.rs +++ b/src/test/rustdoc-json/reexport/in_root_and_mod.rs @@ -1,17 +1,16 @@ #![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" +// @!has "$.index[*][?(@.name=='foo')]" mod foo { - // @has - "$.index[*][?(@.name=='Foo')]" + // @has "$.index[*][?(@.name=='Foo')]" pub struct Foo; } -// @has - "$.index[*][?(@.kind=='import' && @.inner.source=='foo::Foo')]" +// @has "$.index[*][?(@.kind=='import' && @.inner.source=='foo::Foo')]" pub use foo::Foo; pub mod bar { - // @has - "$.index[*][?(@.kind=='import' && @.inner.source=='crate::foo::Foo')]" + // @has "$.index[*][?(@.kind=='import' && @.inner.source=='crate::foo::Foo')]" pub use crate::foo::Foo; } diff --git a/src/test/rustdoc-json/reexport/in_root_and_mod_pub.rs b/src/test/rustdoc-json/reexport/in_root_and_mod_pub.rs index 2daadf762..f6d932d92 100644 --- a/src/test/rustdoc-json/reexport/in_root_and_mod_pub.rs +++ b/src/test/rustdoc-json/reexport/in_root_and_mod_pub.rs @@ -2,19 +2,19 @@ #![no_core] pub mod foo { - // @set bar_id = in_root_and_mod_pub.json "$.index[*][?(@.name=='Bar')].id" - // @has - "$.index[*][?(@.name=='foo')].inner.items[*]" $bar_id + // @set bar_id = "$.index[*][?(@.name=='Bar')].id" + // @ismany "$.index[*][?(@.name=='foo')].inner.items[*]" $bar_id pub struct Bar; } -// @set root_import_id = - "$.index[*][?(@.inner.source=='foo::Bar')].id" -// @is - "$.index[*][?(@.inner.source=='foo::Bar')].inner.id" $bar_id -// @has - "$.index[*][?(@.name=='in_root_and_mod_pub')].inner.items[*]" $root_import_id +// @set root_import_id = "$.index[*][?(@.inner.source=='foo::Bar')].id" +// @is "$.index[*][?(@.inner.source=='foo::Bar')].inner.id" $bar_id +// @has "$.index[*][?(@.name=='in_root_and_mod_pub')].inner.items[*]" $root_import_id pub use foo::Bar; pub mod baz { - // @set baz_import_id = - "$.index[*][?(@.inner.source=='crate::foo::Bar')].id" - // @is - "$.index[*][?(@.inner.source=='crate::foo::Bar')].inner.id" $bar_id - // @has - "$.index[*][?(@.name=='baz')].inner.items[*]" $baz_import_id + // @set baz_import_id = "$.index[*][?(@.inner.source=='crate::foo::Bar')].id" + // @is "$.index[*][?(@.inner.source=='crate::foo::Bar')].inner.id" $bar_id + // @ismany "$.index[*][?(@.name=='baz')].inner.items[*]" $baz_import_id pub use crate::foo::Bar; } diff --git a/src/test/rustdoc-json/reexport/macro.rs b/src/test/rustdoc-json/reexport/macro.rs index b86614ffb..b4882100f 100644 --- a/src/test/rustdoc-json/reexport/macro.rs +++ b/src/test/rustdoc-json/reexport/macro.rs @@ -3,15 +3,13 @@ #![no_core] #![feature(no_core)] -// @count macro.json "$.index[*][?(@.name=='macro')].inner.items[*]" 2 - -// @set repro_id = macro.json "$.index[*][?(@.name=='repro')].id" -// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro_id +// @set repro_id = "$.index[*][?(@.name=='repro')].id" #[macro_export] macro_rules! repro { () => {}; } -// @set repro2_id = macro.json "$.index[*][?(@.inner.name=='repro2')].id" -// @has - "$.index[*][?(@.name=='macro')].inner.items[*]" $repro2_id +// @set repro2_id = "$.index[*][?(@.inner.name=='repro2')].id" pub use crate::repro as repro2; + +// @ismany "$.index[*][?(@.name=='macro')].inner.items[*]" $repro_id $repro2_id diff --git a/src/test/rustdoc-json/reexport/mod_not_included.rs b/src/test/rustdoc-json/reexport/mod_not_included.rs new file mode 100644 index 000000000..7b7600ef2 --- /dev/null +++ b/src/test/rustdoc-json/reexport/mod_not_included.rs @@ -0,0 +1,14 @@ +// Regression test for https://github.com/rust-lang/rust/issues/101103 + +#![feature(no_core)] +#![no_core] + +mod m1 { + pub fn x() {} +} + +pub use m1::x; + +// @has "$.index[*][?(@.name=='x' && @.kind=='function')]" +// @has "$.index[*][?(@.kind=='import' && @.inner.name=='x')].inner.source" '"m1::x"' +// @!has "$.index[*][?(@.name=='m1')]" diff --git a/src/test/rustdoc-json/reexport/private_twice_one_inline.rs b/src/test/rustdoc-json/reexport/private_twice_one_inline.rs index 327b0f45f..687a3b2ac 100644 --- a/src/test/rustdoc-json/reexport/private_twice_one_inline.rs +++ b/src/test/rustdoc-json/reexport/private_twice_one_inline.rs @@ -1,18 +1,28 @@ // aux-build:pub-struct.rs +// ignore-tidy-linelength -// Test for the ICE in rust/83057 -// Am external type re-exported with different attributes shouldn't cause an error +// Test for the ICE in https://github.com/rust-lang/rust/issues/83057 +// An 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)] + +// @set crate_use_id = "$.index[*][?(@.docs=='Hack A')].id" +// @set foo_id = "$.index[*][?(@.docs=='Hack A')].inner.id" +/// Hack A pub use foo::Foo; +// @set bar_id = "$.index[*][?(@.name=='bar')].id" pub mod bar { + // @is "$.index[*][?(@.docs=='Hack B')].inner.id" $foo_id + // @set bar_use_id = "$.index[*][?(@.docs=='Hack B')].id" + // @ismany "$.index[*][?(@.name=='bar')].inner.items[*]" $bar_use_id + /// Hack B pub use foo::Foo; } -// @count private_twice_one_inline.json "$.index[*][?(@.kind=='import')]" 2 +// @ismany "$.index[*][?(@.kind=='import')].id" $crate_use_id $bar_use_id +// @ismany "$.index[*][?(@.name=='private_twice_one_inline')].inner.items[*]" $bar_id $crate_use_id diff --git a/src/test/rustdoc-json/reexport/private_two_names.rs b/src/test/rustdoc-json/reexport/private_two_names.rs index 36d6a50d3..9858538a9 100644 --- a/src/test/rustdoc-json/reexport/private_two_names.rs +++ b/src/test/rustdoc-json/reexport/private_two_names.rs @@ -1,17 +1,22 @@ -// Test for the ICE in rust/83720 +// ignore-tidy-linelength + +// Test for the ICE in https://github.com/rust-lang/rust/issues/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" +// @!has "$.index[*][?(@.name=='style')]" mod style { - // @has - "$.index[*](?(@.name=='Color'))" + // @set color_struct_id = "$.index[*][?(@.kind=='struct' && @.name=='Color')].id" pub struct Color; } -// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='Color')]" +// @is "$.index[*][?(@.kind=='import' && @.inner.name=='Color')].inner.id" $color_struct_id +// @set color_export_id = "$.index[*][?(@.kind=='import' && @.inner.name=='Color')].id" pub use style::Color; -// @has - "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')]" +// @is "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')].inner.id" $color_struct_id +// @set colour_export_id = "$.index[*][?(@.kind=='import' && @.inner.name=='Colour')].id" pub use style::Color as Colour; + +// @ismany "$.index[*][?(@.name=='private_two_names')].inner.items[*]" $color_export_id $colour_export_id diff --git a/src/test/rustdoc-json/reexport/rename_private.rs b/src/test/rustdoc-json/reexport/rename_private.rs index 2476399bd..8fd850f9b 100644 --- a/src/test/rustdoc-json/reexport/rename_private.rs +++ b/src/test/rustdoc-json/reexport/rename_private.rs @@ -3,12 +3,11 @@ #![no_core] #![feature(no_core)] -// @is rename_private.json "$.index[*][?(@.name=='inner')].kind" \"module\" -// @is rename_private.json "$.index[*][?(@.name=='inner')].inner.is_stripped" "true" +// @!has "$.index[*][?(@.kind=='inner')]" mod inner { - // @has - "$.index[*][?(@.name=='Public')]" + // @has "$.index[*][?(@.name=='Public')]" pub struct Public; } -// @is - "$.index[*][?(@.kind=='import')].inner.name" \"NewName\" +// @is "$.index[*][?(@.kind=='import')].inner.name" \"NewName\" pub use inner::Public as NewName; diff --git a/src/test/rustdoc-json/reexport/rename_public.rs b/src/test/rustdoc-json/reexport/rename_public.rs index 2dd438d22..e30907fe2 100644 --- a/src/test/rustdoc-json/reexport/rename_public.rs +++ b/src/test/rustdoc-json/reexport/rename_public.rs @@ -3,15 +3,15 @@ #![no_core] #![feature(no_core)] -// @set inner_id = rename_public.json "$.index[*][?(@.name=='inner')].id" -// @has - "$.index[*][?(@.name=='rename_public')].inner.items[*]" $inner_id +// @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { - // @set public_id = - "$.index[*][?(@.name=='Public')].id" - // @has - "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id + // @set public_id = "$.index[*][?(@.name=='Public')].id" + // @ismany "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id pub struct Public; } -// @set import_id = - "$.index[*][?(@.inner.name=='NewName')].id" -// @!has - "$.index[*][?(@.inner.name=='Public')]" -// @has - "$.index[*][?(@.name=='rename_public')].inner.items[*]" $import_id -// @is - "$.index[*][?(@.inner.name=='NewName')].inner.source" \"inner::Public\" +// @set import_id = "$.index[*][?(@.inner.name=='NewName')].id" +// @!has "$.index[*][?(@.inner.name=='Public')]" +// @is "$.index[*][?(@.inner.name=='NewName')].inner.source" \"inner::Public\" pub use inner::Public as NewName; + +// @ismany "$.index[*][?(@.name=='rename_public')].inner.items[*]" $inner_id $import_id diff --git a/src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.rs b/src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.rs index eedddd6a7..880dbdc44 100644 --- a/src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.rs +++ b/src/test/rustdoc-json/reexport/same_type_reexported_more_than_once.rs @@ -1,15 +1,21 @@ +// ignore-tidy-linelength + // Regression test for <https://github.com/rust-lang/rust/issues/97432>. #![feature(no_core)] #![no_std] #![no_core] -// @has same_type_reexported_more_than_once.json -// @has - "$.index[*][?(@.name=='Trait')]" -pub use inner::Trait; -// @has - "$.index[*].inner[?(@.name=='Reexport')].id" -pub use inner::Trait as Reexport; - mod inner { + // @set trait_id = "$.index[*][?(@.name=='Trait')].id" pub trait Trait {} } + +// @set export_id = "$.index[*][?(@.inner.name=='Trait')].id" +// @is "$.index[*][?(@.inner.name=='Trait')].inner.id" $trait_id +pub use inner::Trait; +// @set reexport_id = "$.index[*][?(@.inner.name=='Reexport')].id" +// @is "$.index[*][?(@.inner.name=='Reexport')].inner.id" $trait_id +pub use inner::Trait as Reexport; + +// @ismany "$.index[*][?(@.name=='same_type_reexported_more_than_once')].inner.items[*]" $reexport_id $export_id diff --git a/src/test/rustdoc-json/reexport/simple_private.rs b/src/test/rustdoc-json/reexport/simple_private.rs index 5ec13e403..d058ce059 100644 --- a/src/test/rustdoc-json/reexport/simple_private.rs +++ b/src/test/rustdoc-json/reexport/simple_private.rs @@ -2,14 +2,15 @@ #![no_core] #![feature(no_core)] -// @is simple_private.json "$.index[*][?(@.name=='inner')].kind" \"module\" -// @is simple_private.json "$.index[*][?(@.name=='inner')].inner.is_stripped" "true" +// @!has "$.index[*][?(@.name=='inner')]" mod inner { - // @set pub_id = - "$.index[*][?(@.name=='Public')].id" + // @set pub_id = "$.index[*][?(@.name=='Public')].id" pub struct Public; } -// @is - "$.index[*][?(@.kind=='import')].inner.name" \"Public\" +// @is "$.index[*][?(@.kind=='import')].inner.name" \"Public\" +// @is "$.index[*][?(@.kind=='import')].inner.id" $pub_id +// @set use_id = "$.index[*][?(@.kind=='import')].id" pub use inner::Public; -// @has - "$.index[*][?(@.name=='inner')].inner.items[*]" $pub_id +// @ismany "$.index[*][?(@.name=='simple_private')].inner.items[*]" $use_id diff --git a/src/test/rustdoc-json/reexport/simple_public.rs b/src/test/rustdoc-json/reexport/simple_public.rs index 2e4de301f..e64a0dcb7 100644 --- a/src/test/rustdoc-json/reexport/simple_public.rs +++ b/src/test/rustdoc-json/reexport/simple_public.rs @@ -3,16 +3,16 @@ #![no_core] #![feature(no_core)] -// @set inner_id = simple_public.json "$.index[*][?(@.name=='inner')].id" -// @has - "$.index[*][?(@.name=='simple_public')].inner.items[*]" $inner_id +// @set inner_id = "$.index[*][?(@.name=='inner')].id" pub mod inner { - // @set public_id = - "$.index[*][?(@.name=='Public')].id" - // @has - "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id + // @set public_id = "$.index[*][?(@.name=='Public')].id" + // @ismany "$.index[*][?(@.name=='inner')].inner.items[*]" $public_id pub struct Public; } -// @set import_id = - "$.index[*][?(@.inner.name=='Public')].id" -// @has - "$.index[*][?(@.name=='simple_public')].inner.items[*]" $import_id -// @is - "$.index[*][?(@.inner.name=='Public')].inner.source" \"inner::Public\" +// @set import_id = "$.index[*][?(@.inner.name=='Public')].id" +// @is "$.index[*][?(@.inner.name=='Public')].inner.source" \"inner::Public\" pub use inner::Public; + +// @ismany "$.index[*][?(@.name=='simple_public')].inner.items[*]" $import_id $inner_id |