| ... | @@ -647,7 +647,10 @@ pub fn len(value: anytype) usize { | ... | @@ -647,7 +647,10 @@ pub fn len(value: anytype) usize { |
| 647 | indexOfSentinel(info.child, sentinel, value) | 647 | indexOfSentinel(info.child, sentinel, value) |
| 648 | else | 648 | else |
| 649 | @compileError("length of pointer with no sentinel"), | 649 | @compileError("length of pointer with no sentinel"), |
| 650 | .C => indexOfSentinel(info.child, 0, value), | 650 | .C => { |
| | 651 | assert(value != null); |
| | 652 | return indexOfSentinel(info.child, 0, value); |
| | 653 | }, |
| 651 | .Slice => value.len, | 654 | .Slice => value.len, |
| 652 | }, | 655 | }, |
| 653 | .Struct => |info| if (info.is_tuple) { | 656 | .Struct => |info| if (info.is_tuple) { |
| ... | @@ -708,7 +711,10 @@ pub fn lenZ(ptr: anytype) usize { | ... | @@ -708,7 +711,10 @@ pub fn lenZ(ptr: anytype) usize { |
| 708 | indexOfSentinel(info.child, sentinel, ptr) | 711 | indexOfSentinel(info.child, sentinel, ptr) |
| 709 | else | 712 | else |
| 710 | @compileError("length of pointer with no sentinel"), | 713 | @compileError("length of pointer with no sentinel"), |
| 711 | .C => indexOfSentinel(info.child, 0, ptr), | 714 | .C => { |
| | 715 | assert(ptr != null); |
| | 716 | return indexOfSentinel(info.child, 0, ptr); |
| | 717 | }, |
| 712 | .Slice => if (info.sentinel) |sentinel| | 718 | .Slice => if (info.sentinel) |sentinel| |
| 713 | indexOfSentinel(info.child, sentinel, ptr.ptr) | 719 | indexOfSentinel(info.child, sentinel, ptr.ptr) |
| 714 | else | 720 | else |