diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-03-31 15:59:46 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-31 15:59:46 +0200 |
| commit | 3ef70fe156be1f8236c23a49c0db841207895ef9 (patch) | |
| tree | 0f9e5c446397b06ad51e574ed5b2fa8ae373544c /src/test/ui/array-slice-vec/infer_array_len.stderr | |
| parent | 38cd294ed5a90036d570b663e7bcdf8dd0fd775f (diff) | |
| parent | a3df1db8ee40f8c5dc520a5d0a37adc5a70a15be (diff) | |
| download | rust-3ef70fe156be1f8236c23a49c0db841207895ef9.tar.gz rust-3ef70fe156be1f8236c23a49c0db841207895ef9.zip | |
Rollup merge of #70562 - lcnr:const-arr_len, r=Centril
infer array len from pattern
closes #70529
This still errors in the following case
```rust
#![feature(const_generics)]
fn arr<const N: usize>() -> [u8; N] {
todo!()
}
fn main() {
match arr() {
[5, ..] => (),
//~^ ERROR cannot pattern-match on an array without a fixed length
[_, _] => (),
}
}
```
Considering that this should be rare and is harder to implement I would merge this PR without *fixing* the above.
Diffstat (limited to 'src/test/ui/array-slice-vec/infer_array_len.stderr')
| -rw-r--r-- | src/test/ui/array-slice-vec/infer_array_len.stderr | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/infer_array_len.stderr b/src/test/ui/array-slice-vec/infer_array_len.stderr new file mode 100644 index 00000000000..6eed4ce4f0c --- /dev/null +++ b/src/test/ui/array-slice-vec/infer_array_len.stderr @@ -0,0 +1,11 @@ +error[E0282]: type annotations needed + --> $DIR/infer_array_len.rs:19:9 + | +LL | let [_, _] = a.into(); + | ^^^^^^ consider giving this pattern a type + | + = note: type must be known at this point + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0282`. |
