diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs
index 47d2707e40dfc..077481c89895e 100644
--- a/src/librustdoc/html/highlight.rs
+++ b/src/librustdoc/html/highlight.rs
@@ -30,7 +30,7 @@ crate fn render_with_highlighting(
"
",
class,
if let Some(edition_info) = edition_info {
- format!(" edition=\"{}\"", edition_info)
+ format!(" data-edition=\"{}\"", edition_info)
} else {
String::new()
},
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index afc4308b68f93..0b40480f738da 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -1098,7 +1098,7 @@ h3 > .collapse-toggle, h4 > .collapse-toggle {
content: "This example panics";
}
.tooltip.edition::after {
- content: "This code runs with edition " attr(edition);
+ content: "This code runs with edition " attr(data-edition);
}
.tooltip::before {
diff --git a/src/test/rustdoc/codeblock-title.rs b/src/test/rustdoc/codeblock-title.rs
index 1327fd67d316b..140c5b3a67203 100644
--- a/src/test/rustdoc/codeblock-title.rs
+++ b/src/test/rustdoc/codeblock-title.rs
@@ -3,7 +3,7 @@
// @has foo/fn.bar.html '//*[@class="tooltip compile_fail"]' "ⓘ"
// @has foo/fn.bar.html '//*[@class="tooltip ignore"]' "ⓘ"
// @has foo/fn.bar.html '//*[@class="tooltip should_panic"]' "ⓘ"
-// @has foo/fn.bar.html '//*[@edition="2018"]' "ⓘ"
+// @has foo/fn.bar.html '//*[@data-edition="2018"]' "ⓘ"
/// foo
///