mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
Merge pull request #20845 from hvitved/rust/cache-infer-certain-type
Rust: Cache `inferCertainType`
This commit is contained in:
@@ -9,6 +9,7 @@ private import TypeMention
|
|||||||
private import typeinference.FunctionType
|
private import typeinference.FunctionType
|
||||||
private import typeinference.FunctionOverloading as FunctionOverloading
|
private import typeinference.FunctionOverloading as FunctionOverloading
|
||||||
private import typeinference.BlanketImplementation as BlanketImplementation
|
private import typeinference.BlanketImplementation as BlanketImplementation
|
||||||
|
private import codeql.rust.internal.CachedStages
|
||||||
private import codeql.typeinference.internal.TypeInference
|
private import codeql.typeinference.internal.TypeInference
|
||||||
private import codeql.rust.frameworks.stdlib.Stdlib
|
private import codeql.rust.frameworks.stdlib.Stdlib
|
||||||
private import codeql.rust.frameworks.stdlib.Builtins as Builtins
|
private import codeql.rust.frameworks.stdlib.Builtins as Builtins
|
||||||
@@ -419,9 +420,10 @@ module CertainTypeInference {
|
|||||||
* Holds if `n` has complete and certain type information and if `n` has the
|
* Holds if `n` has complete and certain type information and if `n` has the
|
||||||
* resulting type at `path`.
|
* resulting type at `path`.
|
||||||
*/
|
*/
|
||||||
pragma[nomagic]
|
cached
|
||||||
Type inferCertainType(AstNode n, TypePath path) {
|
Type inferCertainType(AstNode n, TypePath path) {
|
||||||
result = inferAnnotatedType(n, path)
|
result = inferAnnotatedType(n, path) and
|
||||||
|
Stages::TypeInferenceStage::ref()
|
||||||
or
|
or
|
||||||
result = inferCertainCallExprType(n, path)
|
result = inferCertainCallExprType(n, path)
|
||||||
or
|
or
|
||||||
@@ -3407,8 +3409,6 @@ private Type inferCastExprType(CastExpr ce, TypePath path) {
|
|||||||
|
|
||||||
cached
|
cached
|
||||||
private module Cached {
|
private module Cached {
|
||||||
private import codeql.rust.internal.CachedStages
|
|
||||||
|
|
||||||
/** Holds if `receiver` is the receiver of a method call with an implicit dereference. */
|
/** Holds if `receiver` is the receiver of a method call with an implicit dereference. */
|
||||||
cached
|
cached
|
||||||
predicate receiverHasImplicitDeref(AstNode receiver) {
|
predicate receiverHasImplicitDeref(AstNode receiver) {
|
||||||
|
|||||||
Reference in New Issue
Block a user