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 code to work with nightly 2016-06-04 #8

Merged
merged 1 commit into from
Jun 17, 2016
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ An experimental compiler from [Rust] to [WebAssembly], based on rustc + Rust [MI
I recommend that you install [rustup] and then use it to
install the current rustc nightly version:

**Tested with nightly 2016-06-04**

```sh
git clone https://github.com/brson/mir2wasm.git
cd mir2wasm
Expand Down
2 changes: 1 addition & 1 deletion src/bin/mir2wasm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl<'a> CompilerCalls<'a> for MiriCompilerCalls {
control.after_analysis.stop = rustc_driver::Compilation::Stop;
control.after_analysis.callback = Box::new(|state| {
state.session.abort_if_errors();
trans::trans_crate(state.tcx.unwrap(), state.mir_map.unwrap())
trans::trans_crate(&state.tcx.unwrap(), state.mir_map.unwrap())
.unwrap(); // FIXME
});

Expand Down
10 changes: 5 additions & 5 deletions src/monomorphize.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use rustc::ty::subst::{Subst, Substs};
use rustc::ty::{TyCtxt, TypeFoldable};
use rustc::infer::normalize_associated_type;
use rustc::infer::TransNormalize;

pub fn apply_param_substs<'tcx,T>(tcx: &TyCtxt<'tcx>,
pub fn apply_param_substs<'a, 'tcx,T>(tcx: &TyCtxt<'a, 'tcx, 'tcx>,
param_substs: &Substs<'tcx>,
value: &T)
-> T
where T : TypeFoldable<'tcx>
where T : TypeFoldable<'tcx> + TransNormalize<'tcx>
{
let substituted = value.subst(tcx, param_substs);
normalize_associated_type(tcx, &substituted)
let substituted = value.subst(*tcx, param_substs);
tcx.normalize_associated_type(&substituted)
}
10 changes: 5 additions & 5 deletions src/trans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::collections::HashMap;
use binaryen::*;
use monomorphize;

pub fn trans_crate<'tcx>(tcx: &TyCtxt<'tcx>,
pub fn trans_crate<'a, 'tcx>(tcx: &TyCtxt<'a, 'tcx, 'tcx>,
mir_map: &MirMap<'tcx>) -> Result<()> {

let _ignore = tcx.dep_graph.in_ignore();
Expand All @@ -40,7 +40,7 @@ pub fn trans_crate<'tcx>(tcx: &TyCtxt<'tcx>,
}

struct BinaryenModuleCtxt<'v, 'tcx: 'v> {
tcx: &'v TyCtxt<'tcx>,
tcx: &'v TyCtxt<'v, 'tcx, 'tcx>,
mir_map: &'v MirMap<'tcx>,
module: BinaryenModuleRef,
fun_types: HashMap<ty::FnSig<'tcx>, BinaryenFunctionTypeRef>,
Expand Down Expand Up @@ -84,7 +84,7 @@ impl<'v, 'tcx> Visitor<'v> for BinaryenModuleCtxt<'v, 'tcx> {
}

struct BinaryenFnCtxt<'v, 'tcx: 'v> {
tcx: &'v TyCtxt<'tcx>,
tcx: &'v TyCtxt<'v, 'tcx, 'tcx>,
mir_map: &'v MirMap<'tcx>,
mir: &'v Mir<'tcx>,
did: DefId,
Expand Down Expand Up @@ -316,8 +316,8 @@ impl<'v, 'tcx: 'v> BinaryenFnCtxt<'v, 'tcx> {
match *operand {
Operand::Consume(ref lvalue) => {
let (i, _) = self.trans_lval(lvalue);
let lval_ty = self.mir.lvalue_ty(self.tcx, lvalue);
let t = lval_ty.to_ty(self.tcx);
let lval_ty = self.mir.lvalue_ty(*self.tcx, lvalue);
let t = lval_ty.to_ty(*self.tcx);
let t = rust_ty_to_binaryen(t);
unsafe { BinaryenGetLocal(self.module, i, t) }
}
Expand Down