pub fn volatile_read(&self, lhs: &P<Expr>, lhs_type: CQualTypeId) -> Result<P<Expr>, String> {
        let addr_lhs = match lhs.node {
            ExprKind::Unary(ast::UnOp::Deref, ref e) => {
                if !lhs_type.qualifiers.is_const {
                    let lhs_type = self.convert_type(lhs_type.ctype)?;
                    let ty = mk().ptr_ty(lhs_type);

                    mk().cast_expr(e, ty)
                } else {
                    e.clone()
                }
            }
            _ => {
                let addr_lhs = mk().addr_of_expr(lhs);

                let lhs_type = self.convert_type(lhs_type.ctype)?;
                let ty = mk().ptr_ty(lhs_type);

                mk().cast_expr(addr_lhs, ty)
            }
        };

        // We explicitly annotate the type of pointer we're reading from
        // in order to avoid omitted bit-casts to const from causing the
        // wrong type to be inferred via the result of the pointer.
        let mut path_parts: Vec<PathSegment> = vec![];
        for elt in vec!["", "std", "ptr"] {
            path_parts.push(mk().path_segment(elt))
        }
        let elt_ty = self.convert_type(lhs_type.ctype)?;
        let ty_params = mk().angle_bracketed_param_types(vec![elt_ty]);
        let elt = mk().path_segment_with_params("read_volatile", ty_params);
        path_parts.push(elt);

        let read_volatile_expr = mk().path_expr(path_parts);
        Ok(mk().call_expr(read_volatile_expr, vec![addr_lhs]))
    }
/// Read from a `lhs` that is volatile
Read from a `lhs` that is volatile
Read from a ` lhs ` that is volatile
pub fn volatile_read(&self, lhs: &P<Expr>, lhs_type: CQualTypeId) -> Result<P<Expr>, String> {
        let addr_lhs = match lhs.node {
            ExprKind::Unary(ast::UnOp::Deref, ref e) => {
                if !lhs_type.qualifiers.is_const {
                    let lhs_type = self.convert_type(lhs_type.ctype)?;
                    let ty = mk().ptr_ty(lhs_type);
                    mk().cast_expr(e, ty)
                } else {
                    e.clone()
                }
            }
            _ => {
                let addr_lhs = mk().addr_of_expr(lhs);
                let lhs_type = self.convert_type(lhs_type.ctype)?;
                let ty = mk().ptr_ty(lhs_type);
                mk().cast_expr(addr_lhs, ty)
            }
        };
        // We explicitly annotate the type of pointer we're reading from
        // in order to avoid omitted bit-casts to const from causing the
        // wrong type to be inferred via the result of the pointer.
        let mut path_parts: Vec<PathSegment> = vec![];
        for elt in vec!["", "std", "ptr"] {
            path_parts.push(mk().path_segment(elt))
        }
        let elt_ty = self.convert_type(lhs_type.ctype)?;
        let ty_params = mk().angle_bracketed_param_types(vec![elt_ty]);
        let elt = mk().path_segment_with_params("read_volatile", ty_params);
        path_parts.push(elt);
        let read_volatile_expr = mk().path_expr(path_parts);
        Ok(mk().call_expr(read_volatile_expr, vec![addr_lhs]))
    }
pub fn volatile_read ( & self , lhs : & P < Expr > , lhs_type : CQualTypeId ) -> Result < P < Expr > , String > { let addr_lhs = match lhs . node { ExprKind :: Unary ( ast :: UnOp :: Deref , ref e ) => { if ! lhs_type . qualifiers . is_const { let lhs_type = self . convert_type ( lhs_type . ctype ) ? ; let ty = mk ( ) . ptr_ty ( lhs_type ) ; mk ( ) . cast_expr ( e , ty ) } else { e . clone ( ) } } _ => { let addr_lhs = mk ( ) . addr_of_expr ( lhs ) ; let lhs_type = self . convert_type ( lhs_type . ctype ) ? ; let ty = mk ( ) . ptr_ty ( lhs_type ) ; mk ( ) . cast_expr ( addr_lhs , ty ) } } ; // We explicitly annotate the type of pointer we're reading from // in order to avoid omitted bit-casts to const from causing the // wrong type to be inferred via the result of the pointer. let mut path_parts : Vec < PathSegment > = vec ! [ ] ; for elt in vec ! [ " " " " " " ] { path_parts . push ( mk ( ) . path_segment ( elt ) ) } let elt_ty = self . convert_type ( lhs_type . ctype ) ? ; let ty_params = mk ( ) . angle_bracketed_param_types ( vec ! [ elt_ty ] ) ; let elt = mk ( ) . path_segment_with_params ( " " , ty_params ) ; path_parts . push ( elt ) ; let read_volatile_expr = mk ( ) . path_expr ( path_parts ) ; Ok ( mk ( ) . call_expr ( read_volatile_expr , vec ! [ addr_lhs ] ) ) }
Read from a `lhs` that is volatile
Read from a ` lhs ` that is volatile
&self
lhs
&P<Expr>
lhs_type
CQualTypeId
&self
lhs
&P<Expr>
lhs_type
CQualTypeId