Work around AssertKind::description panicing for BoundsCheck#467
Work around AssertKind::description panicing for BoundsCheck#467fpoli merged 2 commits intoviperproject:masterfrom
Conversation
|
Oh it's not public… :/ |
|
I guess the easiest thing is to create a file in (We could even propose to make that method public with a tiny PR to rustc.) |
|
hm, and the only use seems to be in the mir printing. i like the idea of doing a rustc PR, but would go with the debug impl (maybe just for the BoundsCheck variant) instead for now, and add a TODO for when/if our rustc-PR is accepted. |
AssertKind::BoundsCheck panics on calling AssertKind::display, and the docs say that the caller is supposed to handle those earlier[0]. So we use the Debug impl instead, which can handle BoundsCheck. At some point we want to switch to using `AssertKind::fmt_assert_args`, but currently that is not public in rustc. [0] https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/mir/enum.AssertKind.html#impl
| let assert_msg = if let mir::AssertKind::BoundsCheck{ .. } = msg { | ||
| // Use the debug impl for BoundsCheck, as it is supposed to be handled before | ||
| // calling display() according to the docs | ||
| // TODO: use fmt_assert_args once #BUGNR is merged |
There was a problem hiding this comment.
will insert the rustc PR number here once i have it.
There was a problem hiding this comment.
alright, i think we could merge this as is for now. alternatively, we could wait ~1 day and hope the rustc side reacts quickly.
See viperproject#467 and rust-lang/rust#84392 for context.
AssertKind::BoundsCheck panics on calling AssertKind::display, and the
docs say that the caller is supposed to handle those earlier[0]. So we
use fmt_assert_args instead, which can handle BoundsCheck.
[0] https://doc.rust-lang.org/stable/nightly-rustc/rustc_middle/mir/enum.AssertKind.html#impl