Skip to content

Meeting proposal: behavior of _ in match patterns #16

Closed
@RalfJung

Description

@RalfJung

Summary

Does this code have UB?

fn main() {
    let ptr = 32 as *const (u8, u8);
    unsafe {
        match (*ptr).1 { _ => {} }
    }
}

Currently the answer Miri gives is no. That is inconsistent with let _ = (*ptr).1, which creates a PlaceMention that is picked up by Miri and hence raises UB (the UB error will change with rust-lang/rust#114330, since it will be UB at the projection rather than the deref, but it will remain UB).

We should determine whether we want to make this behavior consistent.

Reading

Meeting document

Issues/PRs:

Comment policy

These issues are meant to be used as an "announcements channel" regarding the proposal, and not as a
place to discuss the technical details. Feel free to subscribe to updates. We'll post comments when
reviewing the proposal in meetings or making a scheduling decision. In the meantime, if you have
questions or ideas, ping the proposers on Zulip (or elsewhere).

Metadata

Metadata

Assignees

No one assigned

    Labels

    meeting-proposalProposal for a discussion topic at a team meeting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions