Files
rust/library/coretests
Jacob Pratt f8ee207a51 Rollup merge of #153563 - Urgau:lint-panics-when-n-is-zero, r=fee1-dead,ShoyuVanilla
Lint against iterator functions that panic when `N` is zero

This PR extends the deny-by-default `unconditional_panic` lint, by linting on iterator functions that panics when `N` (chunks/windows size) is zero[^attr].

Those methods are [documented](https://doc.rust-lang.org/std/primitive.slice.html#panics-11) to panic if `N` is zero.

```
error: this operation will panic at runtime
  --> $DIR/const-n-is-zero.rs:11:13
   |
LL |     let _ = s.array_windows::<0>();
   |             ^^^^^^^^^^^^^^^^^^^^^^ const parameter `N` is zero
   |
   = note: `#[deny(unconditional_panic)]` on by default
```

cc @rust-lang/libs-api

[^attr]: this is done by introducing a new internal attribute on the const parameter: `#[rustc_panics_when_zero]`
2026-07-28 01:38:30 -04:00
..
…