Skip to content

Improve miri's error reporting in check_in_alloc #57128

Closed
@RalfJung

Description

@RalfJung

The check_in_alloc function currently takes a InboundsCheck for error reporting purposes. That's suboptimal for two reasons: (a) passing InboundsCheck::Live/MaybeDead sounds like it would affect the check that is performed, but it does not; and (b) the error still doesn't actually say what we tried to do with this pointer (access memory, in-bounds arithmetic, pointer equality test, ...).

The InboundsCheck argument should be replaced by something else, and that something else should also be put into the PointerOutOfBounds variant of EvalErrorKind. That could either be an &'static str or a more informative enum. I'd probably start with the string, since it seems unlikely we will want to use this for anything but displaying errors to the user, and it seems okay to not be able to use format!.

Cc @oli-obk

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions