Skip to content

Commit

Permalink
Auto merge of rust-lang#85639 - GuillaumeGomez:rollup-modinsi, r=Guil…
Browse files Browse the repository at this point in the history
…laumeGomez

Rollup of 4 pull requests

Successful merges:

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

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed May 24, 2021
2 parents ef0ec30 + 16fe40d commit 126561c
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 17 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_mir_build/src/check_unsafety.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => (
Expand Down
4 changes: 2 additions & 2 deletions library/std/src/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
38 changes: 33 additions & 5 deletions src/librustdoc/html/static/rustdoc.css
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/html/static/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>";
Expand Down
12 changes: 12 additions & 0 deletions src/test/rustdoc-gui/search-result-display.goml
Original file line number Diff line number Diff line change
@@ -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"})
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/issues/issue-47412.thir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/traits/safety-fn-body.thir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unsafe/unsafe-fn-assign-deref-ptr.thir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unsafe/unsafe-fn-deref-ptr.thir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/unsafe/unsafe-unstable-const-fn.thir.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 126561c

Please sign in to comment.