fn ensure_struct_fits_in_address_space<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                                 fields: &[Type],
                                                 packed: bool,
                                                 scapegoat: Ty<'tcx>) {
    let mut offset = 0;
    for &llty in fields {
        // Invariant: offset < ccx.obj_size_bound() <= 1<<61
        if !packed {
            let type_align = machine::llalign_of_min(ccx, llty);
            offset = roundup(offset, type_align);
        }
        // type_align is a power-of-2, so still offset < ccx.obj_size_bound()
        // llsize_of_alloc(ccx, llty) is also less than ccx.obj_size_bound()
        // so the sum is less than 1<<62 (and therefore can't overflow).
        offset += machine::llsize_of_alloc(ccx, llty);

        if offset >= ccx.obj_size_bound() {
            ccx.report_overbig_object(scapegoat);
        }
    }
}
// LLVM doesn't like types that don't fit in the address space
LLVM doesn't like types that don't fit in the address space
LLVM doesn ' t like types that don ' t fit in the address space
fn ensure_struct_fits_in_address_space<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
                                                 fields: &[Type],
                                                 packed: bool,
                                                 scapegoat: Ty<'tcx>) {
    let mut offset = 0;
    for &llty in fields {
        // Invariant: offset < ccx.obj_size_bound() <= 1<<61
        if !packed {
            let type_align = machine::llalign_of_min(ccx, llty);
            offset = roundup(offset, type_align);
        }
        // type_align is a power-of-2, so still offset < ccx.obj_size_bound()
        // llsize_of_alloc(ccx, llty) is also less than ccx.obj_size_bound()
        // so the sum is less than 1<<62 (and therefore can't overflow).
        offset += machine::llsize_of_alloc(ccx, llty);
        if offset >= ccx.obj_size_bound() {
            ccx.report_overbig_object(scapegoat);
        }
    }
}
fn ensure_struct_fits_in_address_space < ' a , ' tcx > ( ccx : & CrateContext < ' a , ' tcx > , fields : & [ Type ] , packed : bool , scapegoat : Ty < ' tcx > ) { let mut offset = 0 ; for & llty in fields { // Invariant: offset < ccx.obj_size_bound() <= 1<<61 if ! packed { let type_align = machine :: llalign_of_min ( ccx , llty ) ; offset = roundup ( offset , type_align ) ; } // type_align is a power-of-2, so still offset < ccx.obj_size_bound() // llsize_of_alloc(ccx, llty) is also less than ccx.obj_size_bound() // so the sum is less than 1<<62 (and therefore can't overflow). offset += machine :: llsize_of_alloc ( ccx , llty ) ; if offset >= ccx . obj_size_bound ( ) { ccx . report_overbig_object ( scapegoat ) ; } } }
LLVM doesn't like types that don't fit in the address space
LLVM doesn ' t like types that don ' t fit in the address space
ccx
&CrateContext<'a, 'tcx>
fields
&[Type]
packed
bool
scapegoat
Ty<'tcx>
ccx
&CrateContext<'a, 'tcx>
fields
&[Type]
packed
bool
scapegoat
Ty<'tcx>