You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// This file is referred to as 'bug.zig' belowconststd=@import("std");
constImportedStruct=@import("this-file-does-not-exist");
constWrappedImportedStruct=struct {
x: ImportedStruct, // indirection is important
};
constA=struct {
// removing the `x` field prevents the crash but also reports `duplicate struct field: 'f'`x: u64,
f: ?*constfn () WrappedImportedStruct,
};
fninit() ?std.hash_map.AutoHashMap(*A, void) {
returnnull;
}
pubfnmain() void {
_=init();
}
$ zig version
0.11.0
$ zig build-exe bug.zig
bug.zig:3:32: error: no package named 'this-file-does-not-exist' available within package 'root'
const ImportedStruct = @import("this-file-does-not-exist");
^~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
WrappedImportedStruct: bug.zig:6:8
WrappedImportedStruct: bug.zig:5:35
remaining reference traces hidden; use '-freference-trace' to see all reference traces
Expected Behavior
No crash
The text was updated successfully, but these errors were encountered:
emulbreh
added
the
bug
Observed behavior contradicts documented or intended behavior
label
Dec 12, 2023
As of 0.14.0-dev.2546+0ff0bdb4a, this bug appears to have been fixed. Running zig build-exe bug.zig on the code provided in the issue description gives this output:
bug.zig:3:32: error: no module named 'this-file-does-not-exist' available within module bug
const ImportedStruct = @import("this-file-does-not-exist");
^~~~~~~~~~~~~~~~~~~~~~~~~~
referenced by:
bug.WrappedImportedStruct: bug.zig:6:8
WrappedImportedStruct: bug.zig:5:31
9 reference(s) hidden; use '-freference-trace=11' to see all references
Zig Version
0.12.0-dev.1802+56deb5b05
Steps to Reproduce and Observed Behavior
Other versions
Expected Behavior
No crash
The text was updated successfully, but these errors were encountered: