Skip to content

Commit 5925c8e

Browse files
authored
Rollup merge of #95613 - GuillaumeGomez:fix-rustdoc-attr-display, r=notriddle
Fix rustdoc attribute display Fixes #81482. r? `@notriddle`
2 parents 19a90c7 + 995513c commit 5925c8e

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/librustdoc/html/render/mod.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,12 @@ fn attributes(it: &clean::Item) -> Vec<String> {
10021002
.iter()
10031003
.filter_map(|attr| {
10041004
if ALLOWED_ATTRIBUTES.contains(&attr.name_or_empty()) {
1005-
Some(pprust::attribute_to_string(attr).replace('\n', "").replace(" ", " "))
1005+
Some(
1006+
pprust::attribute_to_string(attr)
1007+
.replace("\\\n", "")
1008+
.replace('\n', "")
1009+
.replace(" ", " "),
1010+
)
10061011
} else {
10071012
None
10081013
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![crate_name = "foo"]
2+
3+
// @has 'foo/fn.f.html'
4+
// @has - //*[@'class="docblock item-decl"]' '#[export_name = "f"] pub fn f()'
5+
#[export_name = "\
6+
f"]
7+
pub fn f() {}

0 commit comments

Comments
 (0)