From 2ed1ed9b32ae588f6a8997248d69817b5d89a133 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Fri, 4 Dec 2020 17:21:55 -0700 Subject: stage2: introduce Module.failed_root_source_file Use case: zig build-exe non_existent_file.zig Previous behavior: error.FileNotFound, followed by an error return trace Behavior after this commit: error: unable to read non_existent_file.zig: FileNotFound (end of stderr, exit code 1) This turns AllErrors.Message into a tagged union which now has the capability to represent both "plain" errors as well as source-based errors (with file, line, column, byte offset). The "no entry point found" error has moved to be a plain error message. --- src/Module.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 7ef32abcc3..20cb7bf195 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -78,6 +78,9 @@ import_table: std.StringArrayHashMapUnmanaged(*Scope.File) = .{}, /// previous analysis. generation: u32 = 0, +/// When populated it means there was an error opening/reading the root source file. +failed_root_src_file: ?anyerror = null, + stage1_flags: packed struct { have_winmain: bool = false, have_wwinmain: bool = false, -- cgit v1.2.3