Skip to content

Commit a2b9c8d

Browse files
committed
Fix repr128-dwarf test
1 parent a96fa31 commit a2b9c8d

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

tests/run-make/repr128-dwarf/rmake.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,15 @@ fn main() {
8787
while let Some((_, entry)) = cursor.next_dfs().unwrap() {
8888
match entry.tag() {
8989
gimli::constants::DW_TAG_variant if !is_old_llvm => {
90-
let value = match entry
91-
.attr(gimli::constants::DW_AT_discr_value)
92-
.unwrap()
93-
.unwrap()
94-
.value()
95-
{
90+
let Some(value) = entry.attr(gimli::constants::DW_AT_discr_value).unwrap()
91+
else {
92+
// `std` enums might have variants without `DW_AT_discr_value`.
93+
continue;
94+
};
95+
let value = match value.value() {
9696
AttributeValue::Block(value) => value.to_slice().unwrap().to_vec(),
97-
value => panic!("unexpected DW_AT_discr_value of {value:?}"),
97+
// `std` has non-repr128 enums which don't use `AttributeValue::Block`.
98+
value => continue,
9899
};
99100
// The `DW_TAG_member` that is a child of `DW_TAG_variant` will contain the
100101
// variant's name.

0 commit comments

Comments
 (0)