aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-04-16 19:45:58 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-04-16 19:45:58 -0700
commite13fc6b119c5593b4fccd5ae064c6b251bbe50e7 (patch)
treef54c3357f9c9b3ca0e34635dab09f4000bbf2c5b /src/Compilation.zig
parent415ef1be510e912ddbd3b73a4d20aac3fda27a0e (diff)
downloadzig-e13fc6b119c5593b4fccd5ae064c6b251bbe50e7.tar.gz
zig-e13fc6b119c5593b4fccd5ae064c6b251bbe50e7.zip
stage2: make `@import` relative to the current file
previously, it was incorrectly relative to the package directory
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 3f0937c957..7a496ccc45 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1535,7 +1535,8 @@ pub fn update(self: *Compilation) !void {
// Make sure std.zig is inside the import_table. We unconditionally need
// it for start.zig.
- _ = try module.importFile(module.root_pkg, "std");
+ const std_pkg = module.root_pkg.table.get("std").?;
+ _ = try module.importPkg(module.root_pkg, std_pkg);
// Put a work item in for every known source file to detect if
// it changed, and, if so, re-compute ZIR and then queue the job
@@ -2118,6 +2119,7 @@ fn workerAstGenFile(
// there is a missing `failed_files` error message.
error.OutOfMemory => {},
};
+ return;
},
};
@@ -2136,7 +2138,7 @@ fn workerAstGenFile(
const lock = comp.mutex.acquire();
defer lock.release();
- break :blk mod.importFile(file.pkg, import_path) catch continue;
+ break :blk mod.importFile(file, import_path) catch continue;
};
if (import_result.is_new) {
wg.start();