Skip to content

Commit f718e77

Browse files
authored
Merge pull request #46 from oli-obk/rustup
rustup to rustc 1.13.0-nightly (91f057de3 2016-09-04)
2 parents 45cf3cf + 7b24d55 commit f718e77

File tree

5 files changed

+48
-39
lines changed

5 files changed

+48
-39
lines changed

Cargo.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bin/miri.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use miri::{eval_main, run_mir_passes};
1313
use rustc::session::Session;
1414
use rustc::mir::mir_map::MirMap;
1515
use rustc_driver::{driver, CompilerCalls, Compilation};
16-
use syntax::ast::MetaItemKind;
16+
use syntax::ast::{MetaItemKind, NestedMetaItemKind};
1717

1818
struct MiriCompilerCalls;
1919

@@ -52,14 +52,17 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls {
5252
MetaItemKind::List(ref name, _) if name != "miri" => {}
5353
MetaItemKind::List(_, ref items) => for item in items {
5454
match item.node {
55-
MetaItemKind::NameValue(ref name, ref value) => {
56-
match &**name {
57-
"memory_size" => memory_size = extract_str(value).parse().expect("not a number"),
58-
"step_limit" => step_limit = extract_str(value).parse().expect("not a number"),
59-
"stack_limit" => stack_limit = extract_str(value).parse().expect("not a number"),
60-
_ => state.session.span_err(item.span, "unknown miri attribute"),
55+
NestedMetaItemKind::MetaItem(ref inner) => match inner.node {
56+
MetaItemKind::NameValue(ref name, ref value) => {
57+
match &**name {
58+
"memory_size" => memory_size = extract_str(value).parse().expect("not a number"),
59+
"step_limit" => step_limit = extract_str(value).parse().expect("not a number"),
60+
"stack_limit" => stack_limit = extract_str(value).parse().expect("not a number"),
61+
_ => state.session.span_err(item.span, "unknown miri attribute"),
62+
}
6163
}
62-
}
64+
_ => state.session.span_err(inner.span, "miri attributes need to be of key = value kind"),
65+
},
6366
_ => state.session.span_err(item.span, "miri attributes need to be of key = value kind"),
6467
}
6568
},

src/interpreter/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
292292
// TODO(solson): Is this inefficient? Needs investigation.
293293
let ty = self.monomorphize(ty, substs);
294294

295-
self.tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
295+
self.tcx.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
296296
// TODO(solson): Report this error properly.
297297
ty.layout(&infcx).unwrap()
298298
})
@@ -454,7 +454,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
454454
}
455455

456456
General { discr, ref variants, .. } => {
457-
if let mir::AggregateKind::Adt(adt_def, variant, _) = *kind {
457+
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = *kind {
458458
let discr_val = adt_def.variants[variant].disr_val.to_u64_unchecked();
459459
let discr_size = discr.size().bytes() as usize;
460460
self.memory.write_uint(dest, discr_val, discr_size)?;
@@ -468,7 +468,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
468468
}
469469

470470
RawNullablePointer { nndiscr, .. } => {
471-
if let mir::AggregateKind::Adt(_, variant, _) = *kind {
471+
if let mir::AggregateKind::Adt(_, variant, _, _) = *kind {
472472
if nndiscr == variant as u64 {
473473
assert_eq!(operands.len(), 1);
474474
let operand = &operands[0];
@@ -485,7 +485,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
485485
}
486486

487487
StructWrappedNullablePointer { nndiscr, ref nonnull, ref discrfield } => {
488-
if let mir::AggregateKind::Adt(_, variant, _) = *kind {
488+
if let mir::AggregateKind::Adt(_, variant, _, _) = *kind {
489489
if nndiscr == variant as u64 {
490490
let offsets = iter::once(0)
491491
.chain(nonnull.offset_after_field.iter().map(|s| s.bytes()));
@@ -503,7 +503,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
503503

504504
CEnum { discr, signed, .. } => {
505505
assert_eq!(operands.len(), 0);
506-
if let mir::AggregateKind::Adt(adt_def, variant, _) = *kind {
506+
if let mir::AggregateKind::Adt(adt_def, variant, _, _) = *kind {
507507
let val = adt_def.variants[variant].disr_val.to_u64_unchecked();
508508
let size = discr.size().bytes() as usize;
509509

src/interpreter/step.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
2424
}
2525

2626
let block = self.frame().block;
27-
let stmt = self.frame().stmt;
27+
let stmt_id = self.frame().stmt;
2828
let mir = self.mir();
2929
let basic_block = &mir.basic_blocks()[block];
3030

31-
if let Some(ref stmt) = basic_block.statements.get(stmt) {
31+
if let Some(ref stmt) = basic_block.statements.get(stmt_id) {
3232
let mut new = Ok(0);
3333
ConstantExtractor {
3434
span: stmt.source_info.span,
@@ -37,7 +37,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
3737
ecx: self,
3838
mir: &mir,
3939
new_constants: &mut new,
40-
}.visit_statement(block, stmt);
40+
}.visit_statement(block, stmt, mir::Location {
41+
block: block,
42+
statement_index: stmt_id,
43+
});
4144
if new? == 0 {
4245
self.statement(stmt)?;
4346
}
@@ -55,7 +58,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
5558
ecx: self,
5659
mir: &mir,
5760
new_constants: &mut new,
58-
}.visit_terminator(block, terminator);
61+
}.visit_terminator(block, terminator, mir::Location {
62+
block: block,
63+
statement_index: stmt_id,
64+
});
5965
if new? == 0 {
6066
self.terminator(terminator)?;
6167
}
@@ -135,8 +141,8 @@ impl<'a, 'b, 'tcx> ConstantExtractor<'a, 'b, 'tcx> {
135141
}
136142

137143
impl<'a, 'b, 'tcx> Visitor<'tcx> for ConstantExtractor<'a, 'b, 'tcx> {
138-
fn visit_constant(&mut self, constant: &mir::Constant<'tcx>) {
139-
self.super_constant(constant);
144+
fn visit_constant(&mut self, constant: &mir::Constant<'tcx>, location: mir::Location) {
145+
self.super_constant(constant, location);
140146
match constant.literal {
141147
// already computed by rustc
142148
mir::Literal::Value { .. } => {}
@@ -170,8 +176,8 @@ impl<'a, 'b, 'tcx> Visitor<'tcx> for ConstantExtractor<'a, 'b, 'tcx> {
170176
}
171177
}
172178

173-
fn visit_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>, context: LvalueContext) {
174-
self.super_lvalue(lvalue, context);
179+
fn visit_lvalue(&mut self, lvalue: &mir::Lvalue<'tcx>, context: LvalueContext, location: mir::Location) {
180+
self.super_lvalue(lvalue, context, location);
175181
if let mir::Lvalue::Static(def_id) = *lvalue {
176182
let substs = subst::Substs::empty(self.ecx.tcx);
177183
let span = self.span;

src/interpreter/terminator.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
239239

240240
// The discriminant_value intrinsic returns 0 for non-sum types.
241241
Array { .. } | FatPointer { .. } | Scalar { .. } | Univariant { .. } |
242-
Vector { .. } => 0,
242+
Vector { .. } | UntaggedUnion { .. } => 0,
243243
};
244244

245245
Ok(discr_val)
@@ -278,7 +278,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
278278
"assume" => {}
279279

280280
"copy_nonoverlapping" => {
281-
let elem_ty = substs.types[0];
281+
let elem_ty = substs.type_at(0);
282282
let elem_size = self.type_size(elem_ty);
283283
let elem_align = self.type_align(elem_ty);
284284
let src = self.memory.read_ptr(args_ptrs[0])?;
@@ -288,7 +288,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
288288
}
289289

290290
"discriminant_value" => {
291-
let ty = substs.types[0];
291+
let ty = substs.type_at(0);
292292
let adt_ptr = self.memory.read_ptr(args_ptrs[0])?;
293293
let discr_val = self.read_discriminant_value(adt_ptr, ty)?;
294294
self.memory.write_uint(dest, discr_val, 8)?;
@@ -299,19 +299,19 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
299299
"init" => self.memory.write_repeat(dest, 0, dest_layout.size(&self.tcx.data_layout).bytes() as usize)?,
300300

301301
"min_align_of" => {
302-
let elem_ty = substs.types[0];
302+
let elem_ty = substs.type_at(0);
303303
let elem_align = self.type_align(elem_ty);
304304
self.memory.write_uint(dest, elem_align as u64, pointer_size)?;
305305
}
306306

307307
"move_val_init" => {
308-
let ty = substs.types[0];
308+
let ty = substs.type_at(0);
309309
let ptr = self.memory.read_ptr(args_ptrs[0])?;
310310
self.move_(args_ptrs[1], ptr, ty)?;
311311
}
312312

313313
"offset" => {
314-
let pointee_ty = substs.types[0];
314+
let pointee_ty = substs.type_at(0);
315315
let pointee_size = self.type_size(pointee_ty) as isize;
316316
let ptr_arg = args_ptrs[0];
317317
let offset = self.memory.read_isize(args_ptrs[1])?;
@@ -343,13 +343,13 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
343343
}
344344

345345
"size_of" => {
346-
let ty = substs.types[0];
346+
let ty = substs.type_at(0);
347347
let size = self.type_size(ty) as u64;
348348
self.memory.write_uint(dest, size, pointer_size)?;
349349
}
350350

351351
"size_of_val" => {
352-
let ty = substs.types[0];
352+
let ty = substs.type_at(0);
353353
if self.type_is_sized(ty) {
354354
let size = self.type_size(ty) as u64;
355355
self.memory.write_uint(dest, size, pointer_size)?;
@@ -369,7 +369,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
369369
}
370370

371371
"transmute" => {
372-
let ty = substs.types[0];
372+
let ty = substs.type_at(0);
373373
self.move_(args_ptrs[0], dest, ty)?;
374374
}
375375
"uninit" => self.memory.mark_definedness(dest, dest_layout.size(&self.tcx.data_layout).bytes() as usize, false)?,
@@ -457,7 +457,7 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
457457
fn fulfill_obligation(&self, trait_ref: ty::PolyTraitRef<'tcx>) -> traits::Vtable<'tcx, ()> {
458458
// Do the initial selection for the obligation. This yields the shallow result we are
459459
// looking for -- that is, what specific impl.
460-
self.tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
460+
self.tcx.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
461461
let mut selcx = traits::SelectionContext::new(&infcx);
462462

463463
let obligation = traits::Obligation::new(
@@ -570,14 +570,14 @@ fn get_impl_method<'a, 'tcx>(
570570
impl_substs: &'tcx Substs<'tcx>,
571571
name: ast::Name,
572572
) -> ImplMethod<'tcx> {
573-
assert!(!substs.types.needs_infer());
573+
assert!(!substs.needs_infer());
574574

575575
let trait_def_id = tcx.trait_id_of_impl(impl_def_id).unwrap();
576576
let trait_def = tcx.lookup_trait_def(trait_def_id);
577577

578578
match trait_def.ancestors(impl_def_id).fn_defs(tcx, name).next() {
579579
Some(node_item) => {
580-
let substs = tcx.normalizing_infer_ctxt(Reveal::All).enter(|infcx| {
580+
let substs = tcx.infer_ctxt(None, None, Reveal::All).enter(|infcx| {
581581
let substs = substs.rebase_onto(tcx, trait_def_id, impl_substs);
582582
let substs = traits::translate_substs(&infcx, impl_def_id,
583583
substs, node_item.node);

0 commit comments

Comments
 (0)