about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-20 17:10:41 +0100
committerGitHub <noreply@github.com>2022-01-20 17:10:41 +0100
commit6c627d25f67846c80231fb7c61ab655f710f3313 (patch)
treecf107a4c3b52252fb37e0399aab1adb112a69b65 /src/test/rustdoc
parent1cb57e2d2b6400ed6fb6d498cb5639fe6fd5d984 (diff)
parent06b00ad19972c18150fe25a9b3716ffdf5300a83 (diff)
downloadrust-6c627d25f67846c80231fb7c61ab655f710f3313.tar.gz
rust-6c627d25f67846c80231fb7c61ab655f710f3313.zip
Rollup merge of #93038 - GuillaumeGomez:block-doc-comments, r=notriddle
Fix star handling in block doc comments

Fixes #92872.

Some extra explanation about this PR and why https://github.com/rust-lang/rust/pull/92357 created this regression: when we merge doc comment kinds for example in:

```rust
/// he
/**
* hello
*/
#[doc = "boom"]
```

We don't want to remove the empty lines between them. However, to correctly compute the "horizontal trim", we still need it, so instead, I put back a part of the "vertical trim" directly in the "horizontal trim" computation so it doesn't impact the output buffer but allows us to correctly handle the stars.

r? `@camelid`
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/strip-block-doc-comments-stars.docblock.html2
-rw-r--r--src/test/rustdoc/strip-block-doc-comments-stars.rs11
2 files changed, 13 insertions, 0 deletions
diff --git a/src/test/rustdoc/strip-block-doc-comments-stars.docblock.html b/src/test/rustdoc/strip-block-doc-comments-stars.docblock.html
new file mode 100644
index 00000000000..22b0b5dc47e
--- /dev/null
+++ b/src/test/rustdoc/strip-block-doc-comments-stars.docblock.html
@@ -0,0 +1,2 @@
+<div class="docblock"><p>a</p>
+</div>
\ No newline at end of file
diff --git a/src/test/rustdoc/strip-block-doc-comments-stars.rs b/src/test/rustdoc/strip-block-doc-comments-stars.rs
new file mode 100644
index 00000000000..ed2297b4fac
--- /dev/null
+++ b/src/test/rustdoc/strip-block-doc-comments-stars.rs
@@ -0,0 +1,11 @@
+#![crate_name = "foo"]
+
+// The goal of this test is to answer that it won't be generated as a list because
+// block doc comments can have their lines starting with a star.
+
+// @has foo/fn.foo.html
+// @snapshot docblock - '//*[@class="rustdoc-toggle top-doc"]//*[@class="docblock"]'
+/**
+ *     a
+ */
+pub fn foo() {}