Don't accidentally promote union access in MIR

This commit is contained in:
Oliver Schneider 2018-07-13 16:55:15 +02:00
parent c0aedc0b6a
commit 07e2dd7d96
2 changed files with 1 additions and 12 deletions

View File

@ -515,7 +515,7 @@ fn visit_place(&mut self,
if let Some(def) = base_ty.ty_adt_def() {
if def.is_union() {
match this.mode {
Mode::Fn => {},
Mode::Fn => this.not_const(),
Mode::ConstFn => {
if !this.tcx.sess.features_untracked().const_fn_union {
emit_feature_err(

View File

@ -1,11 +0,0 @@
error: internal compiler error: unexpected region for local data ReStatic
--> $DIR/union_promotion.rs:19:29
|
LL | let x: &'static bool = &unsafe { //~ borrowed value does not live long enough
| _____________________________^
LL | | Foo { a: &1 }.b == Foo { a: &2 }.b
LL | | };
| |_____^
error: aborting due to previous error