Skip to main content

Module cache_array_length

Module cache_array_length 

Source

Re-exportsยง

use super::CacheArrayLength; ๐Ÿ”’
use crate::linter::LateLintPass; ๐Ÿ”’
use crate::linter::LintContext; ๐Ÿ”’
use crate::sol::Severity; ๐Ÿ”’
use crate::sol::SolLint; ๐Ÿ”’
use crate::sol::analysis::for_each_lhs_var; ๐Ÿ”’
use solar::ast::ElementaryType; ๐Ÿ”’
use solar::interface::Span; ๐Ÿ”’
use solar::interface::data_structures::Never; ๐Ÿ”’
use solar::interface::sym; ๐Ÿ”’
use solar::sema::Gcx; ๐Ÿ”’
use solar::sema::builtins::Builtin; ๐Ÿ”’
use solar::sema::hir; ๐Ÿ”’
use solar::sema::hir::BinOpKind; ๐Ÿ”’
use solar::sema::hir::Expr; ๐Ÿ”’
use solar::sema::hir::ExprKind; ๐Ÿ”’
use solar::sema::hir::LoopSource; ๐Ÿ”’
use solar::sema::hir::StateMutability; ๐Ÿ”’
use solar::sema::hir::Stmt; ๐Ÿ”’
use solar::sema::hir::StmtKind; ๐Ÿ”’
use solar::sema::hir::VariableId; ๐Ÿ”’
use solar::sema::hir::Visit as _; ๐Ÿ”’
use solar::sema::ty::TyKind; ๐Ÿ”’
use std::ops::ControlFlow; ๐Ÿ”’

Structsยง

LoopFacts ๐Ÿ”’
Loop body facts that make caching unsafe: variables written, array length mutations and calls that may mutate state.

Staticsยง

CACHE_ARRAY_LENGTH

Functionsยง

call_may_mutate_state ๐Ÿ”’
Whether a call may write storage; array push/pop count since they change the length.
collect_length_reads ๐Ÿ”’
Collects <state dynamic array>.length reads compared against an identifier in expr.
is_array_like ๐Ÿ”’
state_dyn_array ๐Ÿ”’
The state variable expr names, if it is a dynamic array.