Skip to content

Commit 45b518d

Browse files
committed
Shared, Rust: Ensure that the constraints in satisfiesConstraintType are in relevantConstraint
1 parent 47aa7ba commit 45b518d

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

shared/typeinference/codeql/typeinference/internal/TypeInference.qll

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
989989
path = prefix0.append(suffix)
990990
)
991991
or
992-
tt.getTypeAt(TypePath::nil()) = constraint and
992+
hasTypeConstraint(tt, constraint, constraint) and
993993
t = tt.getTypeAt(path)
994994
}
995995
}
@@ -1279,6 +1279,15 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
12791279
SatisfiesConstraint<RelevantAccess, SatisfiesConstraintInput>::satisfiesConstraintType(MkRelevantAccess(a,
12801280
target, apos, prefix), constraint, path, t)
12811281
}
1282+
1283+
predicate satisfiesConstraintTypeRestricted(
1284+
Access a, Declaration target, AccessPosition apos, TypePath prefix, Type constraint,
1285+
TypePath path, Type t
1286+
) {
1287+
SatisfiesConstraint<RelevantAccess, SatisfiesConstraintInput>::satisfiesConstraintType(MkRelevantAccess(a,
1288+
target, apos, prefix), constraint, path, t) and
1289+
relevantAccessConstraint(a, target, apos, prefix, constraint)
1290+
}
12821291
}
12831292

12841293
/**

0 commit comments

Comments
 (0)