From dabfac3df70c796525df4ba806ed1d3e9a57016a Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Wed, 18 Jul 2018 17:07:10 +0200 Subject: [PATCH] Fix a panic --- Readme.md | 1 - example.rs | 6 ++++++ src/common.rs | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 835b0e813b57..318ac226461f 100644 --- a/Readme.md +++ b/Readme.md @@ -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 \ No newline at end of file diff --git a/example.rs b/example.rs index ba285d38bc9c..884a15710261 100644 --- a/example.rs +++ b/example.rs @@ -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(()) +} diff --git a/src/common.rs b/src/common.rs index 5e13ad4a434f..73c13619b979 100644 --- a/src/common.rs +++ b/src/common.rs @@ -260,6 +260,7 @@ impl<'a, 'tcx: 'a> CPlace<'tcx> { 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");