diff options
| author | bors <bors@rust-lang.org> | 2022-05-10 15:58:17 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-05-10 15:58:17 +0000 |
| commit | d4c364347ce65cf083d4419195b8232440928d4d (patch) | |
| tree | 5930ec89b5ac33c607c0475a79d7ac17bf278d92 /src | |
| parent | eead58e75bb3a1d9f00b5a988704328fed6bb2c9 (diff) | |
| parent | c5f2c4476e1c72315e7bf405a2e15b5c9489c001 (diff) | |
| download | rust-d4c364347ce65cf083d4419195b8232440928d4d.tar.gz rust-d4c364347ce65cf083d4419195b8232440928d4d.zip | |
Auto merge of #96904 - JohnTitor:rollup-f1sz5x0, r=JohnTitor
Rollup of 6 pull requests Successful merges: - #96717 (Handle mismatched generic param kinds in trait impls betterly) - #96725 (Expose process windows_process_extensions_main_thread_handle on Windows) - #96849 (Move some tests to more reasonable places) - #96861 (Use Rust 2021 prelude in std itself.) - #96879 (rustdoc: search result ranking fix) - #96882 (Don't subst an AdtDef with its own substs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'src')
25 files changed, 190 insertions, 18 deletions
diff --git a/src/librustdoc/html/static/js/search.js b/src/librustdoc/html/static/js/search.js index 677e9b5f03a..7754d626e20 100644 --- a/src/librustdoc/html/static/js/search.js +++ b/src/librustdoc/html/static/js/search.js @@ -1323,7 +1323,6 @@ window.initSearch = rawSearchIndex => { } } lev = levenshtein(searchWord, elem.pathLast); - lev += lev_add; if (lev > 0 && elem.pathLast.length > 2 && searchWord.indexOf(elem.pathLast) > -1) { if (elem.pathLast.length < 6) { @@ -1332,6 +1331,7 @@ window.initSearch = rawSearchIndex => { lev = 0; } } + lev += lev_add; if (lev > MAX_LEV_DISTANCE) { return; } else if (index !== -1 && elem.fullPath.length < 2) { diff --git a/src/test/rustdoc-js-std/path-ordering.js b/src/test/rustdoc-js-std/path-ordering.js new file mode 100644 index 00000000000..7dcdd402312 --- /dev/null +++ b/src/test/rustdoc-js-std/path-ordering.js @@ -0,0 +1,12 @@ +const QUERY = 'hashset::insert'; + +const EXPECTED = { + 'others': [ + // ensure hashset::insert comes first + { 'path': 'std::collections::hash_set::HashSet', 'name': 'insert' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_with' }, + { 'path': 'std::collections::hash_set::HashSet', 'name': 'get_or_insert_owned' }, + { 'path': 'std::collections::hash_map::HashMap', 'name': 'insert' }, + ], +}; diff --git a/src/test/rustdoc-js/path-ordering.js b/src/test/rustdoc-js/path-ordering.js new file mode 100644 index 00000000000..4aee569b0f4 --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.js @@ -0,0 +1,14 @@ +// exact-check + +const QUERY = 'b::ccccccc'; + +const EXPECTED = { + 'others': [ + // `ccccccc` is an exact match for all three of these. + // However `b` is a closer match for `bb` than for any + // of the others, so it ought to go first. + { 'path': 'path_ordering::bb', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::aa', 'name': 'Ccccccc' }, + { 'path': 'path_ordering::dd', 'name': 'Ccccccc' }, + ], +}; diff --git a/src/test/rustdoc-js/path-ordering.rs b/src/test/rustdoc-js/path-ordering.rs new file mode 100644 index 00000000000..7843cf7f9dc --- /dev/null +++ b/src/test/rustdoc-js/path-ordering.rs @@ -0,0 +1,9 @@ +pub mod dd { + pub struct Ccccccc; +} +pub mod aa { + pub struct Ccccccc; +} +pub mod bb { + pub struct Ccccccc; +} diff --git a/src/test/ui/issues/issue-28934.rs b/src/test/ui/borrowck/issue-28934.rs index 1e48878f632..1e48878f632 100644 --- a/src/test/ui/issues/issue-28934.rs +++ b/src/test/ui/borrowck/issue-28934.rs diff --git a/src/test/ui/issues/issue-6801.rs b/src/test/ui/closures/issue-6801.rs index 694d86feb5a..694d86feb5a 100644 --- a/src/test/ui/issues/issue-6801.rs +++ b/src/test/ui/closures/issue-6801.rs diff --git a/src/test/ui/issues/issue-6801.stderr b/src/test/ui/closures/issue-6801.stderr index 48c6acd1f49..48c6acd1f49 100644 --- a/src/test/ui/issues/issue-6801.stderr +++ b/src/test/ui/closures/issue-6801.stderr diff --git a/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.rs b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.rs new file mode 100644 index 00000000000..5c9323261a9 --- /dev/null +++ b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.rs @@ -0,0 +1,41 @@ +trait Trait { + fn foo<U>() {} +} +impl Trait for () { + fn foo<const M: u64>() {} + //~^ error: method `foo` has an incompatible generic parameter for trait +} + +trait Other { + fn bar<const M: u8>() {} +} +impl Other for () { + fn bar<T>() {} + //~^ error: method `bar` has an incompatible generic parameter for trait +} + +trait Uwu { + fn baz<const N: u32>() {} +} +impl Uwu for () { + fn baz<const N: i32>() {} + //~^ error: method `baz` has an incompatible generic parameter for trait +} + +trait Aaaaaa { + fn bbbb<const N: u32, T>() {} +} +impl Aaaaaa for () { + fn bbbb<T, const N: u32>() {} + //~^ error: method `bbbb` has an incompatible generic parameter for trait +} + +trait Names { + fn abcd<T, const N: u32>() {} +} +impl Names for () { + fn abcd<const N: u32, T>() {} + //~^ error: method `abcd` has an incompatible generic parameter for trait +} + +fn main() {} diff --git a/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.stderr b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.stderr new file mode 100644 index 00000000000..3455f2c8ea9 --- /dev/null +++ b/src/test/ui/const-generics/defaults/mismatched_ty_const_in_trait_impl.stderr @@ -0,0 +1,68 @@ +error[E0053]: method `foo` has an incompatible generic parameter for trait `Trait` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:5:12 + | +LL | trait Trait { + | ----- +LL | fn foo<U>() {} + | - expected type parameter +LL | } +LL | impl Trait for () { + | ----------------- +LL | fn foo<const M: u64>() {} + | ^^^^^^^^^^^^ found const parameter of type `u64` + +error[E0053]: method `bar` has an incompatible generic parameter for trait `Other` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:13:12 + | +LL | trait Other { + | ----- +LL | fn bar<const M: u8>() {} + | ----------- expected const parameter of type `u8` +LL | } +LL | impl Other for () { + | ----------------- +LL | fn bar<T>() {} + | ^ found type parameter + +error[E0053]: method `baz` has an incompatible generic parameter for trait `Uwu` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:21:12 + | +LL | trait Uwu { + | --- +LL | fn baz<const N: u32>() {} + | ------------ expected const parameter of type `u32` +LL | } +LL | impl Uwu for () { + | --------------- +LL | fn baz<const N: i32>() {} + | ^^^^^^^^^^^^ found const parameter of type `i32` + +error[E0053]: method `bbbb` has an incompatible generic parameter for trait `Aaaaaa` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:29:13 + | +LL | trait Aaaaaa { + | ------ +LL | fn bbbb<const N: u32, T>() {} + | ------------ expected const parameter of type `u32` +LL | } +LL | impl Aaaaaa for () { + | ------------------ +LL | fn bbbb<T, const N: u32>() {} + | ^ found type parameter + +error[E0053]: method `abcd` has an incompatible generic parameter for trait `Names` + --> $DIR/mismatched_ty_const_in_trait_impl.rs:37:13 + | +LL | trait Names { + | ----- +LL | fn abcd<T, const N: u32>() {} + | - expected type parameter +LL | } +LL | impl Names for () { + | ----------------- +LL | fn abcd<const N: u32, T>() {} + | ^^^^^^^^^^^^ found const parameter of type `u32` + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/const-generics/issues/issue-86820.rs b/src/test/ui/const-generics/issues/issue-86820.rs index 04650403c6b..ae4bd943fd4 100644 --- a/src/test/ui/const-generics/issues/issue-86820.rs +++ b/src/test/ui/const-generics/issues/issue-86820.rs @@ -1,6 +1,6 @@ // Regression test for the ICE described in #86820. -#![allow(unused,dead_code)] +#![allow(unused, dead_code)] use std::ops::BitAnd; const C: fn() = || is_set(); @@ -9,13 +9,12 @@ fn is_set() { } trait Bits { - fn bit<const I : u8>(self) -> bool; - //~^ NOTE: the const parameter `I` has type `usize`, but the declaration in trait `Bits::bit` has type `u8` + fn bit<const I: u8>(self) -> bool; } impl Bits for u8 { - fn bit<const I : usize>(self) -> bool { - //~^ ERROR: method `bit` has an incompatible const parameter type for trait [E0053] + fn bit<const I: usize>(self) -> bool { + //~^ ERROR: method `bit` has an incompatible generic parameter for trait `Bits` [E0053] let i = 1 << I; let mask = u8::from(i); mask & self == mask diff --git a/src/test/ui/const-generics/issues/issue-86820.stderr b/src/test/ui/const-generics/issues/issue-86820.stderr index f7b8d80eeca..3a9cd957f35 100644 --- a/src/test/ui/const-generics/issues/issue-86820.stderr +++ b/src/test/ui/const-generics/issues/issue-86820.stderr @@ -1,14 +1,15 @@ -error[E0053]: method `bit` has an incompatible const parameter type for trait - --> $DIR/issue-86820.rs:17:12 +error[E0053]: method `bit` has an incompatible generic parameter for trait `Bits` + --> $DIR/issue-86820.rs:16:12 | -LL | fn bit<const I : usize>(self) -> bool { - | ^^^^^^^^^^^^^^^ - | -note: the const parameter `I` has type `usize`, but the declaration in trait `Bits::bit` has type `u8` - --> $DIR/issue-86820.rs:12:12 - | -LL | fn bit<const I : u8>(self) -> bool; - | ^^^^^^^^^^^^ +LL | trait Bits { + | ---- +LL | fn bit<const I: u8>(self) -> bool; + | ----------- expected const parameter of type `u8` +... +LL | impl Bits for u8 { + | ---------------- +LL | fn bit<const I: usize>(self) -> bool { + | ^^^^^^^^^^^^^^ found const parameter of type `usize` error: aborting due to previous error diff --git a/src/test/ui/generic-associated-types/const_params_have_right_type.rs b/src/test/ui/generic-associated-types/const_params_have_right_type.rs new file mode 100644 index 00000000000..6bed8e3aff9 --- /dev/null +++ b/src/test/ui/generic-associated-types/const_params_have_right_type.rs @@ -0,0 +1,12 @@ +#![feature(generic_associated_types)] + +trait Trait { + type Foo<const N: u8>; +} + +impl Trait for () { + type Foo<const N: u64> = u32; + //~^ error: type `Foo` has an incompatible generic parameter for trait +} + +fn main() {} diff --git a/src/test/ui/generic-associated-types/const_params_have_right_type.stderr b/src/test/ui/generic-associated-types/const_params_have_right_type.stderr new file mode 100644 index 00000000000..89c993dee5e --- /dev/null +++ b/src/test/ui/generic-associated-types/const_params_have_right_type.stderr @@ -0,0 +1,16 @@ +error[E0053]: type `Foo` has an incompatible generic parameter for trait `Trait` + --> $DIR/const_params_have_right_type.rs:8:14 + | +LL | trait Trait { + | ----- +LL | type Foo<const N: u8>; + | ----------- expected const parameter of type `u8` +... +LL | impl Trait for () { + | ----------------- +LL | type Foo<const N: u64> = u32; + | ^^^^^^^^^^^^ found const parameter of type `u64` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0053`. diff --git a/src/test/ui/issues/issue-38715.rs b/src/test/ui/macros/issue-38715.rs index 9a9a501cae1..9a9a501cae1 100644 --- a/src/test/ui/issues/issue-38715.rs +++ b/src/test/ui/macros/issue-38715.rs diff --git a/src/test/ui/issues/issue-38715.stderr b/src/test/ui/macros/issue-38715.stderr index c87d9f7360b..c87d9f7360b 100644 --- a/src/test/ui/issues/issue-38715.stderr +++ b/src/test/ui/macros/issue-38715.stderr diff --git a/src/test/ui/continue-after-missing-main.nll.stderr b/src/test/ui/nll/continue-after-missing-main.nll.stderr index ebebabe349b..ebebabe349b 100644 --- a/src/test/ui/continue-after-missing-main.nll.stderr +++ b/src/test/ui/nll/continue-after-missing-main.nll.stderr diff --git a/src/test/ui/continue-after-missing-main.rs b/src/test/ui/nll/continue-after-missing-main.rs index 1019cacce64..1019cacce64 100644 --- a/src/test/ui/continue-after-missing-main.rs +++ b/src/test/ui/nll/continue-after-missing-main.rs diff --git a/src/test/ui/continue-after-missing-main.stderr b/src/test/ui/nll/continue-after-missing-main.stderr index 29e7dc1e56c..29e7dc1e56c 100644 --- a/src/test/ui/continue-after-missing-main.stderr +++ b/src/test/ui/nll/continue-after-missing-main.stderr diff --git a/src/test/ui/issues/issue-48803.rs b/src/test/ui/nll/issue-48803.rs index f7fd04179f2..f7fd04179f2 100644 --- a/src/test/ui/issues/issue-48803.rs +++ b/src/test/ui/nll/issue-48803.rs diff --git a/src/test/ui/issues/issue-48803.stderr b/src/test/ui/nll/issue-48803.stderr index 2f94039c0c3..2f94039c0c3 100644 --- a/src/test/ui/issues/issue-48803.stderr +++ b/src/test/ui/nll/issue-48803.stderr diff --git a/src/test/ui/issues/issue-52533-1.nll.stderr b/src/test/ui/nll/issue-52533-1.nll.stderr index 20f19b25967..20f19b25967 100644 --- a/src/test/ui/issues/issue-52533-1.nll.stderr +++ b/src/test/ui/nll/issue-52533-1.nll.stderr diff --git a/src/test/ui/issues/issue-52533-1.rs b/src/test/ui/nll/issue-52533-1.rs index c80f43237fc..c80f43237fc 100644 --- a/src/test/ui/issues/issue-52533-1.rs +++ b/src/test/ui/nll/issue-52533-1.rs diff --git a/src/test/ui/issues/issue-52533-1.stderr b/src/test/ui/nll/issue-52533-1.stderr index 475c7d0b48b..475c7d0b48b 100644 --- a/src/test/ui/issues/issue-52533-1.stderr +++ b/src/test/ui/nll/issue-52533-1.stderr diff --git a/src/test/ui/issues/issue-14940.rs b/src/test/ui/process/issue-14940.rs index 98a4af0c467..98a4af0c467 100644 --- a/src/test/ui/issues/issue-14940.rs +++ b/src/test/ui/process/issue-14940.rs diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index 6b715f727b2..5712e84adbc 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -7,8 +7,8 @@ use std::path::Path; const ENTRY_LIMIT: usize = 1000; // FIXME: The following limits should be reduced eventually. -const ROOT_ENTRY_LIMIT: usize = 977; -const ISSUES_ENTRY_LIMIT: usize = 2278; +const ROOT_ENTRY_LIMIT: usize = 974; +const ISSUES_ENTRY_LIMIT: usize = 2248; fn check_entries(path: &Path, bad: &mut bool) { let dirs = walkdir::WalkDir::new(&path.join("test/ui")) |
