From 05a487ec3bae0bbcadd9019eb546760619a0988e Mon Sep 17 00:00:00 2001 From: Geoffrey White <40627776+geoffw0@users.noreply.github.com> Date: Thu, 5 Feb 2026 15:56:58 +0000 Subject: [PATCH] Rust: Repair following merge. --- .../rust/dataflow/internal/ModelsAsData.qll | 42 +++---------------- 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll b/rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll index 161ee7d1bbd..d31d9229c49 100644 --- a/rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll +++ b/rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll @@ -125,41 +125,6 @@ predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) { ) } -private predicate summaryModel( - Function f, string input, string output, string kind, Provenance provenance, boolean isInherited, - QlBuiltins::ExtensionId madId -) { - exists(string path, Function f0 | - summaryModel(path, input, output, kind, provenance, madId) and - f0.getCanonicalPath() = path - | - f = f0 and - isInherited = false - or - f.implements(f0) and - isInherited = true - ) -} - -private predicate summaryModelRelevant( - Function f, string input, string output, string kind, Provenance provenance, boolean isInherited, - QlBuiltins::ExtensionId madId -) { - summaryModel(f, input, output, kind, provenance, isInherited, madId) and - // Only apply generated or inherited models to functions in library code and - // when no strictly better model (or neutral model) exists - if provenance.isGenerated() or isInherited = true - then - not f.fromSource() and - not exists(Provenance other | summaryModel(f, _, _, _, other, false, _) | - provenance.isGenerated() and other.isManual() - or - provenance = other and isInherited = true - ) and - not neutralModel(f.getCanonicalPath(), "summary", _, _) - else any() -} - private class SummarizedCallableFromModel extends SummarizedCallable::Range { string input_; string output_; @@ -179,7 +144,12 @@ private class SummarizedCallableFromModel extends SummarizedCallable::Range { isExact_ = false and // making inherited models generated means that source code definitions and // exact generated models take precedence - p_ = "hq-generated" + p_ = "hq-generated" and + // Only apply generated models (including inherited models) when no neutral model exists + not ( + p_.isGenerated() and + neutralModel(path, "summary", _, _) + ) ) }