@@ -1633,7 +1633,7 @@ private module AssocFunctionResolution {
16331633 * Same as `getTypeAt`, but without borrows.
16341634 */
16351635 pragma [ nomagic]
1636- Type getTypeAtNoBorrow ( FunctionPosition selfPos , DerefChain derefChain , TypePath path ) {
1636+ Type getSelfTypeAtNoBorrow ( FunctionPosition selfPos , DerefChain derefChain , TypePath path ) {
16371637 result = this .getTypeAt ( selfPos , path ) and
16381638 derefChain .isEmpty ( )
16391639 or
@@ -1692,19 +1692,19 @@ private module AssocFunctionResolution {
16921692 * Same as `getTypeAt`, but excludes pseudo types `!` and `unknown`.
16931693 */
16941694 pragma [ nomagic]
1695- Type getANonPseudoTypeAt (
1695+ Type getANonPseudoSelfTypeAt (
16961696 FunctionPosition selfPos , DerefChain derefChain , BorrowKind borrow , TypePath path
16971697 ) {
1698- result = this .getTypeAt ( selfPos , derefChain , borrow , path ) and
1698+ result = this .getSelfTypeAt ( selfPos , derefChain , borrow , path ) and
16991699 result != TNeverType ( ) and
17001700 result != TUnknownType ( )
17011701 }
17021702
17031703 pragma [ nomagic]
1704- private Type getComplexStrippedType (
1704+ private Type getComplexStrippedSelfType (
17051705 FunctionPosition selfPos , DerefChain derefChain , BorrowKind borrow , TypePath strippedTypePath
17061706 ) {
1707- result = this .getANonPseudoTypeAt ( selfPos , derefChain , borrow , strippedTypePath ) and
1707+ result = this .getANonPseudoSelfTypeAt ( selfPos , derefChain , borrow , strippedTypePath ) and
17081708 (
17091709 isComplexRootStripped ( strippedTypePath , result )
17101710 or
@@ -1766,7 +1766,7 @@ private module AssocFunctionResolution {
17661766 derefChain .isEmpty ( )
17671767 ) and
17681768 strippedType =
1769- this .getComplexStrippedType ( selfPos , derefChain , TNoBorrowKind ( ) , strippedTypePath ) and
1769+ this .getComplexStrippedSelfType ( selfPos , derefChain , TNoBorrowKind ( ) , strippedTypePath ) and
17701770 n = - 1
17711771 or
17721772 this .hasNoCompatibleTargetNoBorrowToIndex ( selfPos , derefChain , strippedTypePath , strippedType ,
@@ -1803,7 +1803,7 @@ private module AssocFunctionResolution {
18031803 derefChain .isEmpty ( )
18041804 ) and
18051805 strippedType =
1806- this .getComplexStrippedType ( selfPos , derefChain , TNoBorrowKind ( ) , strippedTypePath ) and
1806+ this .getComplexStrippedSelfType ( selfPos , derefChain , TNoBorrowKind ( ) , strippedTypePath ) and
18071807 n = - 1
18081808 or
18091809 this .hasNoCompatibleNonBlanketTargetNoBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
@@ -1836,7 +1836,8 @@ private module AssocFunctionResolution {
18361836 ) {
18371837 this .hasNoCompatibleTargetNoBorrow ( selfPos , derefChain ) and
18381838 strippedType =
1839- this .getComplexStrippedType ( selfPos , derefChain , TSomeBorrowKind ( false ) , strippedTypePath ) and
1839+ this .getComplexStrippedSelfType ( selfPos , derefChain , TSomeBorrowKind ( false ) ,
1840+ strippedTypePath ) and
18401841 n = - 1
18411842 or
18421843 this .hasNoCompatibleTargetSharedBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
@@ -1867,7 +1868,7 @@ private module AssocFunctionResolution {
18671868 ) {
18681869 this .hasNoCompatibleTargetSharedBorrow ( selfPos , derefChain ) and
18691870 strippedType =
1870- this .getComplexStrippedType ( selfPos , derefChain , TSomeBorrowKind ( true ) , strippedTypePath ) and
1871+ this .getComplexStrippedSelfType ( selfPos , derefChain , TSomeBorrowKind ( true ) , strippedTypePath ) and
18711872 n = - 1
18721873 or
18731874 this .hasNoCompatibleTargetMutBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
@@ -1898,7 +1899,8 @@ private module AssocFunctionResolution {
18981899 ) {
18991900 this .hasNoCompatibleTargetNoBorrow ( selfPos , derefChain ) and
19001901 strippedType =
1901- this .getComplexStrippedType ( selfPos , derefChain , TSomeBorrowKind ( false ) , strippedTypePath ) and
1902+ this .getComplexStrippedSelfType ( selfPos , derefChain , TSomeBorrowKind ( false ) ,
1903+ strippedTypePath ) and
19021904 n = - 1
19031905 or
19041906 this .hasNoCompatibleNonBlanketTargetSharedBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
@@ -1931,7 +1933,7 @@ private module AssocFunctionResolution {
19311933 ) {
19321934 this .hasNoCompatibleNonBlanketTargetSharedBorrow ( selfPos , derefChain ) and
19331935 strippedType =
1934- this .getComplexStrippedType ( selfPos , derefChain , TSomeBorrowKind ( true ) , strippedTypePath ) and
1936+ this .getComplexStrippedSelfType ( selfPos , derefChain , TSomeBorrowKind ( true ) , strippedTypePath ) and
19351937 n = - 1
19361938 or
19371939 this .hasNoCompatibleNonBlanketTargetMutBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
@@ -1972,8 +1974,10 @@ private module AssocFunctionResolution {
19721974 * [1]: https://doc.rust-lang.org/reference/expressions/method-call-expr.html#r-expr.method.candidate-receivers
19731975 */
19741976 pragma [ nomagic]
1975- Type getTypeAt ( FunctionPosition selfPos , DerefChain derefChain , BorrowKind borrow , TypePath path ) {
1976- result = this .getTypeAtNoBorrow ( selfPos , derefChain , path ) and
1977+ Type getSelfTypeAt (
1978+ FunctionPosition selfPos , DerefChain derefChain , BorrowKind borrow , TypePath path
1979+ ) {
1980+ result = this .getSelfTypeAtNoBorrow ( selfPos , derefChain , path ) and
19771981 borrow .isNoBorrow ( )
19781982 or
19791983 exists ( RefType rt |
@@ -1993,7 +1997,7 @@ private module AssocFunctionResolution {
19931997 result = rt
19941998 or
19951999 exists ( TypePath suffix |
1996- result = this .getTypeAtNoBorrow ( selfPos , derefChain , suffix ) and
2000+ result = this .getSelfTypeAtNoBorrow ( selfPos , derefChain , suffix ) and
19972001 path = TypePath:: cons ( rt .getPositionalTypeParameter ( 0 ) , suffix )
19982002 )
19992003 )
@@ -2178,14 +2182,17 @@ private module AssocFunctionResolution {
21782182 ) {
21792183 exists ( TypePath strippedTypePath , Type strippedType |
21802184 strippedType =
2181- substituteLookupTraits ( afc .getANonPseudoTypeAt ( selfPos , derefChain , borrow ,
2185+ substituteLookupTraits ( afc .getANonPseudoSelfTypeAt ( selfPos , derefChain , borrow ,
21822186 strippedTypePath ) )
21832187 |
21842188 selfPos .isSelfOrTypeQualifier ( )
21852189 or
2186- blanketLikeCandidate ( afc , _, _, selfPosAdj , _, _, _, _)
2187- or
2188- nonBlanketCandidate ( afc , _, _, selfPosAdj , _, _, strippedTypePath , strippedType )
2190+ not afc .hasReceiver ( ) and
2191+ (
2192+ blanketLikeCandidate ( afc , _, _, selfPosAdj , _, _, _, _)
2193+ or
2194+ nonBlanketCandidate ( afc , _, _, selfPosAdj , _, _, strippedTypePath , strippedType )
2195+ )
21892196 ) and
21902197 if afc .hasReceiver ( )
21912198 then selfPosAdj = selfPos .getFunctionCallAdjusted ( )
@@ -2207,7 +2214,8 @@ private module AssocFunctionResolution {
22072214 AssocFunctionCall getAssocFunctionCall ( ) { result = afc_ }
22082215
22092216 Type getTypeAt ( TypePath path ) {
2210- result = substituteLookupTraits ( afc_ .getANonPseudoTypeAt ( selfPos , derefChain , borrow , path ) )
2217+ result =
2218+ substituteLookupTraits ( afc_ .getANonPseudoSelfTypeAt ( selfPos , derefChain , borrow , path ) )
22112219 }
22122220
22132221 pragma [ nomagic]
@@ -2308,7 +2316,7 @@ private module AssocFunctionResolution {
23082316 mc .supportsAutoDerefAndBorrow ( ) and
23092317 selfPos .isSelf ( ) and
23102318 mc .hasNoCompatibleTargetMutBorrow ( selfPos , derefChain ) and
2311- exists ( mc .getTypeAtNoBorrow ( selfPos , derefChain , TypePath:: nil ( ) ) )
2319+ exists ( mc .getSelfTypeAtNoBorrow ( selfPos , derefChain , TypePath:: nil ( ) ) )
23122320 }
23132321
23142322 /** A method call with a dereference chain. */
@@ -2320,7 +2328,7 @@ private module AssocFunctionResolution {
23202328 MethodCallDerefCand ( ) { this = MkMethodCallDerefCand ( mc , selfPos , derefChain ) }
23212329
23222330 Type getTypeAt ( TypePath path ) {
2323- result = substituteLookupTraits ( mc .getTypeAtNoBorrow ( selfPos , derefChain , path ) ) and
2331+ result = substituteLookupTraits ( mc .getSelfTypeAtNoBorrow ( selfPos , derefChain , path ) ) and
23242332 result != TNeverType ( ) and
23252333 result != TUnknownType ( )
23262334 }
@@ -2623,7 +2631,7 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
26232631 FunctionPosition pos , AccessPosition apos , string derefChainBorrow , TypePath path
26242632 ) {
26252633 exists ( DerefChain derefChain , BorrowKind borrow |
2626- result = this .getTypeAt ( pos , derefChain , borrow , path ) and
2634+ result = this .getSelfTypeAt ( pos , derefChain , borrow , path ) and
26272635 derefChainBorrow = encodeDerefChainBorrow ( pos , derefChain , borrow ) and
26282636 if this .hasReceiver ( ) then apos = pos else pos = apos .getFunctionCallAdjusted ( )
26292637 )
@@ -2632,7 +2640,7 @@ private module MethodCallMatchingInput implements MatchingWithEnvironmentInputSi
26322640 pragma [ nomagic]
26332641 private Type getInferredNonSelfType ( FunctionPosition pos , AccessPosition apos , TypePath path ) {
26342642 exists ( DerefChain derefChain , BorrowKind borrow |
2635- result = this .getTypeAt ( pos , derefChain , borrow , path ) and
2643+ result = this .getSelfTypeAt ( pos , derefChain , borrow , path ) and
26362644 derefChain .isEmpty ( ) and
26372645 borrow .isNoBorrow ( ) and
26382646 if this .hasReceiver ( ) then apos = pos else pos = apos .getFunctionCallAdjusted ( )
0 commit comments