From 0be41ce02b2313bb75d68d3828680ca88cf44c27 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Fri, 27 Apr 2012 15:40:40 -0700 Subject: [PATCH] rustc: Remove old align_of intrinsic --- src/libcore/sys.rs | 10 ++++------ src/rustc/middle/trans/native.rs | 5 ----- src/rustc/middle/trans/type_use.rs | 2 +- src/rustc/middle/typeck.rs | 2 +- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs index eba700044c3..be3bab6ac2e 100644 --- a/src/libcore/sys.rs +++ b/src/libcore/sys.rs @@ -26,7 +26,8 @@ native mod rustrt { native mod rusti { fn get_tydesc() -> *(); fn size_of() -> uint; - fn align_of() -> uint; + fn pref_align_of() -> uint; + fn min_align_of() -> uint; } #[doc = " @@ -51,15 +52,12 @@ This is the alignment used for struct fields. It may be smaller than the preferred alignment. "] fn min_align_of() -> uint unsafe { - // FIXME: use rusti::min_align_of after snapshot - // rusti::align_of::() - fail "FIXME: uncomment the above line to use min_align_of"; + rusti::min_align_of::() } #[doc = "Returns the preferred alignment of a type"] fn pref_align_of() -> uint unsafe { - // FIXME: use rusti::pref_align_of after snapshot - rusti::align_of::() + rusti::pref_align_of::() } #[doc = "Returns the refcount of a shared box"] diff --git a/src/rustc/middle/trans/native.rs b/src/rustc/middle/trans/native.rs index 46cef5e2bb6..d4c44b6c2b8 100644 --- a/src/rustc/middle/trans/native.rs +++ b/src/rustc/middle/trans/native.rs @@ -764,11 +764,6 @@ fn trans_intrinsic(ccx: @crate_ctxt, decl: ValueRef, item: @ast::native_item, Store(bcx, C_uint(ccx, shape::llsize_of_real(ccx, lltp_ty)), fcx.llretptr); } - // FIXME: Transitional. Please remove me. - "align_of" { - Store(bcx, C_uint(ccx, shape::llalign_of_pref(ccx, lltp_ty)), - fcx.llretptr); - } "min_align_of" { Store(bcx, C_uint(ccx, shape::llalign_of_min(ccx, lltp_ty)), fcx.llretptr); diff --git a/src/rustc/middle/trans/type_use.rs b/src/rustc/middle/trans/type_use.rs index 1a647aa5bf1..bee159e3373 100644 --- a/src/rustc/middle/trans/type_use.rs +++ b/src/rustc/middle/trans/type_use.rs @@ -76,7 +76,7 @@ fn type_uses_for(ccx: @crate_ctxt, fn_id: def_id, n_tps: uint) ast_map::node_native_item(i@@{node: native_item_fn(_, _), _}, abi, _) { if abi == native_abi_rust_intrinsic { let flags = alt check i.ident { - "size_of" | "align_of" | + "size_of" | "pref_align_of" | "min_align_of" | "init" | "reinterpret_cast" { use_repr } "get_tydesc" | "needs_drop" { use_tydesc } diff --git a/src/rustc/middle/typeck.rs b/src/rustc/middle/typeck.rs index e6f112f835d..d8c275bfd04 100644 --- a/src/rustc/middle/typeck.rs +++ b/src/rustc/middle/typeck.rs @@ -2007,7 +2007,7 @@ fn check_intrinsic_type(ccx: @crate_ctxt, it: @ast::native_item) { } let tcx = ccx.tcx; let (n_tps, inputs, output) = alt it.ident { - "size_of" | "align_of" | + "size_of" | "pref_align_of" | "min_align_of" { (1u, [], ty::mk_uint(ccx.tcx)) } "get_tydesc" { (1u, [], ty::mk_nil_ptr(tcx)) } "init" { (1u, [], param(ccx, 0u)) }