mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-21 11:23:03 +00:00
Some misc changes
This commit is contained in:
parent
40176e03fd
commit
ece497cc84
@ -137,3 +137,8 @@ unsafe fn transmute(c: char) -> u32 {
|
||||
unsafe fn call_uninit() -> u8 {
|
||||
intrinsics::uninit()
|
||||
}
|
||||
|
||||
// TODO: enable when fat pointers are supported
|
||||
/*unsafe fn deref_str_ptr(s: *const str) -> &'static str {
|
||||
&*s
|
||||
}*/
|
||||
|
@ -330,7 +330,7 @@ pub fn codegen_call<'a, 'tcx: 'a>(
|
||||
|
||||
let nil_ty = fx.tcx.mk_nil();
|
||||
let usize_layout = fx.layout_of(fx.tcx.types.usize);
|
||||
let ret = return_place.unwrap();
|
||||
let ret = return_place.expect("return place");
|
||||
match intrinsic {
|
||||
"abort" => {
|
||||
fx.bcx.ins().trap(TrapCode::User(!0 - 1));
|
||||
|
@ -354,6 +354,10 @@ fn trans_stmt<'a, 'tcx: 'a>(
|
||||
let res = match un_op {
|
||||
UnOp::Not => fx.bcx.ins().bnot(val),
|
||||
UnOp::Neg => match ty.sty {
|
||||
TypeVariants::TyInt(_) => {
|
||||
let zero = fx.bcx.ins().iconst(types::I64, 0);
|
||||
fx.bcx.ins().isub(zero, val)
|
||||
},
|
||||
TypeVariants::TyFloat(_) => fx.bcx.ins().fneg(val),
|
||||
_ => unimplemented!("un op Neg for {:?}", ty),
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user