diff options
| author | Matthew Lugg <mlugg@mlugg.co.uk> | 2023-11-19 16:19:06 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-19 16:19:06 +0000 |
| commit | 6b1a823b2b30d9318c9877dbdbd3d02fa939fba0 (patch) | |
| tree | 6e5afdad2397ac7224119811583d19107b6e517a /src/codegen/spirv.zig | |
| parent | 325e0f5f0e8a9ce2540ec3ec5b7cbbecac15257a (diff) | |
| parent | 9cf6c1ad11bb5f0247ff3458cba5f3bd156d1fb9 (diff) | |
| download | zig-6b1a823b2b30d9318c9877dbdbd3d02fa939fba0.tar.gz zig-6b1a823b2b30d9318c9877dbdbd3d02fa939fba0.zip | |
Merge pull request #18017 from mlugg/var-never-mutated
compiler: add error for unnecessary use of 'var'
Diffstat (limited to 'src/codegen/spirv.zig')
| -rw-r--r-- | src/codegen/spirv.zig | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/codegen/spirv.zig b/src/codegen/spirv.zig index dcb3329c57..8bee639b60 100644 --- a/src/codegen/spirv.zig +++ b/src/codegen/spirv.zig @@ -1284,7 +1284,7 @@ const DeclGen = struct { const elem_ty = ty.childType(mod); const elem_ty_ref = try self.resolveType(elem_ty, .indirect); - var total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(mod)) orelse { + const total_len = std.math.cast(u32, ty.arrayLenIncludingSentinel(mod)) orelse { return self.fail("array type of {} elements is too large", .{ty.arrayLenIncludingSentinel(mod)}); }; const ty_ref = if (!elem_ty.hasRuntimeBitsIgnoreComptime(mod)) blk: { @@ -2115,7 +2115,7 @@ const DeclGen = struct { const child_ty = ty.childType(mod); const vector_len = ty.vectorLen(mod); - var constituents = try self.gpa.alloc(IdRef, vector_len); + const constituents = try self.gpa.alloc(IdRef, vector_len); defer self.gpa.free(constituents); for (constituents, 0..) |*constituent, i| { @@ -2312,7 +2312,7 @@ const DeclGen = struct { if (ty.isVector(mod)) { const child_ty = ty.childType(mod); const vector_len = ty.vectorLen(mod); - var constituents = try self.gpa.alloc(IdRef, vector_len); + const constituents = try self.gpa.alloc(IdRef, vector_len); defer self.gpa.free(constituents); for (constituents, 0..) |*constituent, i| { @@ -2727,7 +2727,7 @@ const DeclGen = struct { const child_ty = ty.childType(mod); const vector_len = ty.vectorLen(mod); - var constituents = try self.gpa.alloc(IdRef, vector_len); + const constituents = try self.gpa.alloc(IdRef, vector_len); defer self.gpa.free(constituents); for (constituents, 0..) |*constituent, i| { |
