mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
frontend: fix populateTestFunctions accessing the wrong module
The test runner reads the list of test function pointers from its own builtin module, which is the root_mod, not main_mod.
This commit is contained in:
parent
8fa4496909
commit
196ddf010c
@ -5307,7 +5307,7 @@ pub fn populateTestFunctions(
|
||||
) !void {
|
||||
const gpa = mod.gpa;
|
||||
const ip = &mod.intern_pool;
|
||||
const builtin_mod = mod.main_mod.getBuiltinDependency();
|
||||
const builtin_mod = mod.root_mod.getBuiltinDependency();
|
||||
const builtin_file = (mod.importPkg(builtin_mod) catch unreachable).file;
|
||||
const root_decl = mod.declPtr(builtin_file.root_decl.unwrap().?);
|
||||
const builtin_namespace = mod.namespacePtr(root_decl.src_namespace);
|
||||
|
||||
@ -466,6 +466,9 @@ pub fn createLimited(gpa: Allocator, options: LimitedOptions) Allocator.Error!*P
|
||||
return mod;
|
||||
}
|
||||
|
||||
/// Asserts that the module has a builtin module, which is not true for non-zig
|
||||
/// modules such as ones only used for `@embedFile`, or the root module when
|
||||
/// there is no Zig Compilation Unit.
|
||||
pub fn getBuiltinDependency(m: Module) *Module {
|
||||
const result = m.deps.values()[0];
|
||||
assert(result.isBuiltin());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user