pub struct CleanupDef {
pub object: ObjectId,
pub func: FuncId,
pub param: Ty,
pub call: Expr,
pub range: SourceRange,
}Expand description
A cleanup attribute’s registration: T x __attribute__((cleanup(f)));.
GCC calls f(&x) on every exit from the scope x was declared in, in
reverse declaration order. The two lowerings say that in different ways:
- the structured one binds a drop guard right after the object, so that
Rust’s own drop order — reverse declaration order, on every path out of
the block,
returnfrom inside a statement expression included — is C’s; - the CFG one has no scopes left to drop in, so it emits
CleanupDef::callon each edge that leaves the scope.
Fields§
§object: ObjectIdThe variable whose address the function is given.
func: FuncIdThe function called with it.
param: TyThe type of that function’s one parameter, which is the pointer type the address is converted to.
call: Exprf(&x), ready to be emitted where a scope is left.
range: SourceRangeWhere the declarator was written.
Trait Implementations§
Source§impl Clone for CleanupDef
impl Clone for CleanupDef
Auto Trait Implementations§
impl Freeze for CleanupDef
impl RefUnwindSafe for CleanupDef
impl Send for CleanupDef
impl Sync for CleanupDef
impl Unpin for CleanupDef
impl UnsafeUnpin for CleanupDef
impl UnwindSafe for CleanupDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more