Skip to content

Commit 969fb1c

Browse files
committed
wip
1 parent e08b3b8 commit 969fb1c

File tree

3 files changed

+0
-98
lines changed

3 files changed

+0
-98
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll

-12
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,6 @@ predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
115115
)
116116
}
117117

118-
private predicate sdf(CallExprBase call, Function f) {
119-
CallExprBaseImpl::getCallResolvable(call).getResolvedPath() = "<crate::option::Option>::unwrap" and
120-
// CallExprBaseImpl::getCallResolvable(call).getResolvedCrateOrigin() = "lang:core" and
121-
f = call.getStaticTarget()
122-
}
123-
124-
private predicate sdf2(CallExprBase call) {
125-
CallExprBaseImpl::getCallResolvable(call).getResolvedPath() = "<crate::option::Option>::unwrap"
126-
// CallExprBaseImpl::getCallResolvable(call).getResolvedCrateOrigin() = "lang:core" and
127-
// f = call.getStaticTarget()
128-
}
129-
130118
private class SummarizedCallableFromModel extends SummarizedCallable::Range {
131119
private string crate;
132120
private string path;

rust/ql/lib/codeql/rust/internal/PathResolution.qll

-64
Original file line numberDiff line numberDiff line change
@@ -1344,14 +1344,6 @@ private module Debug {
13441344
result = resolvePath(path)
13451345
}
13461346

1347-
private ItemNode sdfsf(RelevantPath path, ImplItemNode impl, ItemNode frm) {
1348-
path = getRelevantLocatable() and
1349-
result = resolvePath(path) and
1350-
result = impl.resolveSelfTy() and
1351-
frm = impl.getASuccessorRec("from") and
1352-
frm instanceof AssocItemNode
1353-
}
1354-
13551347
predicate debugUseImportEdge(Use use, string name, ItemNode item) {
13561348
use = getRelevantLocatable() and
13571349
useImportEdge(use, name, item)
@@ -1372,59 +1364,3 @@ private module Debug {
13721364
fileImport(m, f)
13731365
}
13741366
}
1375-
1376-
private predicate sdfs(ImplItemNode impl) {
1377-
// resolvePath(impl.getSelfPath()).getLocation().getStartLine() = [35, 36]
1378-
impl.getLocation().getFile().getBaseName() = "main.rs" //and
1379-
// impl.getLocation().getStartLine() = [35 .. 38]
1380-
}
1381-
1382-
private import Type
1383-
private import TypeInference
1384-
1385-
private predicate sdf3(
1386-
AstNode n, Type t, ImplItemNode impl, string path, RelevantPath p, ImplOrTraitItemNode i,
1387-
TraitType tt, Function f, string name
1388-
) {
1389-
t = inferType(n) and
1390-
n.getLocation().getStartLine() = 29 and
1391-
t = TStruct(impl.resolveSelfTy()) and
1392-
// t = debugInferType(_, _) and
1393-
impl.toString() = "impl ...::Iterator for ...::Args { ... }" and
1394-
path = p.toStringDebug() and
1395-
p = impl.getTraitPath().getQualifier*() and
1396-
i = resolvePath(p) and
1397-
impl.isFullyParametric() and
1398-
tt = TTrait(i) and
1399-
f = tt.getMethod(name) and
1400-
f = i.getAnAssocItem() and
1401-
name = "collect" and
1402-
f = impl.resolveSelfTy().getASuccessor(name)
1403-
}
1404-
1405-
private predicate sdf4(
1406-
ImplItemNode impl, string path, RelevantPath p, ItemNode iter, Use u, string usePath,
1407-
RelevantPath usePathPrefix, ItemNode useResolved
1408-
) {
1409-
// t = debugInferType(_, _) and
1410-
impl.toString() = "impl ...::Iterator for ...::Args { ... }" and
1411-
path = p.toStringDebug() and
1412-
p = impl.getTraitPath().getQualifier*() and
1413-
iter = resolvePath(p) and
1414-
iter.getName() = "iter" and
1415-
u = iter.(Module).getItemList().getAnItem() and
1416-
usePath = u.getUseTree().getPath().toStringDebug() and
1417-
usePath = "self::traits::Iterator" and
1418-
usePathPrefix = u.getUseTree().getPath().getQualifier*() and
1419-
useResolved = resolvePath(usePathPrefix)
1420-
}
1421-
1422-
private predicate sdf5(ImplItemNode impl, string path, RelevantPath p, ItemNode iter, Module m) {
1423-
// t = debugInferType(_, _) and
1424-
impl.toString() = "impl ...::Iterator for ...::Args { ... }" and
1425-
path = p.toStringDebug() and
1426-
p = impl.getTraitPath().getQualifier*() and
1427-
iter = resolvePath(p) and
1428-
iter.getName() = "iter" and
1429-
m = iter.(Module).getItemList().getAnItem()
1430-
}

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

-22
Original file line numberDiff line numberDiff line change
@@ -474,28 +474,6 @@ module Make1<LocationSig Location, InputSig1<Location> Input1> {
474474
module Matching<MatchingInputSig Input> {
475475
private import Input
476476

477-
private predicate testunadjustedAccessType(
478-
Access a, AccessPosition apos, DeclarationPosition dpos, Declaration target, TypePath path,
479-
Type t, Type paramType, TypePath paramTypePath
480-
) {
481-
target = a.getTarget() and
482-
t = a.getInferredType(apos, path) and
483-
target.toString() = "fn unwrap" and
484-
// accessDeclarationPositionMatch(apos, dpos) and
485-
paramType = target.getDeclaredType(dpos, paramTypePath)
486-
// )
487-
}
488-
489-
private predicate testadjustedAccessType(
490-
Access a, AccessPosition apos, Declaration target, TypePath path0, Type t0, TypePath path,
491-
Type t
492-
) {
493-
target = a.getTarget() and
494-
t0 = a.getInferredType(apos, path0) and
495-
adjustAccessType(apos, target, path0, t0, path, t) and
496-
target.toString() = "fn unwrap"
497-
}
498-
499477
/**
500478
* Holds if `a` targets `target` and the type for `apos` at `path` in `a`
501479
* is `t` after adjustment by `target`.

0 commit comments

Comments
 (0)