Skip to content

Make distinct error limit configurable#17532

Merged
andrewrk merged 1 commit intoziglang:masterfrom
Vexu:error-limit
Oct 16, 2023
Merged

Make distinct error limit configurable#17532
andrewrk merged 1 commit intoziglang:masterfrom
Vexu:error-limit

Conversation

@Vexu
Copy link
Copy Markdown
Member

@Vexu Vexu commented Oct 15, 2023

I chose to use a CLI argument instead of a const in the root file since changing it would invalidate most functions in an incremental compilation.

Closes #786

Copy link
Copy Markdown
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose to use a CLI argument instead of a const in the root file since changing it would invalidate most functions in an incremental compilation.

Changing it on the CLI creates an entirely separate cache namespace, so it's essentially the same thing. I don't think it should be a CLI argument.

@Vexu
Copy link
Copy Markdown
Member Author

Vexu commented Oct 16, 2023

Making it a const in the root file (or more likely in builtin.zig) requires it to be the first thing analyzed every update and that anything that touches errors depend on that one declaration even when most of the time it would be uncommon to change it while working on something. And unlike the other declarations that can be overwritten there this would change how the language itself worked.

Copy link
Copy Markdown
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I think you make a fair argument. Let's do the CLI flag then 👍

@andrewrk andrewrk merged commit 78855bd into ziglang:master Oct 16, 2023
@Vexu Vexu deleted the error-limit branch October 16, 2023 08:10
scheibo added a commit to scheibo/zig that referenced this pull request Oct 19, 2023
This flag was added in ziglang#17532 to close ziglang#786, but the language
reference was never updated to reflect the change.
scheibo added a commit to scheibo/zig that referenced this pull request Oct 20, 2023
This flag was added in ziglang#17532 to close ziglang#786, but the language
reference was never updated to reflect the change.
@andrewrk
Copy link
Copy Markdown
Member

Reverted in 328ec15 due to:

