about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustdoc/html/render/mod.rs7
-rw-r--r--src/test/rustdoc/attribute-rendering.rs7
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() {}