Struct MutableBorrowParams
pub struct MutableBorrowParams {
pub mutable_borrow: HashMap<Symbol, HashSet<Symbol>>,
}Expand description
Mutable borrow parameter analysis result.
Identifies Seq<T> parameters that are only mutated via element access
(SetIndex) but never structurally modified (no Push, Pop, Add, Remove,
or reassignment). These parameters can be passed as &mut [T] instead
of by value, eliminating the move-in/move-out ownership pattern.
Additional requirement: the function must return the parameter as its sole return value, so the call site can drop the assignment.
Fields§
§mutable_borrow: HashMap<Symbol, HashSet<Symbol>>fn_sym → set of param symbols eligible for &mut [T] borrow.
Implementations§
§impl MutableBorrowParams
impl MutableBorrowParams
pub fn analyze(
stmts: &[Stmt<'_>],
callgraph: &CallGraph,
type_env: &TypeEnv,
) -> MutableBorrowParams
pub fn analyze( stmts: &[Stmt<'_>], callgraph: &CallGraph, type_env: &TypeEnv, ) -> MutableBorrowParams
Analyze the program and compute mutable borrow parameters.
pub fn is_mutable_borrow(&self, fn_sym: Symbol, param_sym: Symbol) -> bool
Auto Trait Implementations§
impl Freeze for MutableBorrowParams
impl RefUnwindSafe for MutableBorrowParams
impl Send for MutableBorrowParams
impl Sync for MutableBorrowParams
impl Unpin for MutableBorrowParams
impl UnsafeUnpin for MutableBorrowParams
impl UnwindSafe for MutableBorrowParams
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.