@@ -1878,6 +1878,37 @@ private module AssocFunctionResolution {
18781878 selfPosAdj , derefChain , borrow ) , impl )
18791879 }
18801880
1881+ pragma [ nomagic]
1882+ private predicate hasNoInherentTargetCheck (
1883+ FunctionPosition selfPosAdj , DerefChain derefChain , BorrowKind borrow
1884+ ) {
1885+ MkAssocFunctionCallCand ( this , selfPosAdj , derefChain , borrow )
1886+ .( AssocFunctionCallCand )
1887+ .hasNoInherentTargetCheck ( )
1888+ }
1889+
1890+ pragma [ nomagic]
1891+ private predicate hasNoInherentTargetTypeQualifierCheck ( ) {
1892+ exists ( FunctionPosition typeQualifierPos |
1893+ typeQualifierPos .isTypeQualifier ( ) and
1894+ this .hasNoInherentTargetCheck ( typeQualifierPos , DerefChain:: nil ( ) , TNoBorrowKind ( ) )
1895+ )
1896+ }
1897+
1898+ pragma [ nomagic]
1899+ predicate hasNoInherentTarget (
1900+ FunctionPosition selfPosAdj , DerefChain derefChain , BorrowKind borrow
1901+ ) {
1902+ this .hasNoInherentTargetCheck ( selfPosAdj , derefChain , borrow ) and
1903+ if exists ( getNonTypeParameterTypeQualifier ( this ) ) and not selfPosAdj .isTypeQualifier ( )
1904+ then
1905+ // If this call is of the form `Foo::bar(x)` and we are resolving with respect to the type
1906+ // of `x`, then we additionally need to check that the type qualifier does not give rise
1907+ // to an inherent target
1908+ this .hasNoInherentTargetTypeQualifierCheck ( )
1909+ else any ( )
1910+ }
1911+
18811912 /**
18821913 * Same as `getSelfTypeAt`, but excludes pseudo types `!` and `unknown`.
18831914 */
@@ -2480,19 +2511,7 @@ private module AssocFunctionResolution {
24802511 predicate hasNoInherentTarget ( ) {
24812512 afc_ .hasTrait ( )
24822513 or
2483- this .hasNoInherentTargetCheck ( ) and
2484- if exists ( getNonTypeParameterTypeQualifier ( afc_ ) ) and not selfPosAdj_ .isTypeQualifier ( )
2485- then
2486- // If this call is of the form `Foo::bar(x)` and we are resolving with respect to the type
2487- // of `x`, then we additionally need to check that the type qualifier does not give rise
2488- // to an inherent target
2489- exists ( FunctionPosition typeQualifierPos |
2490- typeQualifierPos .isTypeQualifier ( ) and
2491- MkAssocFunctionCallCand ( afc_ , typeQualifierPos , _, _)
2492- .( AssocFunctionCallCand )
2493- .hasNoInherentTargetCheck ( )
2494- )
2495- else any ( )
2514+ afc_ .hasNoInherentTarget ( selfPosAdj_ , derefChain , borrow )
24962515 }
24972516
24982517 pragma [ nomagic]
0 commit comments