about summary refs log tree commit diff
path: root/tests/rustdoc
diff options
context:
space:
mode:
authorLaurențiu Nicola <lnicola@users.noreply.github.com>2024-12-23 10:12:23 +0000
committerGitHub <noreply@github.com>2024-12-23 10:12:23 +0000
commit8dbdcc03ebfd5d3c21671d8a021669dc79d93038 (patch)
treee61d058d30fdd35c4a306fde5be669b08092a4fd /tests/rustdoc
parent63a3c394617b114a8fa6e54401700b3adee65a7d (diff)
parent0180d2d16f5f5d60384a594568a98a6e6f8eea59 (diff)
downloadrust-8dbdcc03ebfd5d3c21671d8a021669dc79d93038.tar.gz
rust-8dbdcc03ebfd5d3c21671d8a021669dc79d93038.zip
Merge pull request #18746 from lnicola/sync-from-rust
minor: Sync from downstream
Diffstat (limited to 'tests/rustdoc')
-rw-r--r--tests/rustdoc/assoc-consts-underscore.rs30
-rw-r--r--tests/rustdoc/bold-tag-101743.rs2
-rw-r--r--tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs2
-rw-r--r--tests/rustdoc/intra-doc/link-in-footnotes-132208.rs24
-rw-r--r--tests/rustdoc/keyword.rs4
5 files changed, 57 insertions, 5 deletions
diff --git a/tests/rustdoc/assoc-consts-underscore.rs b/tests/rustdoc/assoc-consts-underscore.rs
new file mode 100644
index 00000000000..f48098094db
--- /dev/null
+++ b/tests/rustdoc/assoc-consts-underscore.rs
@@ -0,0 +1,30 @@
+pub struct Struct {
+    _private: (),
+}
+
+pub trait Trait {
+    //@ has assoc_consts_underscore/trait.Trait.html '//pre[@class="rust item-decl"]' \
+    //      'const REQUIRED: Struct;'
+    //@ !has - '//*[@id="associatedconstant.REQUIRED"]' 'const REQUIRED: Struct = _'
+    //@ has - '//*[@id="associatedconstant.REQUIRED"]' 'const REQUIRED: Struct'
+    const REQUIRED: Struct;
+    //@ has - '//pre[@class="rust item-decl"]' 'const OPTIONAL: Struct = _;'
+    //@ has - '//*[@id="associatedconstant.OPTIONAL"]' 'const OPTIONAL: Struct = _'
+    const OPTIONAL: Struct = Struct { _private: () };
+}
+
+impl Trait for Struct {
+    //@ !has assoc_consts_underscore/struct.Struct.html '//*[@id="associatedconstant.REQUIRED"]' \
+    //      'const REQUIRED: Struct = _'
+    //@ has - '//*[@id="associatedconstant.REQUIRED"]' 'const REQUIRED: Struct'
+    const REQUIRED: Struct = Struct { _private: () };
+    //@ !has - '//*[@id="associatedconstant.OPTIONAL"]' 'const OPTIONAL: Struct = _'
+    //@ has - '//*[@id="associatedconstant.OPTIONAL"]' 'const OPTIONAL: Struct'
+    const OPTIONAL: Struct = Struct { _private: () };
+}
+
+impl Struct {
+    //@ !has - '//*[@id="associatedconstant.INHERENT"]' 'const INHERENT: Struct = _'
+    //@ has - '//*[@id="associatedconstant.INHERENT"]' 'const INHERENT: Struct'
+    pub const INHERENT: Struct = Struct { _private: () };
+}
diff --git a/tests/rustdoc/bold-tag-101743.rs b/tests/rustdoc/bold-tag-101743.rs
index a81767eeeeb..3cd4005a4fa 100644
--- a/tests/rustdoc/bold-tag-101743.rs
+++ b/tests/rustdoc/bold-tag-101743.rs
@@ -14,6 +14,6 @@ impl<const B: Word> Repr<B> {
     // If we change back to rendering the value of consts, check this doesn't add
     // a <b> tag, but escapes correctly
 
-    //@ has foo/struct.Repr.html '//section[@id="associatedconstant.BASE"]/h4' '= _'
+    //@ !has foo/struct.Repr.html '//section[@id="associatedconstant.BASE"]/h4' '='
     pub const BASE: IBig = base_as_ibig::<B>();
 }
diff --git a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs
index 56708ec9310..6ab3cc6f6fe 100644
--- a/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs
+++ b/tests/rustdoc/inline_cross/auxiliary/assoc_item_trait_bounds.rs
@@ -1,5 +1,3 @@
-#![feature(async_closure)]
-
 use std::ops::AsyncFnMut;
 
 pub trait Main {
diff --git a/tests/rustdoc/intra-doc/link-in-footnotes-132208.rs b/tests/rustdoc/intra-doc/link-in-footnotes-132208.rs
new file mode 100644
index 00000000000..c9b97eafd2f
--- /dev/null
+++ b/tests/rustdoc/intra-doc/link-in-footnotes-132208.rs
@@ -0,0 +1,24 @@
+// Rustdoc has multiple passes and if the footnote pass is run before the link replacer
+// one, intra doc links are not generated inside footnote definitions. This test
+// therefore ensures that intra-doc link are correctly generated inside footnote
+// definitions.
+//
+// Regression test for <https://github.com/rust-lang/rust/issues/132208>.
+
+#![crate_name = "foo"]
+
+//@ has 'foo/index.html'
+//@ has - '//*[@class="docblock"]//a[@href="struct.Bar.html"]' 'a'
+//@ has - '//*[@class="docblock"]//*[@class="footnotes"]//a[@href="struct.Foo.html"]' 'b'
+
+//! [a]: crate::Bar
+//! [b]: crate::Foo
+//!
+//! link in body: [a]
+//!
+//! see footnote[^1]
+//!
+//! [^1]: link in footnote: [b]
+
+pub struct Bar;
+pub struct Foo;
diff --git a/tests/rustdoc/keyword.rs b/tests/rustdoc/keyword.rs
index 519e1944bc7..8f86c8ffd38 100644
--- a/tests/rustdoc/keyword.rs
+++ b/tests/rustdoc/keyword.rs
@@ -16,7 +16,7 @@
 /// this is a test!
 mod foo{}
 
-//@ has foo/keyword.foo.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
-#[doc(keyword = "foo")]
+//@ has foo/keyword.break.html '//section[@id="main-content"]//div[@class="docblock"]//p' 'hello'
+#[doc(keyword = "break")]
 /// hello
 mod bar {}