@ChrisJefferson does something like this seem appropriate?
https://github.com/rust-lang/rust/pull/80442