-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Open
Labels
I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied
Description
Using the following flags
--force-warn clippy::zero_repeat_side_effects
this code:
//@ run-fail
//@ error-pattern:panic evaluated
//@ needs-subprocess
#[allow(unused_variables)]
fn main() {
let x = [panic!("panic evaluated"); 0];
}
caused the following diagnostics:
Checking _issue-23354 v0.1.0 (/tmp/icemaker_global_tempdir.o4hDRjvshrmO/icemaker_clippyfix_tempdir.6onDHlqbiYjd/_issue-23354)
warning: function or method calls as the initial value in zero-sized array initializers may cause side effects
--> src/main.rs:7:5
|
7 | let x = [panic!("panic evaluated"); 0];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: consider using: `panic!("panic evaluated"); let x: [!; 0] = [];`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#zero_repeat_side_effects
= note: requested on the command line with `--force-warn clippy::zero-repeat-side-effects`
warning: `_issue-23354` (bin "_issue-23354") generated 1 warning
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
However after applying these diagnostics, the resulting code:
//@ run-fail
//@ error-pattern:panic evaluated
//@ needs-subprocess
#[allow(unused_variables)]
fn main() {
panic!("panic evaluated"); let x: [!; 0] = [];
}
no longer compiled:
Checking _issue-23354 v0.1.0 (/tmp/icemaker_global_tempdir.o4hDRjvshrmO/icemaker_clippyfix_tempdir.6onDHlqbiYjd/_issue-23354)
error[E0658]: the `!` type is experimental
--> src/main.rs:7:40
|
7 | panic!("panic evaluated"); let x: [!; 0] = [];
| ^
|
= note: see issue #35121 <https://github.com/rust-lang/rust/issues/35121> for more information
= help: add `#![feature(never_type)]` to the crate attributes to enable
= note: this compiler was built on 2025-06-05; consider upgrading it if it is out of date
For more information about this error, try `rustc --explain E0658`.
error: could not compile `_issue-23354` (bin "_issue-23354" test) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `_issue-23354` (bin "_issue-23354") due to 1 previous error
Version:
rustc 1.89.0-nightly (cf423712b 2025-06-05)
binary: rustc
commit-hash: cf423712b9e95e9f6ec84b1ecb3d125e55ac8d56
commit-date: 2025-06-05
host: x86_64-unknown-linux-gnu
release: 1.89.0-nightly
LLVM version: 20.1.5
Metadata
Metadata
Assignees
Labels
I-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when applied