Commit 743976ef48
Changed files (3)
src
test
cases
src/Sema.zig
@@ -19910,7 +19910,7 @@ fn zirPtrCast(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!Air
return sema.failWithUseOfUndef(block, operand_src);
}
if (!dest_ty.ptrAllowsZero() and operand_val.isNull()) {
- return sema.fail(block, operand_src, "null pointer casted to type {}", .{dest_ty.fmt(sema.mod)});
+ return sema.fail(block, operand_src, "null pointer casted to type '{}'", .{dest_ty.fmt(sema.mod)});
}
if (dest_ty.zigTypeTag() == .Optional and sema.typeOf(ptr).zigTypeTag() != .Optional) {
return sema.addConstant(dest_ty, try Value.Tag.opt_payload.create(sema.arena, operand_val));
@@ -22013,10 +22013,10 @@ fn zirMemcpy(sema: *Sema, block: *Block, inst: Zir.Inst.Index) CompileError!void
const msg = msg: {
const msg = try sema.errMsg(block, src, "unknown @memcpy length", .{});
errdefer msg.destroy(sema.gpa);
- try sema.errNote(block, dest_src, msg, "destination type {} provides no length", .{
+ try sema.errNote(block, dest_src, msg, "destination type '{}' provides no length", .{
sema.typeOf(dest_ptr).fmt(sema.mod),
});
- try sema.errNote(block, src_src, msg, "source type {} provides no length", .{
+ try sema.errNote(block, src_src, msg, "source type '{}' provides no length", .{
sema.typeOf(src_ptr).fmt(sema.mod),
});
break :msg msg;
test/cases/compile_errors/compile_time_null_ptr_cast.zig
@@ -8,4 +8,4 @@ comptime {
// backend=llvm
// target=native
//
-// :3:32: error: null pointer casted to type *i32
+// :3:32: error: null pointer casted to type '*i32'
test/cases/compile_errors/incorrect_type_to_memset_memcpy.zig
@@ -25,8 +25,8 @@ pub export fn non_matching_lengths() void {
// target=native
//
// :5:5: error: unknown @memcpy length
-// :5:18: note: destination type [*]u8 provides no length
-// :5:24: note: source type [*]align(4) const u8 provides no length
+// :5:18: note: destination type '[*]u8' provides no length
+// :5:24: note: source type '[*]align(4) const u8' provides no length
// :10:13: error: type 'u8' does not support indexing
// :10:13: note: for loop operand must be an array, slice, tuple, or vector
// :15:13: error: type '*u8' does not support indexing