diff options
| author | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-09-07 02:37:18 +0900 |
|---|---|---|
| committer | Takayuki Maeda <takoyaki0316@gmail.com> | 2022-09-07 02:37:18 +0900 |
| commit | 1e384423a9cfd678f976cf0183c81a770da2a325 (patch) | |
| tree | 2cbd912b16f1b68b156f561906665ae88f4b4754 /src/test/ui/array-slice-vec/suggest-array-length.fixed | |
| parent | b44197abb0b3ffe4908892e1e08ab1cd721ff3b9 (diff) | |
| download | rust-1e384423a9cfd678f976cf0183c81a770da2a325.tar.gz rust-1e384423a9cfd678f976cf0183c81a770da2a325.zip | |
suggest adding array lengths to references to arrays
Diffstat (limited to 'src/test/ui/array-slice-vec/suggest-array-length.fixed')
| -rw-r--r-- | src/test/ui/array-slice-vec/suggest-array-length.fixed | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/suggest-array-length.fixed b/src/test/ui/array-slice-vec/suggest-array-length.fixed index bae3ab74af6..867c18a7d5e 100644 --- a/src/test/ui/array-slice-vec/suggest-array-length.fixed +++ b/src/test/ui/array-slice-vec/suggest-array-length.fixed @@ -5,10 +5,22 @@ fn main() { const Foo: [i32; 3] = [1, 2, 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable + const REF_FOO: &[u8; 1] = &[1]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable let foo: [i32; 3] = [1, 2, 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable let bar: [i32; 3] = [0; 3]; //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment //~| ERROR using `_` for array lengths is unstable + let ref_foo: &[i32; 3] = &[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let ref_bar: &[i32; 3] = &[0; 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable + let multiple_ref_foo: &&[i32; 3] = &&[1, 2, 3]; + //~^ ERROR in expressions, `_` can only be used on the left-hand side of an assignment + //~| ERROR using `_` for array lengths is unstable } |
