rust-lang / miri

An interpreter for Rust's mid-level intermediate representation
Apache License 2.0
4.14k stars 318 forks source link

Clearer error message for unsupported flags: print names of flags (if possible) #3642

Open tiif opened 1 month ago

tiif commented 1 month ago

The error message will be clearer if we can print the exact unsupported flag name in throw_unsup_format! message. This is mentioned in https://github.com/rust-lang/miri/pull/3609#discussion_r1612845613_.

For socketpair, only SOCK_DGRAM is not supported. But for other larger functions that involve a lot of flags, it will be useful if there is a helper function that keeps track of unsupported flags that we know and helps to throw error with exact name of the flag.

RalfJung commented 1 month ago

Probably what we'd want is to be able to "decode" a flag value into NAME1 | NAME2 | NAME3, and then print that. Of course if a flag is truly unknown we can't do that and have to still show the hex value.