fn count_in_bytes(
        &self,
        count: Expr,
        ty: Ty<'tcx>,
        res_ty: Type,
        intrinsic: &str,
        loc: Location,
    ) -> (Expr, Stmt) {
        assert!(res_ty.is_integer());
        let layout = self.layout_of(ty);
        let size_of_elem = Expr::int_constant(layout.size.bytes(), res_ty);
        let size_of_count_elems = count.mul_overflow(size_of_elem);
        let message = format!(
            "{}: attempt to compute number in bytes which would overflow",
            intrinsic.to_string()
        );
        let assert_stmt = self.codegen_assert(
            size_of_count_elems.overflowed.not(),
            PropertyClass::ArithmeticOverflow,
            message.as_str(),
            loc,
        );
        (size_of_count_elems.result, assert_stmt)
    }
/// Computes (multiplies) the equivalent of a memory-related number (e.g., an offset) in bytes.
/// Because this operation may result in an arithmetic overflow, it includes an overflow check.
/// Returns a tuple with:
///  * The result expression of the computation.
///  * An assertion statement to ensure the operation has not overflowed.
Computes (multiplies) the equivalent of a memory-related number  in bytes.
Because this operation may result in an arithmetic overflow, it includes an overflow check.
Returns a tuple with:
The result expression of the computation.
An assertion statement to ensure the operation has not overflowed.
Computes ( multiplies ) the equivalent of a memory - related number in bytes . Because this operation may result in an arithmetic overflow it includes an overflow check . Returns a tuple with : The result expression of the computation . An assertion statement to ensure the operation has not overflowed .
fn count_in_bytes(
        &self,
        count: Expr,
        ty: Ty<'tcx>,
        res_ty: Type,
        intrinsic: &str,
        loc: Location,
    ) -> (Expr, Stmt) {
        assert!(res_ty.is_integer());
        let layout = self.layout_of(ty);
        let size_of_elem = Expr::int_constant(layout.size.bytes(), res_ty);
        let size_of_count_elems = count.mul_overflow(size_of_elem);
        let message = format!(
            "{}: attempt to compute number in bytes which would overflow",
            intrinsic.to_string()
        );
        let assert_stmt = self.codegen_assert(
            size_of_count_elems.overflowed.not(),
            PropertyClass::ArithmeticOverflow,
            message.as_str(),
            loc,
        );
        (size_of_count_elems.result, assert_stmt)
    }
fn count_in_bytes ( & self , count : Expr , ty : Ty < ' tcx > , res_ty : Type , intrinsic : & str , loc : Location , ) -> ( Expr , Stmt ) { assert ! ( res_ty is_integer ( ) ) ; let layout = self . layout_of ( ty ) ; let size_of_elem = Expr :: int_constant ( layout . size . bytes ( ) , res_ty ) ; let size_of_count_elems = count . mul_overflow ( size_of_elem ) ; let message = format ! ( " " intrinsic to_string ( ) ) ; let assert_stmt = self . codegen_assert ( size_of_count_elems . overflowed . not ( ) , PropertyClass :: ArithmeticOverflow , message . as_str ( ) , loc , ) ; ( size_of_count_elems . result , assert_stmt ) }
Computes (multiplies) the equivalent of a memory-related number (e.g., an offset) in bytes.
Computes ( multiplies ) the equivalent of a memory - related number ( e . g . an offset ) in bytes .
&self
count
Expr
ty
Ty<'tcx>
res_ty
Type
intrinsic
&str
loc
Location