Auto merge of #83308 - Dylan-DPC:rollup-p2j6sy8, r=Dylan-DPC
Rollup of 8 pull requests Successful merges: - #79986 (Only build help popup when it's really needed) - #82570 (Add `as_str` method for split whitespace str iterators) - #83244 (Fix overflowing length in Vec<ZST> to VecDeque) - #83254 (Include output stream in `panic!()` documentation) - #83269 (Revert the second deprecation of collections::Bound) - #83277 (Mark early otherwise optimization unsound) - #83285 (Update LLVM to bring in SIMD updates for WebAssembly) - #83297 (Do not ICE on ty::Error as an error must already have been reported) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
6bfbf0c33a
18 changed files with 210 additions and 49 deletions
|
|
@ -1,3 +1,4 @@
|
|||
// ignore-tidy-filelength
|
||||
// Local js definitions:
|
||||
/* global addClass, getSettingValue, hasClass */
|
||||
/* global onEach, onEachLazy, hasOwnProperty, removeClass, updateLocalStorage */
|
||||
|
|
@ -374,28 +375,35 @@ function defocusSearchBar() {
|
|||
}
|
||||
}
|
||||
|
||||
function getHelpElement() {
|
||||
buildHelperPopup();
|
||||
function getHelpElement(build) {
|
||||
if (build !== false) {
|
||||
buildHelperPopup();
|
||||
}
|
||||
return document.getElementById("help");
|
||||
}
|
||||
|
||||
function displayHelp(display, ev, help) {
|
||||
help = help ? help : getHelpElement();
|
||||
if (display === true) {
|
||||
help = help ? help : getHelpElement(true);
|
||||
if (hasClass(help, "hidden")) {
|
||||
ev.preventDefault();
|
||||
removeClass(help, "hidden");
|
||||
addClass(document.body, "blur");
|
||||
}
|
||||
} else if (hasClass(help, "hidden") === false) {
|
||||
ev.preventDefault();
|
||||
addClass(help, "hidden");
|
||||
removeClass(document.body, "blur");
|
||||
} else {
|
||||
// No need to build the help popup if we want to hide it in case it hasn't been
|
||||
// built yet...
|
||||
help = help ? help : getHelpElement(false);
|
||||
if (help && hasClass(help, "hidden") === false) {
|
||||
ev.preventDefault();
|
||||
addClass(help, "hidden");
|
||||
removeClass(document.body, "blur");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handleEscape(ev) {
|
||||
var help = getHelpElement();
|
||||
var help = getHelpElement(false);
|
||||
var search = getSearchElement();
|
||||
if (hasClass(help, "hidden") === false) {
|
||||
displayHelp(false, ev, help);
|
||||
|
|
@ -558,6 +566,7 @@ function defocusSearchBar() {
|
|||
}());
|
||||
|
||||
document.addEventListener("click", function(ev) {
|
||||
var helpElem = getHelpElement(false);
|
||||
if (hasClass(ev.target, "help-button")) {
|
||||
displayHelp(true, ev);
|
||||
} else if (hasClass(ev.target, "collapse-toggle")) {
|
||||
|
|
@ -566,11 +575,10 @@ function defocusSearchBar() {
|
|||
collapseDocs(ev.target.parentNode, "toggle");
|
||||
} else if (ev.target.tagName === "SPAN" && hasClass(ev.target.parentNode, "line-numbers")) {
|
||||
handleSourceHighlight(ev);
|
||||
} else if (hasClass(getHelpElement(), "hidden") === false) {
|
||||
var help = getHelpElement();
|
||||
var is_inside_help_popup = ev.target !== help && help.contains(ev.target);
|
||||
} else if (helpElem && hasClass(helpElem, "hidden") === false) {
|
||||
var is_inside_help_popup = ev.target !== helpElem && helpElem.contains(ev.target);
|
||||
if (is_inside_help_popup === false) {
|
||||
addClass(help, "hidden");
|
||||
addClass(helpElem, "hidden");
|
||||
removeClass(document.body, "blur");
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 62a1ddde22c267249eda72184520a21ad2052f0b
|
||||
Subproject commit c3a26cbf6e73f2c5f8d03cee1f151d90a266ef3c
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=4
|
||||
// compile-flags: -Z mir-opt-level=4 -Z unsound-mir-opts
|
||||
// EMIT_MIR early_otherwise_branch.opt1.EarlyOtherwiseBranch.diff
|
||||
fn opt1(x: Option<u32>, y: Option<u32>) -> u32 {
|
||||
match (x, y) {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
// compile-flags: -Z mir-opt-level=4
|
||||
// compile-flags: -Z mir-opt-level=4 -Z unsound-mir-opts
|
||||
|
||||
// EMIT_MIR early_otherwise_branch_3_element_tuple.opt1.EarlyOtherwiseBranch.diff
|
||||
fn opt1(x: Option<u32>, y: Option<u32>, z: Option<u32>) -> u32 {
|
||||
|
|
|
|||
9
src/test/ui/const-generics/type_mismatch.rs
Normal file
9
src/test/ui/const-generics/type_mismatch.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fn foo<const N: usize>() -> [u8; N] {
|
||||
bar::<N>() //~ ERROR mismatched types
|
||||
}
|
||||
|
||||
fn bar<const N: u8>() -> [u8; N] {}
|
||||
//~^ ERROR mismatched types
|
||||
//~| ERROR mismatched types
|
||||
|
||||
fn main() {}
|
||||
23
src/test/ui/const-generics/type_mismatch.stderr
Normal file
23
src/test/ui/const-generics/type_mismatch.stderr
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
error[E0308]: mismatched types
|
||||
--> $DIR/type_mismatch.rs:2:11
|
||||
|
|
||||
LL | bar::<N>()
|
||||
| ^ expected `u8`, found `usize`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type_mismatch.rs:5:31
|
||||
|
|
||||
LL | fn bar<const N: u8>() -> [u8; N] {}
|
||||
| ^ expected `usize`, found `u8`
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type_mismatch.rs:5:26
|
||||
|
|
||||
LL | fn bar<const N: u8>() -> [u8; N] {}
|
||||
| --- ^^^^^^^ expected array `[u8; N]`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
11
src/test/ui/const-generics/type_not_in_scope.rs
Normal file
11
src/test/ui/const-generics/type_not_in_scope.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
impl X {
|
||||
//~^ ERROR cannot find type
|
||||
fn getn<const N: usize>() -> [u8; N] {
|
||||
getn::<N>()
|
||||
}
|
||||
}
|
||||
fn getn<const N: cfg_attr>() -> [u8; N] {}
|
||||
//~^ ERROR expected type, found built-in attribute `cfg_attr`
|
||||
//~| ERROR mismatched types
|
||||
|
||||
fn main() {}
|
||||
24
src/test/ui/const-generics/type_not_in_scope.stderr
Normal file
24
src/test/ui/const-generics/type_not_in_scope.stderr
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
error[E0412]: cannot find type `X` in this scope
|
||||
--> $DIR/type_not_in_scope.rs:1:6
|
||||
|
|
||||
LL | impl X {
|
||||
| ^ not found in this scope
|
||||
|
||||
error[E0573]: expected type, found built-in attribute `cfg_attr`
|
||||
--> $DIR/type_not_in_scope.rs:7:18
|
||||
|
|
||||
LL | fn getn<const N: cfg_attr>() -> [u8; N] {}
|
||||
| ^^^^^^^^ not a type
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type_not_in_scope.rs:7:33
|
||||
|
|
||||
LL | fn getn<const N: cfg_attr>() -> [u8; N] {}
|
||||
| ---- ^^^^^^^ expected array `[u8; N]`, found `()`
|
||||
| |
|
||||
| implicitly returns `()` as its body has no tail or `return` expression
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0308, E0412, E0573.
|
||||
For more information about an error, try `rustc --explain E0308`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue