summaryrefslogtreecommitdiffstats
path: root/src/test/rustdoc-json
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/rustdoc-json/primitives/primitive_impls.rs34
-rw-r--r--src/test/rustdoc-json/primitives/primitive_overloading.rs (renamed from src/test/rustdoc-json/primitive_overloading.rs)0
-rw-r--r--src/test/rustdoc-json/primitives/primitive_type.rs (renamed from src/test/rustdoc-json/primitives.rs)0
-rw-r--r--src/test/rustdoc-json/primitives/use_primitive.rs (renamed from src/test/rustdoc-json/primitive.rs)2
-rw-r--r--src/test/rustdoc-json/reexport/reexport_method_from_private_module.rs28
5 files changed, 63 insertions, 1 deletions
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/primitive_overloading.rs b/src/test/rustdoc-json/primitives/primitive_overloading.rs
index 56b35cd14..56b35cd14 100644
--- a/src/test/rustdoc-json/primitive_overloading.rs
+++ b/src/test/rustdoc-json/primitives/primitive_overloading.rs
diff --git a/src/test/rustdoc-json/primitives.rs b/src/test/rustdoc-json/primitives/primitive_type.rs
index 8024044bc..8024044bc 100644
--- a/src/test/rustdoc-json/primitives.rs
+++ b/src/test/rustdoc-json/primitives/primitive_type.rs
diff --git a/src/test/rustdoc-json/primitive.rs b/src/test/rustdoc-json/primitives/use_primitive.rs
index 6454dd7f5..e22927374 100644
--- a/src/test/rustdoc-json/primitive.rs
+++ b/src/test/rustdoc-json/primitives/use_primitive.rs
@@ -5,7 +5,7 @@
#[doc(primitive = "usize")]
mod usize {}
-// @set local_crate_id = "$.index[*][?(@.name=='primitive')].crate_id"
+// @set local_crate_id = "$.index[*][?(@.name=='use_primitive')].crate_id"
// @has "$.index[*][?(@.name=='ilog10')]"
// @!is "$.index[*][?(@.name=='ilog10')].crate_id" $local_crate_id
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 <https://github.com/rust-lang/rust/issues/102583>.
+
+// @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::*;