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.rs | |
| 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.rs')
| -rw-r--r-- | src/test/ui/array-slice-vec/suggest-array-length.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/array-slice-vec/suggest-array-length.rs b/src/test/ui/array-slice-vec/suggest-array-length.rs index b0867f4e396..f66b3d4a899 100644 --- a/src/test/ui/array-slice-vec/suggest-array-length.rs +++ b/src/test/ui/array-slice-vec/suggest-array-length.rs @@ -5,10 +5,22 @@ fn main() { const Foo: [i32; _] = [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]; + //~^ 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; _] = [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; _] = [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; _] = &[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; _] = &[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; _] = &&[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 } |
