diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js
index 4425712eed7a1..55415e973c50a 100644
--- a/src/librustdoc/html/static/main.js
+++ b/src/librustdoc/html/static/main.js
@@ -2262,17 +2262,17 @@
onEach(document.getElementsByClassName('rust-example-rendered'), function(e) {
if (hasClass(e, 'compile_fail')) {
e.addEventListener("mouseover", function(event) {
- e.previousElementSibling.childNodes[0].style.color = '#f00';
+ this.parentElement.previousElementSibling.childNodes[0].style.color = '#f00';
});
e.addEventListener("mouseout", function(event) {
- e.previousElementSibling.childNodes[0].style.color = '';
+ this.parentElement.previousElementSibling.childNodes[0].style.color = '';
});
} else if (hasClass(e, 'ignore')) {
e.addEventListener("mouseover", function(event) {
- e.previousElementSibling.childNodes[0].style.color = '#ff9200';
+ this.parentElement.previousElementSibling.childNodes[0].style.color = '#ff9200';
});
e.addEventListener("mouseout", function(event) {
- e.previousElementSibling.childNodes[0].style.color = '';
+ this.parentElement.previousElementSibling.childNodes[0].style.color = '';
});
}
lineNumbersFunc(e);
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 1ae3b0b88c6dd..0f9104f91b4c0 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -284,6 +284,7 @@ nav.sub {
body:not(.source) .example-wrap {
display: inline-flex;
+ margin-bottom: 10px;
}
.example-wrap {
@@ -303,6 +304,10 @@ body:not(.source) .example-wrap > pre.rust {
width: 100%;
}
+body:not(.source) .example-wrap > pre {
+ margin: 0;
+}
+
#search {
margin-left: 230px;
position: relative;