Rollup merge of #95613 - GuillaumeGomez:fix-rustdoc-attr-display, r=notriddle
Fix rustdoc attribute display Fixes #81482. r? `@notriddle`
This commit is contained in:
commit
5925c8ee79
2 changed files with 13 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
|
7
src/test/rustdoc/attribute-rendering.rs
Normal file
7
src/test/rustdoc/attribute-rendering.rs
Normal file
|
@ -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() {}
|
Loading…
Add table
Add a link
Reference in a new issue