add test, bless tests
This commit is contained in:
parent
2827aa9752
commit
e18e3761ce
7 changed files with 74 additions and 49 deletions
|
@ -1,4 +1,4 @@
|
|||
// see issue #70529
|
||||
// check-pass
|
||||
struct A;
|
||||
|
||||
impl From<A> for [u8; 2] {
|
||||
|
@ -13,9 +13,7 @@ impl From<A> for [u8; 3] {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
fn main() {
|
||||
let a = A;
|
||||
let [_, _] = a.into();
|
||||
//~^ ERROR type annotations needed
|
||||
}
|
||||
|
|
|
@ -1,14 +0,0 @@
|
|||
error[E0282]: type annotations needed
|
||||
--> $DIR/infer_array_len.rs:19:9
|
||||
|
|
||||
LL | let [_, _] = a.into();
|
||||
| ^^^^^^
|
||||
|
|
||||
help: consider giving this pattern a type
|
||||
|
|
||||
LL | let [_, _]: /* Type */ = a.into();
|
||||
| ++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0282`.
|
|
@ -2,7 +2,7 @@ fn main() {
|
|||
match "foo".to_string() {
|
||||
['f', 'o', ..] => {}
|
||||
//~^ ERROR expected an array or slice, found `String`
|
||||
_ => { }
|
||||
_ => {}
|
||||
};
|
||||
|
||||
// Note that this one works with default binding modes.
|
||||
|
@ -15,7 +15,7 @@ fn main() {
|
|||
};
|
||||
|
||||
match [0, 1, 2] {
|
||||
[0] => {}, //~ ERROR pattern requires
|
||||
[0] => {} //~ ERROR pattern requires
|
||||
|
||||
[0, 1, x @ ..] => {
|
||||
let a: [_; 1] = x;
|
||||
|
@ -23,14 +23,16 @@ fn main() {
|
|||
[0, 1, 2, 3, x @ ..] => {} //~ ERROR pattern requires
|
||||
};
|
||||
|
||||
match does_not_exist { //~ ERROR cannot find value `does_not_exist` in this scope
|
||||
[] => {}
|
||||
match does_not_exist {
|
||||
//~^ ERROR cannot find value `does_not_exist` in this scope
|
||||
[] => {} // ERROR cannot find value `does_not_exist` in this scope
|
||||
};
|
||||
}
|
||||
|
||||
fn another_fn_to_avoid_suppression() {
|
||||
match Default::default()
|
||||
match Default
|
||||
//~^ ERROR expected value, found trait
|
||||
{
|
||||
[] => {} //~ ERROR type annotations needed
|
||||
[] => {}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -4,6 +4,12 @@ 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
|
||||
|
|
||||
|
@ -13,7 +19,7 @@ LL | ['f', 'o', ..] => {}
|
|||
error[E0527]: pattern requires 1 element but array has 3
|
||||
--> $DIR/slice-pat-type-mismatches.rs:18:9
|
||||
|
|
||||
LL | [0] => {},
|
||||
LL | [0] => {}
|
||||
| ^^^ expected 3 elements
|
||||
|
||||
error[E0528]: pattern requires at least 4 elements but array has 3
|
||||
|
@ -22,13 +28,7 @@ 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: E0282, E0425, E0527, E0528, E0529.
|
||||
For more information about an error, try `rustc --explain E0282`.
|
||||
Some errors have detailed explanations: E0423, E0425, E0527, E0528, E0529.
|
||||
For more information about an error, try `rustc --explain E0423`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue