Skip to content

missing compile error for @import on absolute paths #3393

@ityonemo

Description

@ityonemo

file 1: "/home/ityonemo/helper.zig"

pub fn helper() u8 {
  return 190;
}

file 2: "/home/ityonemo/test.zig"

const std = @import("std");
const helper = @import("/home/ityonemo/helper.zig");

pub fn main() !void {
    // If this program is run without stdout attached, exit with an error.
    const stdout_file = try std.io.getStdOut();
    // If this program encounters pipe failure when printing to stdout, exit
    // with an error.

    var out_string = "Hello, world!\n";
    out_string[0] = helper.helper();

    try stdout_file.write(out_string);
}

command:
/path/to/zig/zig build-exe test.zig -dynamic --disable-gen-h --override-lib-dir /path/to/zig/lib/zig

reported compiler error:
/home/ityonemo/test.zig:2:16: error: unable to find '/home/ityonemo/helper.zig'

when you change the helper to
const helper = @import("helper.zig")

program compiles, and works as expected, (stdout: mello world!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behaviorcontributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.docs

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions