Fix a panic

This commit is contained in:
bjorn3 2018-07-18 17:07:10 +02:00
parent 5f57ac5725
commit dabfac3df7
3 changed files with 8 additions and 3 deletions

View File

@ -53,4 +53,3 @@ $ ./build.sh
* [ ] cranelift-module api seems to be used wrong, thus causing panic for some consts
* [ ] cranelift-codegen doesn't have encodings for some instructions for types smaller than I32
* [ ] `thread 'main' panicked at 'assertion failed: !value.has_escaping_regions()', librustc/ty/sty.rs:754:9` in cton_sig_from_mono_fn_sig

View File

@ -134,3 +134,9 @@ fn int_cast(a: u16, b: i16) -> (u8, u16, u32, usize, i8, i16, i32, isize) {
a as isize,
)
}
struct DebugTuple(());
fn debug_tuple() -> DebugTuple {
DebugTuple(())
}

View File

@ -260,6 +260,7 @@ pub fn place_field(self, fx: &mut FunctionCx<'a, 'tcx>, field: mir::Field) -> CP
let field_offset = fx.bcx.ins().iconst(types::I64, field_offset.bytes() as i64);
CPlace::Addr(fx.bcx.ins().iadd(base, field_offset), field_ty)
} else {
fx.bcx.ins().nop();
CPlace::Addr(base, field_ty)
}
}
@ -290,9 +291,8 @@ pub fn cton_sig_from_instance<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, inst: I
pub fn cton_sig_from_mono_fn_sig<'a, 'tcx: 'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>, sig: PolyFnSig<'tcx>) -> Signature {
// TODO: monomorphize signature
// TODO: this should likely not use skip_binder()
let sig = sig.skip_binder();
let sig = tcx.normalize_erasing_late_bound_regions(ParamEnv::reveal_all(), &sig);
let inputs = sig.inputs();
let _output = sig.output();
assert!(!sig.variadic, "Variadic function are not yet supported");