Skip to content

Removing DropAndReplace MIR allowed more code to compile #113501

Open
@cjgillot

Description

@cjgillot

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.

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, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions