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

Rustup #330

Merged
merged 4 commits into from
Sep 6, 2017
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ before_script:
- rustup target add i686-pc-windows-gnu
- rustup target add i686-pc-windows-msvc
- rustup component add rust-src
- cargo install xargo
- cargo install --git https://github.com/japaric/xargo.git
- export RUST_SYSROOT=$HOME/rust
script:
- set -e
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/interpret/eval_context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
for block in mir.basic_blocks() {
for stmt in block.statements.iter() {
match stmt.kind {
StorageLive(mir::Lvalue::Local(local)) |
StorageDead(mir::Lvalue::Local(local)) => {
StorageLive(local) |
StorageDead(local) => {
set.insert(local);
}
_ => {}
Expand Down
11 changes: 6 additions & 5 deletions src/librustc_mir/interpret/lvalue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc::ty::layout::{Size, Align};
use rustc::ty::{self, Ty};
use rustc_data_structures::indexed_vec::Idx;

use super::{EvalResult, EvalContext, MemoryPointer, PrimVal, Value, Pointer, Machine, PtrAndAlign};
use super::{EvalResult, EvalContext, MemoryPointer, PrimVal, Value, Pointer, Machine, PtrAndAlign, ValTy};

#[derive(Copy, Clone, Debug)]
pub enum Lvalue {
Expand Down Expand Up @@ -400,7 +400,7 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
&mut self,
base: Lvalue,
base_ty: Ty<'tcx>,
proj_elem: &mir::ProjectionElem<'tcx, mir::Operand<'tcx>, Ty<'tcx>>,
proj_elem: &mir::ProjectionElem<'tcx, mir::Local, Ty<'tcx>>,
) -> EvalResult<'tcx, Lvalue> {
use rustc::mir::ProjectionElem::*;
let (ptr, extra) = match *proj_elem {
Expand Down Expand Up @@ -439,9 +439,10 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
return self.val_to_lvalue(val, pointee_type);
}

Index(ref operand) => {
let n_ptr = self.eval_operand(operand)?;
let n = self.value_to_primval(n_ptr)?.to_u64()?;
Index(local) => {
let value = self.frame().get_local(local)?;
let ty = self.tcx.types.usize;
let n = self.value_to_primval(ValTy { value, ty })?.to_u64()?;
return self.lvalue_index(base, base_ty, n);
}

Expand Down
25 changes: 9 additions & 16 deletions src/librustc_mir/interpret/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,15 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
}
}

// Mark locals as dead or alive.
StorageLive(ref lvalue) |
StorageDead(ref lvalue) => {
let (frame, local) =
match self.eval_lvalue(lvalue)? {
Lvalue::Local { frame, local } if self.cur_frame() == frame => (
frame,
local,
),
_ => return err!(Unimplemented("Storage annotations must refer to locals of the topmost stack frame.".to_owned())), // FIXME maybe this should get its own error type
};
let old_val = match stmt.kind {
StorageLive(_) => self.stack[frame].storage_live(local)?,
StorageDead(_) => self.stack[frame].storage_dead(local)?,
_ => bug!("We already checked that we are a storage stmt"),
};
// Mark locals as alive
StorageLive(local) => {
let old_val = self.frame_mut().storage_live(local)?;
self.deallocate_local(old_val)?;
}

// Mark locals as dead
StorageDead(local) => {
let old_val = self.frame_mut().storage_dead(local)?;
self.deallocate_local(old_val)?;
}

Expand Down
1 change: 0 additions & 1 deletion xargo/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/bin/sh
cd "$(dirname "$0")"
sed 's/gcc = "0\.3\.50"/gcc = "=0\.3\.50"/' -i ~/.rustup/toolchains/*/lib/rustlib/src/rust/src/libstd/Cargo.toml
RUSTFLAGS='-Zalways-encode-mir -Zmir-emit-validate=1' xargo build