diff --git a/RELEASES.md b/RELEASES.md index 7cba27e134a78..100993bb75cec 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -100,8 +100,8 @@ Compatibility Notes source file rather than the previous format of ``.][70969] **Note:** this may not point a file that actually exists on the user's system. - [The minimum required external LLVM version has been bumped to LLVM 8.][71147] -- [`mem::{zeroed, uninitialised, MaybeUninit}` will now panic when used with types - that do not allow zero initialization such as `NonZeroU8`.][66059] This was +- [`mem::{zeroed, uninitialised}` will now panic when used with types that do + not allow zero initialization such as `NonZeroU8`.][66059] This was previously a warning. - [In 1.45.0 (the next release) converting a `f64` to `u32` using the `as` operator has been defined as a saturating operation.][71269] This was previously diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index 2361749f16645..ff333f77334f7 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2173,7 +2173,7 @@ impl [T] { /// /// The length of `src` must be the same as `self`. /// - /// If `src` implements `Copy`, it can be more performant to use + /// If `T` implements `Copy`, it can be more performant to use /// [`copy_from_slice`]. /// /// # Panics @@ -2244,7 +2244,7 @@ impl [T] { /// /// The length of `src` must be the same as `self`. /// - /// If `src` does not implement `Copy`, use [`clone_from_slice`]. + /// If `T` does not implement `Copy`, use [`clone_from_slice`]. /// /// # Panics /// diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index ab4f4aa7c73c8..3b854b56c320d 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -1959,8 +1959,11 @@ fn test_range() { #[test] fn test_char_range() { use std::char; - assert!(('\0'..=char::MAX).eq((0..=char::MAX as u32).filter_map(char::from_u32))); - assert!(('\0'..=char::MAX).rev().eq((0..=char::MAX as u32).filter_map(char::from_u32).rev())); + // Miri is too slow + let from = if cfg!(miri) { char::from_u32(0xD800 - 10).unwrap() } else { '\0' }; + let to = if cfg!(miri) { char::from_u32(0xDFFF + 10).unwrap() } else { char::MAX }; + assert!((from..=to).eq((from as u32..=to as u32).filter_map(char::from_u32))); + assert!((from..=to).rev().eq((from as u32..=to as u32).filter_map(char::from_u32).rev())); assert_eq!(('\u{D7FF}'..='\u{E000}').count(), 2); assert_eq!(('\u{D7FF}'..='\u{E000}').size_hint(), (2, Some(2))); diff --git a/src/librustc_trait_selection/traits/wf.rs b/src/librustc_trait_selection/traits/wf.rs index 714ca7a30cff6..39c7528a63240 100644 --- a/src/librustc_trait_selection/traits/wf.rs +++ b/src/librustc_trait_selection/traits/wf.rs @@ -172,25 +172,18 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>( }; match pred.kind() { ty::PredicateKind::Projection(proj) => { - // The obligation comes not from the current `impl` nor the `trait` being - // implemented, but rather from a "second order" obligation, like in - // `src/test/ui/associated-types/point-at-type-on-obligation-failure.rs`. - let trait_assoc_item = tcx.associated_item(proj.projection_def_id()); - if let Some(impl_item_span) = - items.iter().find(|item| item.ident == trait_assoc_item.ident).map(fix_span) - { - cause.span = impl_item_span; - } else { - let kind = &proj.ty().skip_binder().kind; - if let ty::Projection(projection_ty) = kind { - // This happens when an associated type has a projection coming from another - // associated type. See `traits-assoc-type-in-supertrait-bad.rs`. - let trait_assoc_item = tcx.associated_item(projection_ty.item_def_id); - if let Some(impl_item_span) = - items.iter().find(|item| item.ident == trait_assoc_item.ident).map(fix_span) - { - cause.span = impl_item_span; - } + // The obligation comes not from the current `impl` nor the `trait` being implemented, + // but rather from a "second order" obligation, where an associated type has a + // projection coming from another associated type. See + // `src/test/ui/associated-types/point-at-type-on-obligation-failure.rs` and + // `traits-assoc-type-in-supertrait-bad.rs`. + let kind = &proj.ty().skip_binder().kind; + if let ty::Projection(projection_ty) = kind { + let trait_assoc_item = tcx.associated_item(projection_ty.item_def_id); + if let Some(impl_item_span) = + items.iter().find(|item| item.ident == trait_assoc_item.ident).map(fix_span) + { + cause.span = impl_item_span; } } } diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 22c9426db2036..ac5a2f96b26c6 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -91,6 +91,7 @@ function defocusSearchBar() { var disableShortcuts = getCurrentValue("rustdoc-disable-shortcuts") === "true"; var search_input = getSearchInput(); + var searchTimeout = null; // On the search screen, so you remain on the last tab you opened. // @@ -101,6 +102,13 @@ function defocusSearchBar() { var titleBeforeSearch = document.title; + function clearInputTimeout() { + if (searchTimeout !== null) { + clearTimeout(searchTimeout); + searchTimeout = null; + } + } + function getPageId() { var id = document.location.href.split("#")[1]; if (id) { @@ -355,6 +363,7 @@ function defocusSearchBar() { if (hasClass(help, "hidden") === false) { displayHelp(false, ev, help); } else if (hasClass(search, "hidden") === false) { + clearInputTimeout(); ev.preventDefault(); hideSearchResults(search); document.title = titleBeforeSearch; @@ -1810,9 +1819,8 @@ function defocusSearchBar() { } function startSearch() { - var searchTimeout; var callback = function() { - clearTimeout(searchTimeout); + clearInputTimeout(); if (search_input.value.length === 0) { if (browserSupportsHistoryApi()) { history.replaceState("", window.currentCrate + " - Rust", "?search="); @@ -1826,7 +1834,7 @@ function defocusSearchBar() { search_input.oninput = callback; document.getElementsByClassName("search-form")[0].onsubmit = function(e) { e.preventDefault(); - clearTimeout(searchTimeout); + clearInputTimeout(); search(); }; search_input.onchange = function(e) { @@ -1835,7 +1843,7 @@ function defocusSearchBar() { return; } // Do NOT e.preventDefault() here. It will prevent pasting. - clearTimeout(searchTimeout); + clearInputTimeout(); // zero-timeout necessary here because at the time of event handler execution the // pasted content is not in the input field yet. Shouldn’t make any difference for // change, though. diff --git a/src/test/ui/associated-types/issue-72806.rs b/src/test/ui/associated-types/issue-72806.rs new file mode 100644 index 0000000000000..ae63781d568a1 --- /dev/null +++ b/src/test/ui/associated-types/issue-72806.rs @@ -0,0 +1,20 @@ +trait Bar { + type Ok; + type Sibling: Bar2; +} +trait Bar2 { + type Ok; +} + +struct Foo; +struct Foo2; + +impl Bar for Foo { //~ ERROR type mismatch resolving `::Ok == char` + type Ok = (); + type Sibling = Foo2; +} +impl Bar2 for Foo2 { + type Ok = u32; +} + +fn main() {} diff --git a/src/test/ui/associated-types/issue-72806.stderr b/src/test/ui/associated-types/issue-72806.stderr new file mode 100644 index 0000000000000..03a6565848dc3 --- /dev/null +++ b/src/test/ui/associated-types/issue-72806.stderr @@ -0,0 +1,9 @@ +error[E0271]: type mismatch resolving `::Ok == char` + --> $DIR/issue-72806.rs:12:6 + | +LL | impl Bar for Foo { + | ^^^ expected `u32`, found `char` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0271`.