aboutsummaryrefslogtreecommitdiff
path: root/src/Module.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-10-17 15:19:16 +0300
committerVeikka Tuominen <git@vexu.eu>2022-10-19 01:38:19 +0300
commit6582896ee00cd6b05b2f0a1d845b4a77d6bf7c25 (patch)
treee1b299ed7e33c5fbb18c163c851b3e3804b1ce2f /src/Module.zig
parent4e134f6dcb02000151c395718eb2c24977100013 (diff)
downloadzig-6582896ee00cd6b05b2f0a1d845b4a77d6bf7c25.tar.gz
zig-6582896ee00cd6b05b2f0a1d845b4a77d6bf7c25.zip
Sema: remove unresolved inferred allocs
Closes #2557
Diffstat (limited to 'src/Module.zig')
-rw-r--r--src/Module.zig12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/Module.zig b/src/Module.zig
index 4edba007e9..396e92ed79 100644
--- a/src/Module.zig
+++ b/src/Module.zig
@@ -5612,6 +5612,18 @@ pub fn analyzeFnBody(mod: *Module, func: *Fn, arena: Allocator) SemaError!Air {
else => |e| return e,
};
+ {
+ var it = sema.unresolved_inferred_allocs.keyIterator();
+ while (it.next()) |ptr_inst| {
+ // The lack of a resolve_inferred_alloc means that this instruction
+ // is unused so it just has to be a no-op.
+ sema.air_instructions.set(ptr_inst.*, .{
+ .tag = .alloc,
+ .data = .{ .ty = Type.initTag(.single_const_pointer_to_comptime_int) },
+ });
+ }
+ }
+
// If we don't get an error return trace from a caller, create our own.
if (func.calls_or_awaits_errorable_fn and
mod.comp.bin_file.options.error_return_tracing and