I tried this code:
fn f() {
assert!(true, 123);
}
I expected to see this happen: This includes a machine-applicable fix to migrate to 2021.
Instead, this happened: The suggestion is MaybeIncorrect preventing automatic migration.
Part of the problem is that there isn't an easy way to convert this to panic_any. For example, it could convert to:
fn f() {
if !(expr) { ::std::panic::panic_any(123); }
}
which is pretty awful and probably has other downsides. Trying to format with {:?} is also probably not a reliable option, since it would require the payload to impl Debug, and the user's code may be relying on catching the panic and inspecting the payload.
I don't know what is really practical here.
Meta
rustc 1.55.0-nightly (014026d1a 2021-07-19)
I tried this code:
I expected to see this happen: This includes a machine-applicable fix to migrate to 2021.
Instead, this happened: The suggestion is
MaybeIncorrectpreventing automatic migration.Part of the problem is that there isn't an easy way to convert this to
panic_any. For example, it could convert to:which is pretty awful and probably has other downsides. Trying to format with
{:?}is also probably not a reliable option, since it would require the payload to impl Debug, and the user's code may be relying on catching the panic and inspecting the payload.I don't know what is really practical here.
Meta
rustc 1.55.0-nightly (014026d1a 2021-07-19)