@@ -2948,18 +2948,18 @@ pub fn SplitBackwardsIterator(comptime T: type, comptime delimiter_type: Delimit
29482948
29492949/// Naively combines a series of slices with a separator.
29502950/// Allocates memory for the result, which must be freed by the caller.
2951- pub fn join (allocator : Allocator , separator : []const u8 , slices : []const []const u8 ) ! []u8 {
2951+ pub fn join (allocator : Allocator , separator : []const u8 , slices : []const []const u8 ) Allocator.Error ! []u8 {
29522952 return joinMaybeZ (allocator , separator , slices , false );
29532953}
29542954
29552955/// Naively combines a series of slices with a separator and null terminator.
29562956/// Allocates memory for the result, which must be freed by the caller.
2957- pub fn joinZ (allocator : Allocator , separator : []const u8 , slices : []const []const u8 ) ! [:0 ]u8 {
2957+ pub fn joinZ (allocator : Allocator , separator : []const u8 , slices : []const []const u8 ) Allocator.Error ! [:0 ]u8 {
29582958 const out = try joinMaybeZ (allocator , separator , slices , true );
29592959 return out [0 .. out .len - 1 :0 ];
29602960}
29612961
2962- fn joinMaybeZ (allocator : Allocator , separator : []const u8 , slices : []const []const u8 , zero : bool ) ! []u8 {
2962+ fn joinMaybeZ (allocator : Allocator , separator : []const u8 , slices : []const []const u8 , zero : bool ) Allocator.Error ! []u8 {
29632963 if (slices .len == 0 ) return if (zero ) try allocator .dupe (u8 , &[1 ]u8 {0 }) else &[0 ]u8 {};
29642964
29652965 const total_len = blk : {
@@ -3038,18 +3038,18 @@ test "joinZ" {
30383038}
30393039
30403040/// Copies each T from slices into a new slice that exactly holds all the elements.
3041- pub fn concat (allocator : Allocator , comptime T : type , slices : []const []const T ) ! []T {
3041+ pub fn concat (allocator : Allocator , comptime T : type , slices : []const []const T ) Allocator.Error ! []T {
30423042 return concatMaybeSentinel (allocator , T , slices , null );
30433043}
30443044
30453045/// Copies each T from slices into a new slice that exactly holds all the elements.
3046- pub fn concatWithSentinel (allocator : Allocator , comptime T : type , slices : []const []const T , comptime s : T ) ! [:s ]T {
3046+ pub fn concatWithSentinel (allocator : Allocator , comptime T : type , slices : []const []const T , comptime s : T ) Allocator.Error ! [:s ]T {
30473047 const ret = try concatMaybeSentinel (allocator , T , slices , s );
30483048 return ret [0 .. ret .len - 1 :s ];
30493049}
30503050
30513051/// Copies each T from slices into a new slice that exactly holds all the elements as well as the sentinel.
3052- pub fn concatMaybeSentinel (allocator : Allocator , comptime T : type , slices : []const []const T , comptime s : ? T ) ! []T {
3052+ pub fn concatMaybeSentinel (allocator : Allocator , comptime T : type , slices : []const []const T , comptime s : ? T ) Allocator.Error ! []T {
30533053 if (slices .len == 0 ) return if (s ) | sentinel | try allocator .dupe (T , &[1 ]T {sentinel }) else &[0 ]T {};
30543054
30553055 const total_len = blk : {
0 commit comments