Skip to content

Commit 2606498

Browse files
schmeeVexu
authored andcommitted
module: return null if no candidate src
Closes #15572.
1 parent 20cc693 commit 2606498

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/Module.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6115,6 +6115,8 @@ pub const PeerTypeCandidateSrc = union(enum) {
61156115
return null;
61166116
},
61176117
.override => |candidate_srcs| {
6118+
if (candidate_i >= candidate_srcs.len)
6119+
return null;
61186120
return candidate_srcs[candidate_i];
61196121
},
61206122
.typeof_builtin_call_node_offset => |node_offset| {
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
const std = @import("std");
2+
3+
pub const DwarfSection = enum {
4+
eh_frame,
5+
eh_frame_hdr,
6+
};
7+
8+
pub fn main() void {
9+
const section = inline for (@typeInfo(DwarfSection).Enum.fields) |section| {
10+
if (std.mem.eql(u8, section.name, "eh_frame")) break section;
11+
};
12+
13+
_ = section;
14+
}
15+
16+
// error
17+
// backend=stage2
18+
// target=native
19+
//
20+
// :9:28: error: incompatible types: 'builtin.Type.EnumField' and 'void'

0 commit comments

Comments
 (0)