From cf94bdc0742c13e2a0cac864c478b8626b266e1b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/rustdoc-json/primitive.rs | 20 ------------- src/test/rustdoc-json/primitive_overloading.rs | 16 ---------- src/test/rustdoc-json/primitives.rs | 22 -------------- .../rustdoc-json/primitives/primitive_impls.rs | 34 ++++++++++++++++++++++ .../primitives/primitive_overloading.rs | 16 ++++++++++ src/test/rustdoc-json/primitives/primitive_type.rs | 22 ++++++++++++++ src/test/rustdoc-json/primitives/use_primitive.rs | 20 +++++++++++++ .../reexport_method_from_private_module.rs | 28 ++++++++++++++++++ 8 files changed, 120 insertions(+), 58 deletions(-) delete mode 100644 src/test/rustdoc-json/primitive.rs delete mode 100644 src/test/rustdoc-json/primitive_overloading.rs delete mode 100644 src/test/rustdoc-json/primitives.rs create mode 100644 src/test/rustdoc-json/primitives/primitive_impls.rs create mode 100644 src/test/rustdoc-json/primitives/primitive_overloading.rs create mode 100644 src/test/rustdoc-json/primitives/primitive_type.rs create mode 100644 src/test/rustdoc-json/primitives/use_primitive.rs create mode 100644 src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs (limited to 'src/test/rustdoc-json') diff --git a/src/test/rustdoc-json/primitive.rs b/src/test/rustdoc-json/primitive.rs deleted file mode 100644 index 6454dd7f5..000000000 --- a/src/test/rustdoc-json/primitive.rs +++ /dev/null @@ -1,20 +0,0 @@ -// edition:2018 - -#![feature(rustdoc_internals)] - -#[doc(primitive = "usize")] -mod usize {} - -// @set local_crate_id = "$.index[*][?(@.name=='primitive')].crate_id" - -// @has "$.index[*][?(@.name=='ilog10')]" -// @!is "$.index[*][?(@.name=='ilog10')].crate_id" $local_crate_id -// @has "$.index[*][?(@.name=='checked_add')]" -// @!is "$.index[*][?(@.name=='checked_add')]" $local_crate_id -// @!has "$.index[*][?(@.name=='is_ascii_uppercase')]" - -// @is "$.index[*][?(@.kind=='import' && @.inner.name=='my_i32')].inner.id" null -pub use i32 as my_i32; - -// @is "$.index[*][?(@.kind=='import' && @.inner.name=='u32')].inner.id" null -pub use u32; diff --git a/src/test/rustdoc-json/primitive_overloading.rs b/src/test/rustdoc-json/primitive_overloading.rs deleted file mode 100644 index 56b35cd14..000000000 --- a/src/test/rustdoc-json/primitive_overloading.rs +++ /dev/null @@ -1,16 +0,0 @@ -// compile-flags: --document-private-items - -// Regression test for . - -#![feature(rustdoc_internals)] -#![feature(no_core)] - -#![no_core] - -// @has "$.index[*][?(@.name=='usize')]" -// @has "$.index[*][?(@.name=='prim')]" - -#[doc(primitive = "usize")] -/// This is the built-in type `usize`. -mod prim { -} diff --git a/src/test/rustdoc-json/primitives.rs b/src/test/rustdoc-json/primitives.rs deleted file mode 100644 index 8024044bc..000000000 --- a/src/test/rustdoc-json/primitives.rs +++ /dev/null @@ -1,22 +0,0 @@ -#![feature(never_type)] - -// @is "$.index[*][?(@.name=='PrimNever')].visibility" \"public\" -// @is "$.index[*][?(@.name=='PrimNever')].inner.type.kind" \"primitive\" -// @is "$.index[*][?(@.name=='PrimNever')].inner.type.inner" \"never\" -pub type PrimNever = !; - -// @is "$.index[*][?(@.name=='PrimStr')].inner.type.kind" \"primitive\" -// @is "$.index[*][?(@.name=='PrimStr')].inner.type.inner" \"str\" -pub type PrimStr = str; - -// @is "$.index[*][?(@.name=='PrimBool')].inner.type.kind" \"primitive\" -// @is "$.index[*][?(@.name=='PrimBool')].inner.type.inner" \"bool\" -pub type PrimBool = bool; - -// @is "$.index[*][?(@.name=='PrimChar')].inner.type.kind" \"primitive\" -// @is "$.index[*][?(@.name=='PrimChar')].inner.type.inner" \"char\" -pub type PrimChar = char; - -// @is "$.index[*][?(@.name=='PrimU8')].inner.type.kind" \"primitive\" -// @is "$.index[*][?(@.name=='PrimU8')].inner.type.inner" \"u8\" -pub type PrimU8 = u8; diff --git a/src/test/rustdoc-json/primitives/primitive_impls.rs b/src/test/rustdoc-json/primitives/primitive_impls.rs new file mode 100644 index 000000000..1fc937406 --- /dev/null +++ b/src/test/rustdoc-json/primitives/primitive_impls.rs @@ -0,0 +1,34 @@ +#![feature(no_core)] +#![feature(rustc_attrs)] +#![feature(rustdoc_internals)] +#![no_core] +#![rustc_coherence_is_core] + +// @set impl_i32 = "$.index[*][?(@.docs=='Only core can do this')].id" + +/// Only core can do this +impl i32 { + // @set identity = "$.index[*][?(@.docs=='Do Nothing')].id" + + /// Do Nothing + pub fn identity(self) -> Self { + self + } + + // @is "$.index[*][?(@.docs=='Only core can do this')].inner.items[*]" $identity +} + +// @set Trait = "$.index[*][?(@.name=='Trait')].id" +pub trait Trait {} +// @set impl_trait_for_i32 = "$.index[*][?(@.docs=='impl Trait for i32')].id" +/// impl Trait for i32 +impl Trait for i32 {} + +/// i32 +#[doc(primitive = "i32")] +mod prim_i32 {} + +// @set i32 = "$.index[*][?(@.docs=='i32')].id" +// @is "$.index[*][?(@.docs=='i32')].name" '"i32"' +// @is "$.index[*][?(@.docs=='i32')].inner.name" '"i32"' +// @ismany "$.index[*][?(@.docs=='i32')].inner.impls[*]" $impl_i32 $impl_trait_for_i32 diff --git a/src/test/rustdoc-json/primitives/primitive_overloading.rs b/src/test/rustdoc-json/primitives/primitive_overloading.rs new file mode 100644 index 000000000..56b35cd14 --- /dev/null +++ b/src/test/rustdoc-json/primitives/primitive_overloading.rs @@ -0,0 +1,16 @@ +// compile-flags: --document-private-items + +// Regression test for . + +#![feature(rustdoc_internals)] +#![feature(no_core)] + +#![no_core] + +// @has "$.index[*][?(@.name=='usize')]" +// @has "$.index[*][?(@.name=='prim')]" + +#[doc(primitive = "usize")] +/// This is the built-in type `usize`. +mod prim { +} diff --git a/src/test/rustdoc-json/primitives/primitive_type.rs b/src/test/rustdoc-json/primitives/primitive_type.rs new file mode 100644 index 000000000..8024044bc --- /dev/null +++ b/src/test/rustdoc-json/primitives/primitive_type.rs @@ -0,0 +1,22 @@ +#![feature(never_type)] + +// @is "$.index[*][?(@.name=='PrimNever')].visibility" \"public\" +// @is "$.index[*][?(@.name=='PrimNever')].inner.type.kind" \"primitive\" +// @is "$.index[*][?(@.name=='PrimNever')].inner.type.inner" \"never\" +pub type PrimNever = !; + +// @is "$.index[*][?(@.name=='PrimStr')].inner.type.kind" \"primitive\" +// @is "$.index[*][?(@.name=='PrimStr')].inner.type.inner" \"str\" +pub type PrimStr = str; + +// @is "$.index[*][?(@.name=='PrimBool')].inner.type.kind" \"primitive\" +// @is "$.index[*][?(@.name=='PrimBool')].inner.type.inner" \"bool\" +pub type PrimBool = bool; + +// @is "$.index[*][?(@.name=='PrimChar')].inner.type.kind" \"primitive\" +// @is "$.index[*][?(@.name=='PrimChar')].inner.type.inner" \"char\" +pub type PrimChar = char; + +// @is "$.index[*][?(@.name=='PrimU8')].inner.type.kind" \"primitive\" +// @is "$.index[*][?(@.name=='PrimU8')].inner.type.inner" \"u8\" +pub type PrimU8 = u8; diff --git a/src/test/rustdoc-json/primitives/use_primitive.rs b/src/test/rustdoc-json/primitives/use_primitive.rs new file mode 100644 index 000000000..e22927374 --- /dev/null +++ b/src/test/rustdoc-json/primitives/use_primitive.rs @@ -0,0 +1,20 @@ +// edition:2018 + +#![feature(rustdoc_internals)] + +#[doc(primitive = "usize")] +mod usize {} + +// @set local_crate_id = "$.index[*][?(@.name=='use_primitive')].crate_id" + +// @has "$.index[*][?(@.name=='ilog10')]" +// @!is "$.index[*][?(@.name=='ilog10')].crate_id" $local_crate_id +// @has "$.index[*][?(@.name=='checked_add')]" +// @!is "$.index[*][?(@.name=='checked_add')]" $local_crate_id +// @!has "$.index[*][?(@.name=='is_ascii_uppercase')]" + +// @is "$.index[*][?(@.kind=='import' && @.inner.name=='my_i32')].inner.id" null +pub use i32 as my_i32; + +// @is "$.index[*][?(@.kind=='import' && @.inner.name=='u32')].inner.id" null +pub use u32; diff --git a/src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs b/src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs new file mode 100644 index 000000000..239b1a23b --- /dev/null +++ b/src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs @@ -0,0 +1,28 @@ +// Regression test for . + +// @set impl_S = "$.index[*][?(@.docs=='impl S')].id" +// @has "$.index[*][?(@.name=='S')].inner.impls[*]" $impl_S +// @set is_present = "$.index[*][?(@.name=='is_present')].id" +// @is "$.index[*][?(@.docs=='impl S')].inner.items[*]" $is_present +// @!has "$.index[*][?(@.name=='hidden_impl')]" +// @!has "$.index[*][?(@.name=='hidden_fn')]" + +#![no_std] + +mod private_mod { + pub struct S; + + /// impl S + impl S { + pub fn is_present() {} + #[doc(hidden)] + pub fn hidden_fn() {} + } + + #[doc(hidden)] + impl S { + pub fn hidden_impl() {} + } +} + +pub use private_mod::*; -- cgit v1.2.3