zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 33f996bb163568c9bb10e5044ed9df53599a917f (tree)
parent 32c6f643aef6a5cad8942c54689210d35b48245a
Author: Andrew Kelley <andrew@ziglang.org>
Date:   Wed, 26 Jun 2019 14:00:44 -0400

all tests passing on linux

Diffstat:
Mdoc/langref.html.in | 2+-
Msrc/all_types.hpp | 5+++--
Msrc/codegen.cpp | 4+++-
Msrc/ir.cpp | 4+++-
Mstd/event/lock.zig | 3+--
5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/doc/langref.html.in b/doc/langref.html.in @@ -5096,7 +5096,7 @@ fn gimmeTheBiggerInteger(a: u64, b: u64) u64 { <p> For example, if we were to introduce another function to the above snippet: </p> - {#code_begin|test_err|values of type 'type' must be comptime known#} + {#code_begin|test_err|cannot store runtime value in type 'type'#} fn max(comptime T: type, a: T, b: T) T { return if (a > b) a else b; } diff --git a/src/all_types.hpp b/src/all_types.hpp @@ -335,8 +335,9 @@ struct ConstExprValue { RuntimeHintSlice rh_slice; } data; - ConstExprValue(const ConstExprValue &other) = delete; // plz zero initialize with {} - ConstExprValue& operator= (const ConstExprValue &other) = delete; // use copy_const_val + // uncomment these to find bugs. can't leave them uncommented because of a gcc-9 warning + //ConstExprValue(const ConstExprValue &other) = delete; // plz zero initialize with {} + //ConstExprValue& operator= (const ConstExprValue &other) = delete; // use copy_const_val }; enum ReturnKnowledge { diff --git a/src/codegen.cpp b/src/codegen.cpp @@ -691,7 +691,9 @@ static ZigLLVMDIScope *get_di_scope(CodeGen *g, Scope *scope) { is_definition, scope_line, flags, is_optimized, nullptr); scope->di_scope = ZigLLVMSubprogramToScope(subprogram); - ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram); + if (!g->strip_debug_symbols) { + ZigLLVMFnSetSubprogram(fn_llvm_value(g, fn_table_entry), subprogram); + } return scope->di_scope; } case ScopeIdDecls: diff --git a/src/ir.cpp b/src/ir.cpp @@ -10726,6 +10726,8 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT } else if (prev_inst->value.type->id == ZigTypeIdOptional) { return prev_inst->value.type; } else { + if ((err = type_resolve(ira->codegen, prev_inst->value.type, ResolveStatusSizeKnown))) + return ira->codegen->builtin_types.entry_invalid; return get_optional_type(ira->codegen, prev_inst->value.type); } } else { @@ -21547,7 +21549,7 @@ static IrInstruction *ir_analyze_instruction_from_bytes(IrAnalyze *ira, IrInstru IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base, instruction->result_loc, dest_slice_type, nullptr, true, false); - if (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)) { + if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) { return result_loc; } diff --git a/std/event/lock.zig b/std/event/lock.zig @@ -123,8 +123,7 @@ pub const Lock = struct { }; test "std.event.Lock" { - // https://github.com/ziglang/zig/issues/2377 - //if (true) return error.SkipZigTest; + if (builtin.single_threaded) return error.SkipZigTest; const allocator = std.heap.direct_allocator;