address review

This commit is contained in:
b-naber 2023-07-10 22:11:21 +00:00
parent 1c217b6d8a
commit 65f92a52bf
8 changed files with 51 additions and 102 deletions

View file

@ -30,9 +30,8 @@ fn main() {
}
fn another_fn_to_avoid_suppression() {
match Default
//~^ ERROR expected value, found trait
{
match Default::default() {
[] => {}
//~^ ERROR type annotations needed
};
}

View file

@ -4,12 +4,6 @@ error[E0425]: cannot find value `does_not_exist` in this scope
LL | match does_not_exist {
| ^^^^^^^^^^^^^^ not found in this scope
error[E0423]: expected value, found trait `Default`
--> $DIR/slice-pat-type-mismatches.rs:33:11
|
LL | match Default
| ^^^^^^^ not a value
error[E0529]: expected an array or slice, found `String`
--> $DIR/slice-pat-type-mismatches.rs:3:9
|
@ -28,7 +22,13 @@ error[E0528]: pattern requires at least 4 elements but array has 3
LL | [0, 1, 2, 3, x @ ..] => {}
| ^^^^^^^^^^^^^^^^^^^^ pattern cannot match array of 3 elements
error[E0282]: type annotations needed
--> $DIR/slice-pat-type-mismatches.rs:34:9
|
LL | [] => {}
| ^^ cannot infer type
error: aborting due to 5 previous errors
Some errors have detailed explanations: E0423, E0425, E0527, E0528, E0529.
For more information about an error, try `rustc --explain E0423`.
Some errors have detailed explanations: E0282, E0425, E0527, E0528, E0529.
For more information about an error, try `rustc --explain E0282`.

View file

@ -1,4 +1,7 @@
// check-pass
// Test that we infer the expected type of a pattern to an array of the given length.
#![allow(unused_variables)]
struct Zeroes;
impl Into<[usize; 2]> for Zeroes {

View file

@ -1,3 +1,5 @@
// Test that we do not infer the expected types of patterns to an array
// if we're in a refutable pattern.
#![allow(unused_variables)]
struct Zeroes;

View file

@ -1,5 +1,5 @@
error[E0282]: type annotations needed
--> $DIR/slice-pattern-refutable.rs:12:9
--> $DIR/slice-pattern-refutable.rs:14:9
|
LL | let [a, b, c] = Zeroes.into() else {
| ^^^^^^^^^
@ -10,7 +10,7 @@ LL | let [a, b, c]: /* Type */ = Zeroes.into() else {
| ++++++++++++
error[E0282]: type annotations needed
--> $DIR/slice-pattern-refutable.rs:19:31
--> $DIR/slice-pattern-refutable.rs:21:31
|
LL | if let [a, b, c] = Zeroes.into() {
| --------- ^^^^
@ -23,7 +23,7 @@ LL | if let [a, b, c] = <Zeroes as Into<T>>::into(Zeroes) {
| ++++++++++++++++++++++++++ ~
error[E0282]: type annotations needed
--> $DIR/slice-pattern-refutable.rs:26:31
--> $DIR/slice-pattern-refutable.rs:28:31
|
LL | if let [a, b, c] = Zeroes.into() {
| --------- ^^^^