mach: remove compiler error for missing field in app (upstream issue fixed) (#647)
* platform: allow fieldless App * platform: remove unused field Co-authored-by: Beau McCartney <beau@beaumccartney.xyz>
This commit is contained in:
parent
5849304fba
commit
7d04252126
2 changed files with 2 additions and 14 deletions
|
|
@ -6,17 +6,8 @@ pub fn checkApplication(comptime app_pkg: type) void {
|
|||
}
|
||||
const App = app_pkg.App;
|
||||
|
||||
// If App has no fields, it gets interpretted as '*const App' when it should be '*App'
|
||||
// This gives a more useful compiler error.
|
||||
switch (@typeInfo(App)) {
|
||||
.Struct => |app| {
|
||||
if (app.fields.len == 0) {
|
||||
@compileError("App must contain fields. Example: '_unused: i32,'");
|
||||
}
|
||||
},
|
||||
else => {
|
||||
@compileError("App must be a struct type. Found:" ++ @typeName(App));
|
||||
},
|
||||
if (@typeInfo(App) != .Struct) {
|
||||
@compileError("App must be a struct type. Found:" ++ @typeName(App));
|
||||
}
|
||||
|
||||
if (@hasDecl(App, "init")) {
|
||||
|
|
|
|||
|
|
@ -7,9 +7,6 @@ const native = @import("native.zig");
|
|||
|
||||
pub const App = @This();
|
||||
|
||||
// TODO(self-hosted): https://github.com/ziglang/zig/issues/12275
|
||||
_unused: i32,
|
||||
|
||||
pub const GPUInterface = gpu.dawn.Interface;
|
||||
|
||||
const _ = gpu.Export(GPUInterface);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue