Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing DropAndReplace MIR allowed more code to compile #113501

Open
2 tasks
cjgillot opened this issue Jul 9, 2023 · 1 comment
Open
2 tasks

Removing DropAndReplace MIR allowed more code to compile #113501

cjgillot opened this issue Jul 9, 2023 · 1 comment
Assignees
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html T-lang Relevant to the language team, which will review and decide on the PR/issue.
Milestone

Comments

@cjgillot
Copy link
Contributor

cjgillot commented Jul 9, 2023

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.
@cjgillot cjgillot self-assigned this Jul 9, 2023
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 9, 2023
@cjgillot cjgillot removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label Jul 9, 2023
@Noratrieb Noratrieb added the T-lang Relevant to the language team, which will review and decide on the PR/issue. label Jul 9, 2023
@jyn514 jyn514 added the A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html label Jul 17, 2023
@jyn514 jyn514 added this to the 1.70.0 milestone Jul 17, 2023
@jyn514
Copy link
Member

jyn514 commented Jul 17, 2023

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
Labels
A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants