diff options
| author | beetrees <b@beetr.ee> | 2025-03-09 07:56:41 +0000 |
|---|---|---|
| committer | beetrees <b@beetr.ee> | 2025-03-09 07:56:41 +0000 |
| commit | a2b9c8d35c69a37c9bdb14f733c0b53935eb8731 (patch) | |
| tree | 858d2e24e7679244b0d3bb6045cc2ad0e509eb53 | |
| parent | a96fa317d78c78a9de996afd317603c6970efc0d (diff) | |
| download | rust-a2b9c8d35c69a37c9bdb14f733c0b53935eb8731.tar.gz rust-a2b9c8d35c69a37c9bdb14f733c0b53935eb8731.zip | |
Fix `repr128-dwarf` test
| -rw-r--r-- | tests/run-make/repr128-dwarf/rmake.rs | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tests/run-make/repr128-dwarf/rmake.rs b/tests/run-make/repr128-dwarf/rmake.rs index 15eb186717f..8227c51516f 100644 --- a/tests/run-make/repr128-dwarf/rmake.rs +++ b/tests/run-make/repr128-dwarf/rmake.rs @@ -87,14 +87,15 @@ fn main() { while let Some((_, entry)) = cursor.next_dfs().unwrap() { match entry.tag() { gimli::constants::DW_TAG_variant if !is_old_llvm => { - let value = match entry - .attr(gimli::constants::DW_AT_discr_value) - .unwrap() - .unwrap() - .value() - { + let Some(value) = entry.attr(gimli::constants::DW_AT_discr_value).unwrap() + else { + // `std` enums might have variants without `DW_AT_discr_value`. + continue; + }; + let value = match value.value() { AttributeValue::Block(value) => value.to_slice().unwrap().to_vec(), - value => panic!("unexpected DW_AT_discr_value of {value:?}"), + // `std` has non-repr128 enums which don't use `AttributeValue::Block`. + value => continue, }; // The `DW_TAG_member` that is a child of `DW_TAG_variant` will contain the // variant's name. |
