diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2022-09-09 15:36:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-09 15:36:35 +0200 |
| commit | 6102ff18aedd16f69b66fe313e1dc77df254ac35 (patch) | |
| tree | 880c408cccafef1204c2e6299cccab42557e996b /src/test/ui/array-slice-vec/suggest-array-length.fixed | |
| parent | 46dadd65cb565f7ff61e7d878bfc629d64930e9f (diff) | |
| parent | 1e384423a9cfd678f976cf0183c81a770da2a325 (diff) | |
| download | rust-6102ff18aedd16f69b66fe313e1dc77df254ac35.tar.gz rust-6102ff18aedd16f69b66fe313e1dc77df254ac35.zip | |
Rollup merge of #101492 - TaKO8Ki:suggest-adding-array-length-to-ref-to-array, r=oli-obk
Suggest adding array lengths to references to arrays if possible ref: https://github.com/rust-lang/rust/pull/100590#pullrequestreview-1096851146
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 } |
