make small ty_struct immediate

Closes #9651
This commit is contained in:
Daniel Micay 2013-10-07 21:58:33 -04:00
parent b17dc4a946
commit ac1faba4df
2 changed files with 4 additions and 6 deletions

View File

@ -70,11 +70,7 @@ pub fn type_is_immediate(ccx: &mut CrateContext, ty: ty::t) -> bool {
return true;
}
match ty::get(ty).sty {
// FIXME: #9651: small `ty_struct` should also be immediate
ty::ty_struct(def_id, ref substs) => {
ty::struct_fields(tcx, def_id, substs).is_empty()
}
ty::ty_enum(*) | ty::ty_tup(*) => {
ty::ty_struct(*) | ty::ty_enum(*) | ty::ty_tup(*) => {
let llty = sizing_type_of(ccx, ty);
llsize_of_alloc(ccx, llty) <= llsize_of_alloc(ccx, ccx.int_type)
}

View File

@ -26,7 +26,7 @@ use vec;
/// An atomically reference counted pointer.
///
/// Enforces no shared-memory safety.
#[unsafe_no_drop_flag]
//#[unsafe_no_drop_flag] FIXME: #9758
pub struct UnsafeArc<T> {
data: *mut ArcData<T>,
}
@ -427,6 +427,8 @@ mod tests {
use util;
use sys::size_of;
//#[unsafe_no_drop_flag] FIXME: #9758
#[ignore]
#[test]
fn test_size() {
assert_eq!(size_of::<UnsafeArc<[int, ..10]>>(), size_of::<*[int, ..10]>());