Skip to content

Commit

Permalink
Rollup merge of #95613 - GuillaumeGomez:fix-rustdoc-attr-display, r=n…
Browse files Browse the repository at this point in the history
…otriddle

Fix rustdoc attribute display

Fixes #81482.

r? `@notriddle`
  • Loading branch information
Dylan-DPC authored Apr 3, 2022
2 parents 19a90c7 + 995513c commit 5925c8e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
7 changes: 7 additions & 0 deletions src/test/rustdoc/attribute-rendering.rs
Original file line number Diff line number Diff line change
@@ -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() {}

0 comments on commit 5925c8e

Please sign in to comment.