Fix some small bugs

This commit is contained in:
bjorn3 2018-08-08 16:00:14 +02:00
parent 7f2e68e38e
commit 620d65c661
2 changed files with 83 additions and 11 deletions

View file

@ -0,0 +1,62 @@
From 439444eb7d5557daa5e8cfafd1317816fefdad70 Mon Sep 17 00:00:00 2001
From: bjorn3 <bjorn3@users.noreply.github.com>
Date: Wed, 8 Aug 2018 15:51:42 +0200
Subject: [PATCH] Disable future and task modules, because they contain unsized
types
---
src/libcore/lib.rs | 2 ++
src/libcore/mem.rs | 6 ++++--
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 71fcff2..7dcbb4b 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -202,9 +202,11 @@ pub mod time;
pub mod unicode;
+/*
/* Async */
pub mod future;
pub mod task;
+*/
/* Heap memory allocator trait */
#[allow(missing_docs)]
diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs
index 642fffa..f5a22ab 100644
--- a/src/libcore/mem.rs
+++ b/src/libcore/mem.rs
@@ -18,12 +18,12 @@
use clone;
use cmp;
use fmt;
-use future::{Future, UnsafeFutureObj};
+//use future::{Future, UnsafeFutureObj};
use hash;
use intrinsics;
use marker::{Copy, PhantomData, Sized, Unpin, Unsize};
use ptr;
-use task::{Context, Poll};
+//use task::{Context, Poll};
use ops::{Deref, DerefMut, CoerceUnsized};
#[stable(feature = "rust1", since = "1.0.0")]
@@ -1148,6 +1148,7 @@ impl<'a, T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<PinMut<'a, U>> for PinM
#[unstable(feature = "pin", issue = "49150")]
impl<'a, T: ?Sized> Unpin for PinMut<'a, T> {}
+/*
#[unstable(feature = "futures_api", issue = "50547")]
unsafe impl<'a, T, F> UnsafeFutureObj<'a, T> for PinMut<'a, F>
where F: Future<Output = T> + 'a
@@ -1162,3 +1163,4 @@ unsafe impl<'a, T, F> UnsafeFutureObj<'a, T> for PinMut<'a, F>
unsafe fn drop(_ptr: *mut ()) {}
}
+*/
--
2.15.2 (Apple Git-101.1)

View file

@ -204,7 +204,7 @@ pub fn codegen_fn_prelude<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, start_ebb
}
let func_params = fx.mir.args_iter().map(|local| {
let arg_ty = fx.mir.local_decls[local].ty;
let arg_ty = fx.monomorphize(&fx.mir.local_decls[local].ty);
// Adapted from https://github.com/rust-lang/rust/blob/145155dc96757002c7b2e9de8489416e2fdbbd57/src/librustc_codegen_llvm/mir/mod.rs#L442-L482
if Some(local) == fx.mir.spread_arg {
@ -215,7 +215,7 @@ pub fn codegen_fn_prelude<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, start_ebb
let tupled_arg_tys = match arg_ty.sty {
ty::TyTuple(ref tys) => tys,
_ => bug!("spread argument isn't a tuple?!")
_ => bug!("spread argument isn't a tuple?! but {:?}", arg_ty),
};
let mut ebb_params = Vec::new();
@ -290,11 +290,7 @@ pub fn codegen_call<'a, 'tcx: 'a>(
let fn_ty = func.layout().ty;
let sig = ty_fn_sig(fx.tcx, fn_ty);
let return_place = if let Some((place, _)) = destination {
Some(trans_place(fx, place))
} else {
None
};
let return_place = destination.as_ref().map(|(place, _)| trans_place(fx, place));
// Unpack arguments tuple for closures
let args = if sig.abi == Abi::RustCall {
@ -331,11 +327,25 @@ pub fn codegen_call<'a, 'tcx: 'a>(
let nil_ty = fx.tcx.mk_nil();
let u64_layout = fx.layout_of(fx.tcx.types.u64);
let usize_layout = fx.layout_of(fx.tcx.types.usize);
let ret = return_place.expect("return place");
match intrinsic {
"abort" => {
fx.bcx.ins().trap(TrapCode::User(!0 - 1));
let ret = match return_place {
Some(ret) => ret,
None => {
println!("codegen_call(fx, {:?}, {:?}, {:?})", func, args, destination);
// Insert non returning intrinsics here
match intrinsic {
"abort" => {
fx.bcx.ins().trap(TrapCode::User(!0 - 1));
}
"unreachable" => {
fx.bcx.ins().trap(TrapCode::User(!0 - 1));
}
_ => unimplemented!("unsupported instrinsic {}", intrinsic),
}
return;
}
};
match intrinsic {
"assume" => {
assert_eq!(args.len(), 1);
}