Skip to content

Commit 0d93d3f

Browse files
committed
Auto merge of #72831 - Dylan-DPC:rollup-6rxjwt9, r=Dylan-DPC
Rollup of 5 pull requests Successful merges: - #72691 (Fix escape key handling) - #72807 (Avoid setting wrong obligation cause span of associated type mismatch) - #72812 (Miri tests: skip parts of test_char_range) - #72829 (Clarify terms in doc comments) - #72830 (Fix release notes for niche initialization change) Failed merges: r? @ghost
2 parents 5fd2f06 + 76e0ecc commit 0d93d3f

File tree

7 files changed

+62
-29
lines changed

7 files changed

+62
-29
lines changed

RELEASES.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ Compatibility Notes
100100
source file rather than the previous format of `<NAME macros>`.][70969]
101101
**Note:** this may not point a file that actually exists on the user's system.
102102
- [The minimum required external LLVM version has been bumped to LLVM 8.][71147]
103-
- [`mem::{zeroed, uninitialised, MaybeUninit}` will now panic when used with types
104-
that do not allow zero initialization such as `NonZeroU8`.][66059] This was
103+
- [`mem::{zeroed, uninitialised}` will now panic when used with types that do
104+
not allow zero initialization such as `NonZeroU8`.][66059] This was
105105
previously a warning.
106106
- [In 1.45.0 (the next release) converting a `f64` to `u32` using the `as`
107107
operator has been defined as a saturating operation.][71269] This was previously

