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

update for latest rustc #167

Merged
merged 2 commits into from
May 13, 2017
Merged
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
19 changes: 10 additions & 9 deletions src/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
source_info,
kind: mir::StatementKind::Assign(
mir::Lvalue::Local(mir::Local::new(2)),
mir::Rvalue::Use(mir::Operand::Constant(mir::Constant {
mir::Rvalue::Use(mir::Operand::Constant(Box::new(mir::Constant {
span: DUMMY_SP,
ty: tcx.types.usize,
literal: mir::Literal::Value {
value: ConstVal::Integral(ConstInt::Usize(ConstUsize::new(0, tcx.sess.target.uint_type).unwrap())),
},
}))
})))
)
},
mir::Statement {
Expand Down Expand Up @@ -225,13 +225,13 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
mir::Rvalue::BinaryOp(
mir::BinOp::Add,
mir::Operand::Consume(mir::Lvalue::Local(mir::Local::new(2))),
mir::Operand::Constant(mir::Constant {
mir::Operand::Constant(Box::new(mir::Constant {
span: DUMMY_SP,
ty: tcx.types.usize,
literal: mir::Literal::Value {
value: ConstVal::Integral(ConstInt::Usize(ConstUsize::new(1, tcx.sess.target.uint_type).unwrap())),
},
}),
})),
)
)
},
Expand Down Expand Up @@ -636,7 +636,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}

General { discr, ref variants, .. } => {
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = *kind {
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = **kind {
let discr_val = adt_def.discriminants(self.tcx)
.nth(variant)
.expect("broken mir: Adt variant id invalid")
Expand All @@ -662,7 +662,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}

RawNullablePointer { nndiscr, .. } => {
if let mir::AggregateKind::Adt(_, variant, _, _) = *kind {
if let mir::AggregateKind::Adt(_, variant, _, _) = **kind {
if nndiscr == variant as u64 {
assert_eq!(operands.len(), 1);
let operand = &operands[0];
Expand All @@ -683,7 +683,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
}

StructWrappedNullablePointer { nndiscr, ref nonnull, ref discrfield, .. } => {
if let mir::AggregateKind::Adt(_, variant, _, _) = *kind {
if let mir::AggregateKind::Adt(_, variant, _, _) = **kind {
if nonnull.packed {
let ptr = self.force_allocation(dest)?.to_ptr_and_extra().0;
self.memory.mark_packed(ptr, nonnull.stride().bytes());
Expand Down Expand Up @@ -712,7 +712,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {

CEnum { .. } => {
assert_eq!(operands.len(), 0);
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = *kind {
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = **kind {
let n = adt_def.discriminants(self.tcx)
.nth(variant)
.expect("broken mir: Adt variant index invalid")
Expand Down Expand Up @@ -997,8 +997,9 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
match *op {
Consume(ref lvalue) => self.eval_and_read_lvalue(lvalue),

Constant(mir::Constant { ref literal, .. }) => {
Constant(ref constant) => {
use rustc::mir::Literal;
let mir::Constant { ref literal, .. } = **constant;
let value = match *literal {
Literal::Value { ref value } => self.const_to_value(value)?,

Expand Down
2 changes: 1 addition & 1 deletion tests/run-pass/union.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn c() {
unsafe {
match v {
Value { tag: Tag::I, u: U { i: 0 } } => true,
Value { tag: Tag::F, u: U { f: 0.0 } } => true,
Value { tag: Tag::F, u: U { f } } if f == 0.0 => true,
_ => false,
}
}
Expand Down