Skip to content

Removing DropAndReplace MIR allowed more code to compile #113501

@cjgillot

Description

@cjgillot
Contributor

Before #107844, assignments of Drop types were modeled using replaced the DropAndReplace MIR terminator. That PR changed the behaviour to use a plain Drop followed by a plain Assign.

This made more code compile, for instance (#107844 (comment)):

struct Foo<'a> {
    v: &'a mut (),
}

impl Drop for Foo<'_> {
    fn drop(&mut self) {}
}

fn bar() {
    let mut v = ();
    let mut x = Foo { v: &mut v };
    drop(x);
    x = Foo { v: &mut v };
}

Steps:

  • List the changes in behaviour;
    Propose to t-lang to ratify them.

Activity

self-assigned this
on Jul 9, 2023
added
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jul 9, 2023
removed
needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.
on Jul 9, 2023
added
A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html
on Jul 17, 2023
added this to the 1.70.0 milestone on Jul 17, 2023
jyn514

jyn514 commented on Jul 17, 2023

@jyn514
Member

note that #107844 is on stable as of last week

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlT-langRelevant to the language team

Type

No type

Projects

No projects

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @cjgillot@jyn514@rustbot@Noratrieb

      Issue actions

        Removing DropAndReplace MIR allowed more code to compile · Issue #113501 · rust-lang/rust