src/libcore/slice/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2173,7 +2173,7 @@ impl<T> [T] {
21732173
///
21742174
/// The length of `src` must be the same as `self`.
21752175
///
2176-
/// If `src` implements `Copy`, it can be more performant to use
2176+
/// If `T` implements `Copy`, it can be more performant to use
21772177
/// [`copy_from_slice`].
21782178
///
21792179
/// # Panics
@@ -2244,7 +2244,7 @@ impl<T> [T] {
22442244
///
22452245
/// The length of `src` must be the same as `self`.
22462246
///
2247-
/// If `src` does not implement `Copy`, use [`clone_from_slice`].
2247+
/// If `T` does not implement `Copy`, use [`clone_from_slice`].
22482248
///
22492249
/// # Panics
22502250
///

src/libcore/tests/iter.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1959,8 +1959,11 @@ fn test_range() {
19591959
#[test]
19601960
fn test_char_range() {
19611961
use std::char;
1962-
assert!(('\0'..=char::MAX).eq((0..=char::MAX as u32).filter_map(char::from_u32)));
1963-
assert!(('\0'..=char::MAX).rev().eq((0..=char::MAX as u32).filter_map(char::from_u32).rev()));
1962+
// Miri is too slow
1963+
let from = if cfg!(miri) { char::from_u32(0xD800 - 10).unwrap() } else { '\0' };
1964+
let to = if cfg!(miri) { char::from_u32(0xDFFF + 10).unwrap() } else { char::MAX };
1965+
assert!((from..=to).eq((from as u32..=to as u32).filter_map(char::from_u32)));
1966+
assert!((from..=to).rev().eq((from as u32..=to as u32).filter_map(char::from_u32).rev()));
19641967

19651968
assert_eq!(('\u{D7FF}'..='\u{E000}').count(), 2);
19661969
assert_eq!(('\u{D7FF}'..='\u{E000}').size_hint(), (2, Some(2)));

src/librustc_trait_selection/traits/wf.rs

+12-19
Original file line numberDiff line numberDiff line change
@@ -172,25 +172,18 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>(
172172
};
173173
match pred.kind() {
174174
ty::PredicateKind::Projection(proj) => {
175-
// The obligation comes not from the current `impl` nor the `trait` being
176-
// implemented, but rather from a "second order" obligation, like in
177-
// `src/test/ui/associated-types/point-at-type-on-obligation-failure.rs`.
178-
let trait_assoc_item = tcx.associated_item(proj.projection_def_id());
179-
if let Some(impl_item_span) =
180-
items.iter().find(|item| item.ident == trait_assoc_item.ident).map(fix_span)
181-
{
182-
cause.span = impl_item_span;
183-
} else {
184-
let kind = &proj.ty().skip_binder().kind;
185-
if let ty::Projection(projection_ty) = kind {
186-
// This happens when an associated type has a projection coming from another
187-
// associated type. See `traits-assoc-type-in-supertrait-bad.rs`.
188-
let trait_assoc_item = tcx.associated_item(projection_ty.item_def_id);
189-
if let Some(impl_item_span) =
190-
items.iter().find(|item| item.ident == trait_assoc_item.ident).map(fix_span)
191-
{
192-
cause.span = impl_item_span;
193-
}
175+
// The obligation comes not from the current `impl` nor the `trait` being implemented,
176+
// but rather from a "second order" obligation, where an associated type has a
177+
// projection coming from another associated type. See
178+
// `src/test/ui/associated-types/point-at-type-on-obligation-failure.rs` and
179+
// `traits-assoc-type-in-supertrait-bad.rs`.
180+
let kind = &proj.ty().skip_binder().kind;
181+
if let ty::Projection(projection_ty) = kind {
182+
let trait_assoc_item = tcx.associated_item(projection_ty.item_def_id);
183+
if let Some(impl_item_span) =
184+
items.iter().find(|item| item.ident == trait_assoc_item.ident).map(fix_span)
185+
{
186+
cause.span = impl_item_span;
194187
}
195188
}
196189
}

src/librustdoc/html/static/main.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ function defocusSearchBar() {
9191

9292
var disableShortcuts = getCurrentValue("rustdoc-disable-shortcuts") === "true";
9393
var search_input = getSearchInput();
94+
var searchTimeout = null;
9495

9596
// On the search screen, so you remain on the last tab you opened.
9697
//
@@ -101,6 +102,13 @@ function defocusSearchBar() {
101102

102103
var titleBeforeSearch = document.title;
103104

105+
function clearInputTimeout() {
106+
if (searchTimeout !== null) {
107+
clearTimeout(searchTimeout);
108+
searchTimeout = null;
109+
}
110+
}
111+
104112
function getPageId() {
105113
var id = document.location.href.split("#")[1];
106114
if (id) {
@@ -355,6 +363,7 @@ function defocusSearchBar() {
355363
if (hasClass(help, "hidden") === false) {
356364
displayHelp(false, ev, help);
357365
} else if (hasClass(search, "hidden") === false) {
366+
clearInputTimeout();
358367
ev.preventDefault();
359368
hideSearchResults(search);
360369
document.title = titleBeforeSearch;
@@ -1810,9 +1819,8 @@ function defocusSearchBar() {
18101819
}
18111820

18121821
function startSearch() {
1813-
var searchTimeout;
18141822
var callback = function() {
1815-
clearTimeout(searchTimeout);
1823+
clearInputTimeout();
18161824
if (search_input.value.length === 0) {
18171825
if (browserSupportsHistoryApi()) {
18181826
history.replaceState("", window.currentCrate + " - Rust", "?search=");
@@ -1826,7 +1834,7 @@ function defocusSearchBar() {
18261834
search_input.oninput = callback;
18271835
document.getElementsByClassName("search-form")[0].onsubmit = function(e) {
18281836
e.preventDefault();
1829-
clearTimeout(searchTimeout);
1837+
clearInputTimeout();
18301838
search();
18311839
};
18321840
search_input.onchange = function(e) {
@@ -1835,7 +1843,7 @@ function defocusSearchBar() {
18351843
return;
18361844
}
18371845
// Do NOT e.preventDefault() here. It will prevent pasting.
1838-
clearTimeout(searchTimeout);
1846+
clearInputTimeout();
18391847
// zero-timeout necessary here because at the time of event handler execution the
18401848
// pasted content is not in the input field yet. Shouldn’t make any difference for
18411849
// change, though.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
trait Bar {
2+
type Ok;
3+
type Sibling: Bar2<Ok=char>;
4+
}
5+
trait Bar2 {
6+
type Ok;
7+
}
8+
9+
struct Foo;
10+
struct Foo2;
11+
12+
impl Bar for Foo { //~ ERROR type mismatch resolving `<Foo2 as Bar2>::Ok == char`
13+
type Ok = ();
14+
type Sibling = Foo2;
15+
}
16+
impl Bar2 for Foo2 {
17+
type Ok = u32;
18+
}
19+
20+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0271]: type mismatch resolving `<Foo2 as Bar2>::Ok == char`
2+
--> $DIR/issue-72806.rs:12:6
3+
|
4+
LL | impl Bar for Foo {
5+
| ^^^ expected `u32`, found `char`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0271`.

0 commit comments

Comments
 (0)