diff options
| author | bors <bors@rust-lang.org> | 2020-05-31 20:58:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-05-31 20:58:56 +0000 |
| commit | 0d93d3f4a42fd45b2a0da658d39555316a1b6793 (patch) | |
| tree | dd386e77275b945dfb439f7a3d19a1730c1a7316 | |
| parent | 5fd2f06e99a985dd896684cb2c9f8c7090eca1ab (diff) | |
| parent | 76e0ecca2b7ec2913e4980050f4659a51f231171 (diff) | |
| download | rust-0d93d3f4a42fd45b2a0da658d39555316a1b6793.tar.gz rust-0d93d3f4a42fd45b2a0da658d39555316a1b6793.zip | |
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
| -rw-r--r-- | RELEASES.md | 4 | ||||
| -rw-r--r-- | src/libcore/slice/mod.rs | 4 | ||||
| -rw-r--r-- | src/libcore/tests/iter.rs | 7 | ||||
| -rw-r--r-- | src/librustc_trait_selection/traits/wf.rs | 31 | ||||
| -rw-r--r-- | src/librustdoc/html/static/main.js | 16 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-72806.rs | 20 | ||||
| -rw-r--r-- | src/test/ui/associated-types/issue-72806.stderr | 9 |
7 files changed, 62 insertions, 29 deletions
diff --git a/RELEASES.md b/RELEASES.md index 7cba27e134a..100993bb75c 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -100,8 +100,8 @@ Compatibility Notes source file rather than the previous format of `<NAME macros>`.][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 2361749f166..ff333f77334 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -2173,7 +2173,7 @@ impl<T> [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> [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 ab4f4aa7c73..3b854b56c32 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 714ca7a30cf..39c7528a632 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 22c9426db20..ac5a2f96b26 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 00000000000..ae63781d568 --- /dev/null +++ b/src/test/ui/associated-types/issue-72806.rs @@ -0,0 +1,20 @@ +trait Bar { + type Ok; + type Sibling: Bar2<Ok=char>; +} +trait Bar2 { + type Ok; +} + +struct Foo; +struct Foo2; + +impl Bar for Foo { //~ ERROR type mismatch resolving `<Foo2 as Bar2>::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 00000000000..03a6565848d --- /dev/null +++ b/src/test/ui/associated-types/issue-72806.stderr @@ -0,0 +1,9 @@ +error[E0271]: type mismatch resolving `<Foo2 as Bar2>::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`. |
