Skip to content

Commit 834ad9c

Browse files
committed
fix: Correct type_or_const param index bound in debug_assert
local_id is used as an index into type/const params; valid indices are 0..len_type_or_consts(). The previous <= check incorrectly allowed idx == len. Assisted by an AI coding tool (see CONTRIBUTING.md).
1 parent 9253d39 commit 834ad9c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

crates/hir-ty/src/generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl Generics {
185185
if param.parent == self.def {
186186
let idx = param.local_id.into_raw().into_u32() as usize;
187187
debug_assert!(
188-
idx <= self.params.len_type_or_consts(),
188+
idx < self.params.len_type_or_consts(),
189189
"idx: {} len: {}",
190190
idx,
191191
self.params.len_type_or_consts()

0 commit comments

Comments
 (0)