| ... | @@ -33284,12 +33284,16 @@ fn analyzeSlice( | ... | @@ -33284,12 +33284,16 @@ fn analyzeSlice( |
| 33284 | try sema.addSafetyCheck(block, src, is_non_null, .unwrap_null); | 33284 | try sema.addSafetyCheck(block, src, is_non_null, .unwrap_null); |
| 33285 | } | 33285 | } |
| 33286 | | 33286 | |
| 33287 | if (slice_ty.isSlice(mod)) { | 33287 | bounds_check: { |
| 33288 | const slice_len_inst = try block.addTyOp(.slice_len, Type.usize, ptr_or_slice); | 33288 | const actual_len = if (array_ty.zigTypeTag(mod) == .Array) |
| 33289 | const actual_len = if (slice_ty.sentinel(mod) == null) | 33289 | try mod.intRef(Type.usize, array_ty.arrayLenIncludingSentinel(mod)) |
| 33290 | slice_len_inst | 33290 | else if (slice_ty.isSlice(mod)) l: { |
| 33291 | else | 33291 | const slice_len_inst = try block.addTyOp(.slice_len, Type.usize, ptr_or_slice); |
| 33292 | try sema.analyzeArithmetic(block, .add, slice_len_inst, .one, src, end_src, end_src, true); | 33292 | break :l if (slice_ty.sentinel(mod) == null) |
| | 33293 | slice_len_inst |
| | 33294 | else |
| | 33295 | try sema.analyzeArithmetic(block, .add, slice_len_inst, .one, src, end_src, end_src, true); |
| | 33296 | } else break :bounds_check; |
| 33293 | | 33297 | |
| 33294 | const actual_end = if (slice_sentinel != null) | 33298 | const actual_end = if (slice_sentinel != null) |
| 33295 | try sema.analyzeArithmetic(block, .add, end, .one, src, end_src, end_src, true) | 33299 | try sema.analyzeArithmetic(block, .add, end, .one, src, end_src, end_src, true) |