@@ -2654,7 +2654,7 @@ private module NonMethodResolution {
26542654 * to `traitTp` being the special `Self` type parameter).
26552655 */
26562656 pragma[nomagic]
2657- private predicate functionResolutionDependsOnArgument (
2657+ private predicate functionResolutionDependsOnArgument0 (
26582658 TraitItemNode trait, NonMethodFunction traitFunction, FunctionPosition pos, ImplItemNode impl,
26592659 NonMethodFunction implFunction, TypePath path, TypeParameter traitTp
26602660 ) {
@@ -2668,6 +2668,19 @@ private module NonMethodResolution {
26682668 )
26692669 }
26702670
2671+ pragma[nomagic]
2672+ private predicate functionResolutionDependsOnArgument(
2673+ ImplItemNode impl, NonMethodFunction f, FunctionPosition pos, TypeParameter traitTp
2674+ ) {
2675+ functionResolutionDependsOnArgument0(_, _, pos, impl, f, _, traitTp)
2676+ or
2677+ f = impl.getASuccessor(_) and
2678+ not impl.(Impl).hasTrait() and
2679+ traitTp = TTypeParamTypeParameter(impl.resolveSelfTy().getTypeParam(0)) and
2680+ pos.isSelf() and
2681+ not f.hasSelfParam()
2682+ }
2683+
26712684 pragma[nomagic]
26722685 private predicate functionInfoBlanketLikeRelevantPos(
26732686 NonMethodFunction f, string name, int arity, ImplItemNode impl, Trait trait,
@@ -2763,7 +2776,7 @@ private module NonMethodResolution {
27632776 result = this.getPathResolutionResolved() and
27642777 result = i.getASuccessor(_) and
27652778 not exists(this.resolveCallTargetViaPathResolution()) and
2766- functionResolutionDependsOnArgument(_, _, _, i, result, _, _)
2779+ functionResolutionDependsOnArgument(i, result, _, _)
27672780 }
27682781
27692782 pragma[nomagic]
@@ -2811,7 +2824,7 @@ private module NonMethodResolution {
28112824 ItemNode resolveCallTargetViaPathResolution() {
28122825 not this.hasTrait() and
28132826 result = this.getPathResolutionResolved() and
2814- not functionResolutionDependsOnArgument(_, _, _, _, result, _, _)
2827+ not functionResolutionDependsOnArgument(_, result, _, _)
28152828 }
28162829
28172830 /**
@@ -2917,7 +2930,7 @@ private module NonMethodResolution {
29172930 ArgsAreInstantiationsOfInputSig
29182931 {
29192932 predicate toCheck(ImplOrTraitItemNode i, Function f, TypeParameter traitTp, FunctionPosition pos) {
2920- functionResolutionDependsOnArgument(_, _, pos, i, f, _ , traitTp)
2933+ functionResolutionDependsOnArgument(i, f, pos , traitTp)
29212934 }
29222935
29232936 final class Call extends NonMethodCall {
@@ -2938,7 +2951,7 @@ private module NonMethodResolution {
29382951 ArgsAreInstantiationsOfInputSig
29392952 {
29402953 predicate toCheck(ImplOrTraitItemNode i, Function f, TypeParameter traitTp, FunctionPosition pos) {
2941- functionResolutionDependsOnArgument(_, _, pos, i, f, _ , traitTp)
2954+ functionResolutionDependsOnArgument(i, f, pos , traitTp)
29422955 or
29432956 // Also match against the trait function itself
29442957 FunctionOverloading::traitTypeParameterOccurrence(i, f, _, pos, _, traitTp) and
@@ -2950,12 +2963,19 @@ private module NonMethodResolution {
29502963 result = getArgType(this, pos, path, _)
29512964 }
29522965
2966+ // private predicate testhasTargetCand(
2967+ // ImplOrTraitItemNode i, Function f, TypeParameter traitTp, FunctionPosition pos
2968+ // ) {
2969+ // this = Debug::getRelevantLocatable() and
2970+ // this.hasTargetCand(i, f) and
2971+ // toCheck(i, f, traitTp, pos)
2972+ // }
29532973 predicate hasTargetCand(ImplOrTraitItemNode i, Function f) {
29542974 f = this.resolveCallTargetNonBlanketCand(i)
29552975 or
29562976 exists(TraitItemNode trait, NonMethodFunction resolved, ImplItemNode i1, Function f1 |
29572977 this.hasTraitResolved(trait, resolved) and
2958- functionResolutionDependsOnArgument (trait, resolved, _, i1, f1, _, _) and
2978+ functionResolutionDependsOnArgument0 (trait, resolved, _, i1, f1, _, _) and
29592979 not BlanketImplementation::isBlanketLike(i, _, _)
29602980 |
29612981 f = resolved and
@@ -2965,10 +2985,10 @@ private module NonMethodResolution {
29652985 i = i1 and
29662986 // Exclude functions where we cannot resolve all relevant type mentions
29672987 forall(TypeParameter traitTp |
2968- functionResolutionDependsOnArgument (trait, resolved, _, i1, f1, _, traitTp)
2988+ functionResolutionDependsOnArgument0 (trait, resolved, _, i1, f1, _, traitTp)
29692989 |
29702990 exists(FunctionPosition pos, TypePath path |
2971- functionResolutionDependsOnArgument (trait, resolved, pos, i1, f1, path, traitTp) and
2991+ functionResolutionDependsOnArgument0 (trait, resolved, pos, i1, f1, path, traitTp) and
29722992 exists(getAssocFunctionTypeAt(f, i, pos, path))
29732993 )
29742994 )
@@ -4117,8 +4137,8 @@ private module Debug {
41174137 Locatable getRelevantLocatable() {
41184138 exists(string filepath, int startline, int startcolumn, int endline, int endcolumn |
41194139 result.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn) and
4120- filepath.matches("%/sqlx .rs") and
4121- startline = [56 .. 60 ]
4140+ filepath.matches("%/main .rs") and
4141+ startline = [568 ]
41224142 )
41234143 }
41244144
0 commit comments