Skip to content

Disable precise_enum_drop_elaboration by default #90756

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions compiler/rustc_session/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1245,10 +1245,10 @@ options! {
"a single extra argument to prepend the linker invocation (can be used several times)"),
pre_link_args: Vec<String> = (Vec::new(), parse_list, [UNTRACKED],
"extra arguments to prepend to the linker invocation (space separated)"),
precise_enum_drop_elaboration: bool = (true, parse_bool, [TRACKED],
precise_enum_drop_elaboration: bool = (false, parse_bool, [TRACKED],
"use a more precise version of drop elaboration for matches on enums (default: yes). \
This results in better codegen, but has caused miscompilations on some tier 2 platforms. \
See #77382 and #74551."),
This results in better codegen, but has caused miscompilations. \
See #77382, #74551 and 90752."),
print_fuel: Option<String> = (None, parse_opt_string, [TRACKED],
"make rustc print the total optimization fuel used by a crate"),
print_link_args: bool = (false, parse_bool, [UNTRACKED],
Expand Down
38 changes: 38 additions & 0 deletions src/test/ui/mir/issue-90752.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// run-pass

struct V;
struct S;

impl Drop for S {
fn drop(&mut self) {
std::process::exit(1);
}
}

enum E {
A,
B((V, S)),
}

fn foo(v: &mut E) {
*v = E::B((V, S));
}

fn bar() {
let mut v = E::A;
match v {
E::A => (),
_ => unreachable!(),
}
foo(&mut v);
match v {
E::B((_x, _)) => {}
_ => {}
}
// v is `E::B((V, S))`, so `S::drop` should be called and this shouldn't return.
}

pub fn main() {
bar();
unreachable!();
}