about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs35
-rw-r--r--src/test/rustdoc/auxiliary/issue-73061.rs17
-rw-r--r--src/test/rustdoc/intra-link-proc-macro.rs27
-rw-r--r--src/test/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs14
-rw-r--r--src/test/rustdoc/show-const-contents.rs8
5 files changed, 97 insertions, 4 deletions
diff --git a/src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs b/src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs
new file mode 100644
index 00000000000..04a431d9902
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/intra-link-proc-macro-macro.rs
@@ -0,0 +1,35 @@
+// force-host
+// no-prefer-dynamic
+// compile-flags: --crate-type proc-macro
+
+#![crate_type="proc-macro"]
+#![crate_name="intra_link_proc_macro_macro"]
+
+extern crate proc_macro;
+
+use proc_macro::TokenStream;
+
+#[proc_macro_derive(DeriveA)]
+pub fn a_derive(input: TokenStream) -> TokenStream {
+    input
+}
+
+#[proc_macro_derive(DeriveB)]
+pub fn b_derive(input: TokenStream) -> TokenStream {
+    input
+}
+
+#[proc_macro_derive(DeriveTrait)]
+pub fn trait_derive(input: TokenStream) -> TokenStream {
+    input
+}
+
+#[proc_macro_attribute]
+pub fn attr_a(input: TokenStream, _args: TokenStream) -> TokenStream {
+    input
+}
+
+#[proc_macro_attribute]
+pub fn attr_b(input: TokenStream, _args: TokenStream) -> TokenStream {
+    input
+}
diff --git a/src/test/rustdoc/auxiliary/issue-73061.rs b/src/test/rustdoc/auxiliary/issue-73061.rs
new file mode 100644
index 00000000000..e05a3bc6d91
--- /dev/null
+++ b/src/test/rustdoc/auxiliary/issue-73061.rs
@@ -0,0 +1,17 @@
+//edition:2018
+
+#![feature(type_alias_impl_trait)]
+
+pub trait Foo {
+    type X: std::future::Future<Output = ()>;
+    fn x(&self) -> Self::X;
+}
+
+pub struct F;
+
+impl Foo for F {
+    type X = impl std::future::Future<Output = ()>;
+    fn x(&self) -> Self::X {
+        async {}
+    }
+}
diff --git a/src/test/rustdoc/intra-link-proc-macro.rs b/src/test/rustdoc/intra-link-proc-macro.rs
new file mode 100644
index 00000000000..7b6ea5d60f8
--- /dev/null
+++ b/src/test/rustdoc/intra-link-proc-macro.rs
@@ -0,0 +1,27 @@
+// aux-build:intra-link-proc-macro-macro.rs
+// build-aux-docs
+#![deny(intra_doc_link_resolution_failure)]
+
+extern crate intra_link_proc_macro_macro;
+
+
+pub use intra_link_proc_macro_macro::{DeriveA, attr_a};
+use intra_link_proc_macro_macro::{DeriveB, attr_b};
+
+// @has intra_link_proc_macro/struct.Foo.html
+// @has - '//a/@href' '../intra_link_proc_macro/derive.DeriveA.html'
+// @has - '//a/@href' '../intra_link_proc_macro/attr.attr_a.html'
+// @has - '//a/@href' '../intra_link_proc_macro/trait.DeriveTrait.html'
+// @has - '//a/@href' '../intra_link_proc_macro_macro/derive.DeriveB.html'
+// @has - '//a/@href' '../intra_link_proc_macro_macro/attr.attr_b.html'
+/// Link to [DeriveA], [attr_a], [DeriveB], [attr_b], [DeriveTrait]
+pub struct Foo;
+
+// @has intra_link_proc_macro/struct.Bar.html
+// @has - '//a/@href' '../intra_link_proc_macro/derive.DeriveA.html'
+// @has - '//a/@href' '../intra_link_proc_macro/attr.attr_a.html'
+/// Link to [deriveA](derive@DeriveA) [attr](macro@attr_a)
+pub struct Bar;
+
+// this should not cause ambiguity errors
+pub trait DeriveTrait {}
diff --git a/src/test/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs b/src/test/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs
new file mode 100644
index 00000000000..2700f2370ee
--- /dev/null
+++ b/src/test/rustdoc/issue-73061-cross-crate-opaque-assoc-type.rs
@@ -0,0 +1,14 @@
+// Regression test for ICE #73061
+
+// aux-build:issue-73061.rs
+
+extern crate issue_73061;
+
+pub struct Z;
+
+impl issue_73061::Foo for Z {
+    type X = <issue_73061::F as issue_73061::Foo>::X;
+    fn x(&self) -> Self::X {
+        issue_73061::F.x()
+    }
+}
diff --git a/src/test/rustdoc/show-const-contents.rs b/src/test/rustdoc/show-const-contents.rs
index b35f67ef912..814339e198f 100644
--- a/src/test/rustdoc/show-const-contents.rs
+++ b/src/test/rustdoc/show-const-contents.rs
@@ -28,8 +28,8 @@ pub const CONST_CALC_I32: i32 = 42 + 1;
 // @!has show_const_contents/constant.CONST_REF_I32.html '; //'
 pub const CONST_REF_I32: &'static i32 = &42;
 
-// @has show_const_contents/constant.CONST_I32_MAX.html '= i32::max_value(); // 2_147_483_647i32'
-pub const CONST_I32_MAX: i32 = i32::max_value();
+// @has show_const_contents/constant.CONST_I32_MAX.html '= i32::MAX; // 2_147_483_647i32'
+pub const CONST_I32_MAX: i32 = i32::MAX;
 
 // @!has show_const_contents/constant.UNIT.html '= ();'
 // @!has show_const_contents/constant.UNIT.html '; //'
@@ -56,11 +56,11 @@ pub use std::i32::MAX;
 
 macro_rules! int_module {
     ($T:ident) => (
-        pub const MIN: $T = $T::min_value();
+        pub const MIN: $T = $T::MIN;
     )
 }
 
-// @has show_const_contents/constant.MIN.html '= i16::min_value(); // -32_768i16'
+// @has show_const_contents/constant.MIN.html '= i16::MIN; // -32_768i16'
 int_module!(i16);
 
 // @has show_const_contents/constant.ESCAPE.html //pre '= r#"<script>alert("ESCAPE");</script>"#;'