about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-05-24 18:05:35 +0000
committerbors <bors@rust-lang.org>2021-05-24 18:05:35 +0000
commit126561cb31e8ebe1e2dd9dfd0d3ca621308dc56f (patch)
tree69c30c53a02c9ebb6eda076e7b432cce46e4654d
parentef0ec303fa5ff6fa5654c7ea94322f3f9881f6c2 (diff)
parent16fe40d3a38a197e5a2677332d26a916f6133408 (diff)
downloadrust-126561cb31e8ebe1e2dd9dfd0d3ca621308dc56f.tar.gz
rust-126561cb31e8ebe1e2dd9dfd0d3ca621308dc56f.zip
Auto merge of #85639 - GuillaumeGomez:rollup-modinsi, r=GuillaumeGomez
Rollup of 4 pull requests

Successful merges:

 - #85271 (Fix indentation in move keyword documentation)
 - #85551 (Fix search results display)
 - #85621 (Restore sans-serif font for module items.)
 - #85628 (Replace more "NULL" with "null")

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--compiler/rustc_mir_build/src/check_unsafety.rs2
-rw-r--r--library/std/src/keyword_docs.rs4
-rw-r--r--src/librustdoc/html/static/rustdoc.css38
-rw-r--r--src/librustdoc/html/static/search.js4
-rw-r--r--src/test/rustdoc-gui/search-result-display.goml12
-rw-r--r--src/test/ui/generator/issue-45729-unsafe-in-generator.thir.stderr2
-rw-r--r--src/test/ui/issues/issue-47412.thir.stderr2
-rw-r--r--src/test/ui/traits/safety-fn-body.thir.stderr2
-rw-r--r--src/test/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr2
-rw-r--r--src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr2
-rw-r--r--src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr2
-rw-r--r--src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr2
12 files changed, 57 insertions, 17 deletions
diff --git a/compiler/rustc_mir_build/src/check_unsafety.rs b/compiler/rustc_mir_build/src/check_unsafety.rs
index aa8193dab5d..0aa4d0fe2cb 100644
--- a/compiler/rustc_mir_build/src/check_unsafety.rs
+++ b/compiler/rustc_mir_build/src/check_unsafety.rs
@@ -296,7 +296,7 @@ impl UnsafeOpKind {
             ),
             DerefOfRawPointer => (
                 "dereference of raw pointer",
-                "raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules \
+                "raw pointers may be null, dangling or unaligned; they can violate aliasing rules \
                  and cause data races: all of these are undefined behavior",
             ),
             AssignToDroppingUnionField => (
diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs
index 39ed62425ce..ba2b8b6955d 100644
--- a/library/std/src/keyword_docs.rs
+++ b/library/std/src/keyword_docs.rs
@@ -1008,9 +1008,9 @@ mod mod_keyword {}
 ///     move || println!("This is a: {}", text)
 /// }
 ///
-///     let fn_plain = create_fn();
+/// let fn_plain = create_fn();
 ///
-///     fn_plain();
+/// fn_plain();
 /// ```
 ///
 /// `move` is often used when [threads] are involved.
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 9c5e3e8bfb2..bd03ab85c2c 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -145,6 +145,7 @@ h4.type.trait-impl, h4.associatedconstant.trait-impl, h4.associatedtype.trait-im
 
 h1, h2, h3, h4,
 .sidebar, a.source, .search-input, .search-results .result-name,
+.content table td:first-child > a,
 div.item-list .out-of-band,
 #source-sidebar, #sidebar-toggle,
 details.rustdoc-toggle > summary::before,
@@ -759,25 +760,40 @@ a {
 
 .search-results.active {
 	display: block;
+	/* prevent overhanging tabs from moving the first result */
+	clear: both;
 }
 
-.search-results .desc {
+.search-results .desc > span {
 	white-space: nowrap;
 	text-overflow: ellipsis;
 	overflow: hidden;
 	display: block;
 }
 
-.search-results a {
+.search-results > a {
+	display: block;
+	width: 100%;
 	/* A little margin ensures the browser's outlining of focused links has room to display. */
 	margin-left: 2px;
 	margin-right: 2px;
-	display: block;
+	border-bottom: 1px solid #aaa3;
+}
+
+.search-results > a > div {
+	display: flex;
+	flex-flow: row wrap;
 }
 
-.result-name {
+.search-results .result-name, .search-results div.desc, .search-results .result-description {
 	width: 50%;
-	float: left;
+}
+.search-results .result-name {
+	padding-right: 1em;
+}
+
+.search-results .result-name > span {
+	display: inline-block;
 }
 
 .result-name span.primitive::after {
@@ -1733,6 +1749,18 @@ details.undocumented[open] > summary::before {
 	.search-container > div {
 		width: calc(100% - 32px);
 	}
+
+	/* Display an alternating layout on tablets and phones */
+	.search-results > a {
+		border-bottom: 1px solid #aaa9;
+		padding: 5px 0px;
+	}
+	.search-results .result-name, .search-results div.desc, .search-results .result-description {
+		width: 100%;
+	}
+	.search-results div.desc, .search-results .result-description {
+		padding-left: 2em;
+	}
 }
 
 @media print {
diff --git a/src/librustdoc/html/static/search.js b/src/librustdoc/html/static/search.js
index c95136d40d3..634e5fa5787 100644
--- a/src/librustdoc/html/static/search.js
+++ b/src/librustdoc/html/static/search.js
@@ -994,8 +994,8 @@ window.initSearch = function(rawSearchIndex) {
                            ("<span class=\"alias\"><b>" + item.alias + " </b></span><span " +
                               "class=\"grey\"><i>&nbsp;- see&nbsp;</i></span>") : "") +
                           item.displayPath + "<span class=\"" + type + "\">" +
-                          name + "</span></div><div>" +
-                          "<span class=\"desc\">" + item.desc +
+                          name + "</span></div><div class=\"desc\">" +
+                          "<span>" + item.desc +
                           "&nbsp;</span></div></div></a>";
             });
             output += "</div>";
diff --git a/src/test/rustdoc-gui/search-result-display.goml b/src/test/rustdoc-gui/search-result-display.goml
new file mode 100644
index 00000000000..96d15c624f1
--- /dev/null
+++ b/src/test/rustdoc-gui/search-result-display.goml
@@ -0,0 +1,12 @@
+goto: file://|DOC_PATH|/test_docs/index.html
+size: (900, 1000)
+write: (".search-input", "test")
+// Waiting for the search results to appear...
+wait-for: "#titles"
+// The width is returned by "getComputedStyle" which returns the exact number instead of the
+// CSS rule which is "50%"...
+assert: (".search-results div.desc", {"width": "320px"})
+size: (600, 100)
+// As counter-intuitive as it may seem, in this width, the width is "100%", which is why
+// when computed it's larger.
+assert: (".search-results div.desc", {"width": "570px"})
diff --git a/src/test/ui/generator/issue-45729-unsafe-in-generator.thir.stderr b/src/test/ui/generator/issue-45729-unsafe-in-generator.thir.stderr
index a0905f98ca7..10d768f19fc 100644
--- a/src/test/ui/generator/issue-45729-unsafe-in-generator.thir.stderr
+++ b/src/test/ui/generator/issue-45729-unsafe-in-generator.thir.stderr
@@ -4,7 +4,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function
 LL |         *(1 as *mut u32) = 42;
    |         ^^^^^^^^^^^^^^^^ dereference of raw pointer
    |
-   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/issues/issue-47412.thir.stderr b/src/test/ui/issues/issue-47412.thir.stderr
index 2d6004b7911..66a0cfcd710 100644
--- a/src/test/ui/issues/issue-47412.thir.stderr
+++ b/src/test/ui/issues/issue-47412.thir.stderr
@@ -4,7 +4,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function
 LL |     match *ptr {}
    |           ^^^^ dereference of raw pointer
    |
-   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/traits/safety-fn-body.thir.stderr b/src/test/ui/traits/safety-fn-body.thir.stderr
index 94a1a2a03cd..23696c32bef 100644
--- a/src/test/ui/traits/safety-fn-body.thir.stderr
+++ b/src/test/ui/traits/safety-fn-body.thir.stderr
@@ -4,7 +4,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function
 LL |         *self += 1;
    |         ^^^^^ dereference of raw pointer
    |
-   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr b/src/test/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr
index b89401ce837..73a113652b8 100644
--- a/src/test/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr
+++ b/src/test/ui/unsafe/issue-45087-unreachable-unsafe.thir.stderr
@@ -4,7 +4,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function
 LL |     *(1 as *mut u32) = 42;
    |     ^^^^^^^^^^^^^^^^ dereference of raw pointer
    |
-   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr
index 498d26d30ff..bbe4a415b5e 100644
--- a/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr
+++ b/src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr
@@ -4,7 +4,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function
 LL |     *p = 0;
    |     ^^ dereference of raw pointer
    |
-   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr b/src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr
index 6897e4e691a..a2614992445 100644
--- a/src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr
+++ b/src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr
@@ -4,7 +4,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function
 LL |     return *p;
    |            ^^ dereference of raw pointer
    |
-   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr b/src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr
index 49d6a96860b..99808495ea6 100644
--- a/src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr
+++ b/src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr
@@ -4,7 +4,7 @@ error[E0133]: dereference of raw pointer is unsafe and requires unsafe function
 LL |     *a == b
    |     ^^ dereference of raw pointer
    |
-   = note: raw pointers may be NULL, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
+   = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
 error: aborting due to previous error