diff options
| author | Dylan DPC <99973273+Dylan-DPC@users.noreply.github.com> | 2022-04-03 23:21:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-03 23:21:43 +0200 |
| commit | 5925c8ee7987fdd0c07c1d1bd179c6b2f466e9fb (patch) | |
| tree | 168c5b0859efef703e78104f1b41b93a5df85043 | |
| parent | 19a90c70180d5ba9d825b66773ce0980d7804a36 (diff) | |
| parent | 995513c92986713a3a8260d8944e5ed82755347b (diff) | |
| download | rust-5925c8ee7987fdd0c07c1d1bd179c6b2f466e9fb.tar.gz rust-5925c8ee7987fdd0c07c1d1bd179c6b2f466e9fb.zip | |
Rollup merge of #95613 - GuillaumeGomez:fix-rustdoc-attr-display, r=notriddle
Fix rustdoc attribute display Fixes #81482. r? `@notriddle`
| -rw-r--r-- | src/librustdoc/html/render/mod.rs | 7 | ||||
| -rw-r--r-- | src/test/rustdoc/attribute-rendering.rs | 7 |
2 files changed, 13 insertions, 1 deletions
diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 0cfe12abcd1..ac07547de70 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -1002,7 +1002,12 @@ fn attributes(it: &clean::Item) -> Vec<String> { .iter() .filter_map(|attr| { if ALLOWED_ATTRIBUTES.contains(&attr.name_or_empty()) { - Some(pprust::attribute_to_string(attr).replace('\n', "").replace(" ", " ")) + Some( + pprust::attribute_to_string(attr) + .replace("\\\n", "") + .replace('\n', "") + .replace(" ", " "), + ) } else { None } diff --git a/src/test/rustdoc/attribute-rendering.rs b/src/test/rustdoc/attribute-rendering.rs new file mode 100644 index 00000000000..6777871846e --- /dev/null +++ b/src/test/rustdoc/attribute-rendering.rs @@ -0,0 +1,7 @@ +#![crate_name = "foo"] + +// @has 'foo/fn.f.html' +// @has - //*[@'class="docblock item-decl"]' '#[export_name = "f"] pub fn f()' +#[export_name = "\ +f"] +pub fn f() {} |
