Skip to content

Rust: Move local name resolution logic into shared library#21873

Draft
hvitved wants to merge 8 commits into
github:mainfrom
hvitved:local-name-resolution
Draft

Rust: Move local name resolution logic into shared library#21873
hvitved wants to merge 8 commits into
github:mainfrom
hvitved:local-name-resolution

Conversation

@hvitved
Copy link
Copy Markdown
Contributor

@hvitved hvitved commented May 20, 2026

No description provided.

@github-actions github-actions Bot added the Rust Pull requests that update Rust code label May 20, 2026
Comment thread rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll Fixed
Comment thread rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll Fixed
Comment thread rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll Fixed
Comment on lines +88 to +98
/**
* An adjusted version of `ParentChild::getImmediateChild`, which makes the following
* two adjustments:
*
* 1. For conditions like `if cond body`, instead of letting `body` be the second child
* of `if`, we make it the last child of `cond`. This ensures that variables
* introduced in the `cond` scope are available in `body`.
*
* 2. A similar adjustment is made for `while` loops: the body of the loop is made a
* child of the loop condition instead of the loop itself.
*/
* 2. A similar adjustment is made for `while` loops: the body of the loop is made a
* child of the loop condition instead of the loop itself.
*/
int getRank(C parent, Ranked child) {
* `scope`. The pre-order numbering of the binding site of `v`, amongst
* all nodes nested under `scope`, is `ord`.
*/
private predicate variableDeclInScope(AstNode definingNode, string name, AstNode scope) {
Comment thread rust/ql/lib/codeql/rust/elements/internal/VariableImpl.qll Fixed

/** A local access. */
final class LocalAccess extends AstNodeFinal {
private string name;
pat = p.(Param).getPat()
)
)
)
class NestedFunctionAccess extends LocalAccess {
private Function f;

NestedFunctionAccess() { nestedFunctionAccess(_, f, this) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Rust Pull requests that update Rust code

2 participants