diff options
| author | bors <bors@rust-lang.org> | 2025-01-03 22:42:57 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-03 22:42:57 +0000 |
| commit | 8d2c06d151972fefa3f0bbf04ace3beede737145 (patch) | |
| tree | e1fe1c24240be9c85eddd25167a7ac6c4fd1ef14 /tests/ui/array-slice-vec | |
| parent | 3f43b1a636738f41c48df073c5bcb97a97bf8459 (diff) | |
| parent | c02499feb11c960e79d72c2fdfb3e42053b563ec (diff) | |
| download | rust-8d2c06d151972fefa3f0bbf04ace3beede737145.tar.gz rust-8d2c06d151972fefa3f0bbf04ace3beede737145.zip | |
Auto merge of #135086 - matthiaskrgr:rollup-3sfnc1w, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #133420 (Switch rtems target to panic unwind) - #134965 (Make Boxy UwU) - #135007 (Some type-outlives computation tweaks) - #135036 (run-make-support: adjust assertion printing, add some basic sanity checks) - #135043 (rustdoc: treat `allowed_through_unstable_modules` as deprecation) - #135044 (Improve infer (`_`) suggestions in `const`s and `static`s) - #135058 (refactor bootstrap path resolution) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui/array-slice-vec')
| -rw-r--r-- | tests/ui/array-slice-vec/suggest-array-length.fixed | 25 | ||||
| -rw-r--r-- | tests/ui/array-slice-vec/suggest-array-length.rs | 25 | ||||
| -rw-r--r-- | tests/ui/array-slice-vec/suggest-array-length.stderr | 89 |
3 files changed, 58 insertions, 81 deletions
diff --git a/tests/ui/array-slice-vec/suggest-array-length.fixed b/tests/ui/array-slice-vec/suggest-array-length.fixed index 29f85da56e5..2eacc2517d3 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.fixed +++ b/tests/ui/array-slice-vec/suggest-array-length.fixed @@ -3,24 +3,21 @@ 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 + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants 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 + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants + static Statik: [i32; 3] = [1, 2, 3]; + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables + static REF_STATIK: &[u8; 1] = &[1]; + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables 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 + //~^ 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 + //~^ 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 + //~^ 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 + //~^ 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 + //~^ ERROR using `_` for array lengths is unstable } diff --git a/tests/ui/array-slice-vec/suggest-array-length.rs b/tests/ui/array-slice-vec/suggest-array-length.rs index 82d871cf875..fb4424cfed9 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.rs +++ b/tests/ui/array-slice-vec/suggest-array-length.rs @@ -3,24 +3,21 @@ 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 + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants 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 + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for constants + static Statik: [i32; _] = [1, 2, 3]; + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables + static REF_STATIK: &[u8; _] = &[1]; + //~^ ERROR the placeholder `_` is not allowed within types on item signatures for static variables 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 + //~^ 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 + //~^ 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 + //~^ 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 + //~^ 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 + //~^ ERROR using `_` for array lengths is unstable } diff --git a/tests/ui/array-slice-vec/suggest-array-length.stderr b/tests/ui/array-slice-vec/suggest-array-length.stderr index fdab7ba7064..b71be306780 100644 --- a/tests/ui/array-slice-vec/suggest-array-length.stderr +++ b/tests/ui/array-slice-vec/suggest-array-length.stderr @@ -1,67 +1,49 @@ -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:11:20 +error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/suggest-array-length.rs:5:22 | -LL | let foo: [i32; _] = [1, 2, 3]; - | ^ `_` not allowed here - -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:14:20 +LL | const Foo: [i32; _] = [1, 2, 3]; + | ^ not allowed in type signatures | -LL | let bar: [i32; _] = [0; 3]; - | ^ `_` not allowed here - -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:17:25 +help: replace this with a fully-specified type | -LL | let ref_foo: &[i32; _] = &[1, 2, 3]; - | ^ `_` not allowed here +LL | const Foo: [i32; 3] = [1, 2, 3]; + | ~~~~~~~~ -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:20:25 +error[E0121]: the placeholder `_` is not allowed within types on item signatures for constants + --> $DIR/suggest-array-length.rs:7:26 | -LL | let ref_bar: &[i32; _] = &[0; 3]; - | ^ `_` not allowed here - -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:23:35 +LL | const REF_FOO: &[u8; _] = &[1]; + | ^ not allowed in type signatures | -LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; - | ^ `_` not allowed here - -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:5:22 +help: replace this with a fully-specified type | -LL | const Foo: [i32; _] = [1, 2, 3]; - | ^ `_` not allowed here +LL | const REF_FOO: &[u8; 1] = &[1]; + | ~~~~~~~~ -error: in expressions, `_` can only be used on the left-hand side of an assignment - --> $DIR/suggest-array-length.rs:8:26 +error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/suggest-array-length.rs:9:26 | -LL | const REF_FOO: &[u8; _] = &[1]; - | ^ `_` not allowed here - -error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:5:22 +LL | static Statik: [i32; _] = [1, 2, 3]; + | ^ not allowed in type signatures | -LL | const Foo: [i32; _] = [1, 2, 3]; - | ^ help: consider specifying the array length: `3` +help: replace this with a fully-specified type | - = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +LL | static Statik: [i32; 3] = [1, 2, 3]; + | ~~~~~~~~ -error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:8:26 +error[E0121]: the placeholder `_` is not allowed within types on item signatures for static variables + --> $DIR/suggest-array-length.rs:11:30 | -LL | const REF_FOO: &[u8; _] = &[1]; - | ^ help: consider specifying the array length: `1` +LL | static REF_STATIK: &[u8; _] = &[1]; + | ^ not allowed in type signatures | - = note: see issue #85077 <https://github.com/rust-lang/rust/issues/85077> for more information - = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable - = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date +help: replace this with a fully-specified type + | +LL | static REF_STATIK: &[u8; 1] = &[1]; + | ~~~~~~~~ error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:11:20 + --> $DIR/suggest-array-length.rs:13:20 | LL | let foo: [i32; _] = [1, 2, 3]; | ^ help: consider specifying the array length: `3` @@ -71,7 +53,7 @@ LL | let foo: [i32; _] = [1, 2, 3]; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:14:20 + --> $DIR/suggest-array-length.rs:15:20 | LL | let bar: [i32; _] = [0; 3]; | ^ help: consider specifying the array length: `3` @@ -91,7 +73,7 @@ LL | let ref_foo: &[i32; _] = &[1, 2, 3]; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:20:25 + --> $DIR/suggest-array-length.rs:19:25 | LL | let ref_bar: &[i32; _] = &[0; 3]; | ^ help: consider specifying the array length: `3` @@ -101,7 +83,7 @@ LL | let ref_bar: &[i32; _] = &[0; 3]; = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date error[E0658]: using `_` for array lengths is unstable - --> $DIR/suggest-array-length.rs:23:35 + --> $DIR/suggest-array-length.rs:21:35 | LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; | ^ help: consider specifying the array length: `3` @@ -110,6 +92,7 @@ LL | let multiple_ref_foo: &&[i32; _] = &&[1, 2, 3]; = help: add `#![feature(generic_arg_infer)]` to the crate attributes to enable = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date -error: aborting due to 14 previous errors +error: aborting due to 9 previous errors -For more information about this error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0121, E0658. +For more information about an error, try `rustc --explain E0121`. |