$ grep -IR Type.err_int ../src/
../src/codegen.zig:                        .ty = Type.err_int,
../src/codegen.zig:                        .val = try mod.intValue(Type.err_int, 0),
../src/codegen/llvm.zig:        const rhs = try o.builder.intValue(Builder.Type.err_int, errors_len);
../src/codegen/llvm.zig:            .anyerror_type => Builder.Type.err_int,
../src/codegen/llvm.zig:            => Builder.Type.err_int,
../src/codegen/llvm.zig:                    const error_type = Builder.Type.err_int;
../src/codegen/llvm.zig:                    const error_align = Type.err_int.abiAlignment(mod);
../src/codegen/llvm.zig:                    const error_size = Type.err_int.abiSize(mod);
../src/codegen/llvm.zig:                .error_set_type, .inferred_error_set_type => Builder.Type.err_int,
../src/codegen/llvm.zig:                const llvm_int = try o.builder.intConst(Builder.Type.err_int, int);
../src/codegen/llvm.zig:                    .payload => (try mod.intValue(Type.err_int, 0)).toIntern(),
../src/codegen/llvm.zig:                const error_align = Type.err_int.abiAlignment(mod);
../src/codegen/llvm.zig:                const err_align = Type.err_int.abiAlignment(mod);
../src/codegen/llvm.zig:                _ = try self.wip.ret(try o.builder.intValue(Builder.Type.err_int, 0));
../src/codegen/llvm.zig:                _ = try self.wip.ret(try o.builder.intValue(Builder.Type.err_int, 0));
../src/codegen/llvm.zig:                        try fg.wip.load(.normal, Builder.Type.err_int, err_union, .default, "")
../src/codegen/llvm.zig:                        Builder.Type.err_int,
../src/codegen/llvm.zig:            const zero = try o.builder.intValue(Builder.Type.err_int, 0);
../src/codegen/llvm.zig:        const zero = try o.builder.intValue(Builder.Type.err_int, 0);
../src/codegen/llvm.zig:            break :loaded try self.wip.load(.normal, Builder.Type.err_int, err_field_ptr, .default, "");
../src/codegen/llvm.zig:                return o.builder.intValue(Builder.Type.err_int, 0);
../src/codegen/llvm.zig:            return self.wip.load(.normal, Builder.Type.err_int, operand, .default, "");
../src/codegen/llvm.zig:            return self.wip.load(.normal, Builder.Type.err_int, err_field_ptr, .default, "");
../src/codegen/llvm.zig:        const non_error_val = try o.builder.intValue(Builder.Type.err_int, 0);
../src/codegen/llvm.zig:            const error_alignment = Type.err_int.abiAlignment(mod).toLlvm();
../src/codegen/llvm.zig:        const ok_err_code = try o.builder.intValue(Builder.Type.err_int, 0);
../src/codegen/llvm.zig:            const error_alignment = Type.err_int.abiAlignment(mod).toLlvm();
../src/codegen/llvm.zig:            const error_alignment = Type.err_int.abiAlignment(mod).toLlvm();
../src/codegen/llvm.zig:            const this_tag_int_value = try o.builder.intConst(Builder.Type.err_int, err_int);
../src/codegen/llvm.zig:            try o.builder.fnType(.i1, &.{Builder.Type.err_int}, .normal),
../src/codegen/llvm.zig:        return if (return_type.isError(mod)) Builder.Type.err_int else .void;
../src/codegen/llvm.zig:    return @intFromBool(Type.err_int.abiAlignment(mod).compare(.gt, payload_ty.abiAlignment(mod)));
../src/codegen/llvm.zig:    return @intFromBool(Type.err_int.abiAlignment(mod).compare(.lte, payload_ty.abiAlignment(mod)));
../src/codegen/c.zig:                            Type.err_int,
../src/codegen/c.zig:                            try mod.intValue(Type.err_int, 0),
../src/codegen/c.zig:                        Type.err_int,
../src/codegen/c.zig:                        try mod.intValue(Type.err_int, 0),
../src/codegen/c.zig:                            .ErrorSet => try mod.intValue(Type.err_int, 0),
../src/codegen/c.zig:        TypedValue{ .ty = Type.err_int, .val = try mod.intValue(Type.err_int, 0) }
../src/codegen/c.zig:            try f.object.dg.renderValue(writer, Type.err_int, try mod.intValue(Type.err_int, 0), .Initializer);
../src/codegen/c.zig:        try f.object.dg.renderValue(writer, Type.err_int, try mod.intValue(Type.err_int, 0), .Other);
../src/codegen/c.zig:    try f.object.dg.renderValue(writer, Type.err_int, try mod.intValue(Type.err_int, 0), .Other);
../src/codegen/c.zig:        try f.object.dg.renderValue(writer, Type.err_int, try mod.intValue(Type.err_int, 0), .Other);
../src/codegen/c.zig:        try f.object.dg.renderValue(writer, Type.err_int, try mod.intValue(Type.err_int, 0), .Other);
../src/codegen/c.zig:    try f.object.dg.renderValue(writer, Type.err_int, try mod.intValue(Type.err_int, 0), .Other);
../src/codegen/spirv.zig:                    .payload => Type.err_int,
../src/codegen/spirv.zig:                    .payload => try mod.intValue(Type.err_int, 0),
../src/arch/wasm/CodeGen.zig:                    .ty = Type.err_int,
../src/arch/wasm/CodeGen.zig:                    .val = try mod.intValue(Type.err_int, 0),
../src/arch/wasm/CodeGen.zig:    const errors_len_val = try func.load(errors_len, Type.err_int, 0);
../src/arch/wasm/CodeGen.zig:    const result = try func.cmp(.stack, errors_len_val, Type.err_int, .lt);
../src/Sema.zig:            return mod.undefRef(Type.err_int);
../src/Sema.zig:            Type.err_int,
../src/Sema.zig:                0 => return Air.internedToRef((try mod.intValue(Type.err_int, 0)).toIntern()),
../src/Sema.zig:                    return mod.intRef(Type.err_int, int);
../src/Sema.zig:    return block.addBitCast(Type.err_int, operand);
../src/Sema.zig:    const operand = try sema.coerce(block, Type.err_int, uncasted_operand, operand_src);
../src/Sema.zig:        const zero_val = Air.internedToRef((try mod.intValue(Type.err_int, 0)).toIntern());
../src/Sema.zig:            const err_int = try block.addBitCast(Type.err_int, err_code);
../src/Sema.zig:            const err_int_inst = try block.addBitCast(Type.err_int, operand);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

allow configuration of error set tag type via a public const in the root source file

2 participants