From 1ac9e5a2a4e40edba2ce3fb07245f5455b03d460 Mon Sep 17 00:00:00 2001 From: Tom Hvitved Date: Tue, 17 Mar 2026 09:51:15 +0100 Subject: [PATCH] Rust: Elaborate QL doc on `FunctionPosition` class --- .../lib/codeql/rust/internal/typeinference/FunctionType.qll | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rust/ql/lib/codeql/rust/internal/typeinference/FunctionType.qll b/rust/ql/lib/codeql/rust/internal/typeinference/FunctionType.qll index 37df796a7be..26627450add 100644 --- a/rust/ql/lib/codeql/rust/internal/typeinference/FunctionType.qll +++ b/rust/ql/lib/codeql/rust/internal/typeinference/FunctionType.qll @@ -15,6 +15,12 @@ private newtype TFunctionPosition = * Either `return` or a positional parameter index, where `self` is translated * to position `0` and subsequent positional parameters at index `i` are * translated to position `i + 1`. + * + * Function-call adjusted positions are needed when resolving calls of the + * form `Foo::f(x_1, ..., x_n)`, where we do not know up front whether `f` is a + * method or a non-method, and hence we need to be able to match `x_1` against + * both a potential `self` parameter and a potential first positional parameter + * (and `x_2, ... x_n` against all subsequent positional parameters). */ class FunctionPosition extends TFunctionPosition { int asPosition() { result = this.asArgumentPosition().asPosition() }