about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2024-12-14 15:33:47 -0800
committerDavid Tolnay <dtolnay@gmail.com>2024-12-19 10:47:14 -0800
commitda89d10264d641a67c506f6c85c77d876613c06f (patch)
tree7dcb890b079caece06b6aa523a9bb956be811789
parent044885c8ae8e296963327b7b60cd4e08118104e3 (diff)
downloadrust-da89d10264d641a67c506f6c85c77d876613c06f.tar.gz
rust-da89d10264d641a67c506f6c85c77d876613c06f.zip
Add test for rustdoc showing underscore as assoc const value
-rw-r--r--tests/rustdoc/assoc-consts-underscore.rs27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/rustdoc/assoc-consts-underscore.rs b/tests/rustdoc/assoc-consts-underscore.rs
new file mode 100644
index 00000000000..9bb44f0a03c
--- /dev/null
+++ b/tests/rustdoc/assoc-consts-underscore.rs
@@ -0,0 +1,27 @@
+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 = _'
+    const REQUIRED: Struct = Struct { _private: () };
+    //@ has - '//*[@id="associatedconstant.OPTIONAL"]' 'const OPTIONAL: Struct = _'
+    const OPTIONAL: Struct = Struct { _private: () };
+}
+
+impl Struct {
+    //@ has - '//*[@id="associatedconstant.INHERENT"]' 'const INHERENT: Struct = _'
+    pub const INHERENT: Struct = Struct { _private: () };
+}