@@ -1790,35 +1790,20 @@ private module AssocFunctionResolution {
17901790 FunctionPosition selfPos , DerefChain derefChain , TypePath strippedTypePath , Type strippedType ,
17911791 int n
17921792 ) {
1793- (
1794- this .supportsAutoDerefAndBorrow ( ) and
1795- selfPos .isSelf ( )
1796- or
1797- // needed for the `hasNoCompatibleTarget` check in
1798- // `ArgSatisfiesBlanketLikeConstraintInput::hasBlanketCandidate`
1799- derefChain .isEmpty ( )
1800- ) and
1793+ this .supportsAutoDerefAndBorrow ( ) and
1794+ selfPos .isSelf ( ) and
18011795 strippedType =
18021796 this .getComplexStrippedSelfType ( selfPos , derefChain , TNoBorrowKind ( ) , strippedTypePath ) and
18031797 n = - 1
18041798 or
1799+ this .hasNoCompatibleTargetNoBorrowToIndex ( selfPos , derefChain , strippedTypePath , strippedType ,
1800+ n - 1 ) and
18051801 exists ( Type t |
1806- this .hasNoCompatibleTargetNoBorrowToIndexRec ( selfPos , derefChain , strippedTypePath ,
1807- strippedType , n , t ) and
1802+ t = getNthLookupType ( strippedType , n ) and
18081803 this .hasNoCompatibleTargetCheck ( selfPos , derefChain , TNoBorrowKind ( ) , strippedTypePath , t )
18091804 )
18101805 }
18111806
1812- pragma [ nomagic]
1813- private predicate hasNoCompatibleTargetNoBorrowToIndexRec (
1814- FunctionPosition selfPos , DerefChain derefChain , TypePath strippedTypePath , Type strippedType ,
1815- int n , Type t
1816- ) {
1817- this .hasNoCompatibleTargetNoBorrowToIndex ( selfPos , derefChain , strippedTypePath , strippedType ,
1818- n - 1 ) and
1819- t = getNthLookupType ( strippedType , n )
1820- }
1821-
18221807 /**
18231808 * Holds if the candidate receiver type represented by `derefChain` does not
18241809 * have a matching call target at `selfPos`.
@@ -1841,32 +1826,27 @@ private module AssocFunctionResolution {
18411826 this .supportsAutoDerefAndBorrow ( ) and
18421827 selfPos .isSelf ( )
18431828 or
1844- // needed for the `hasNoCompatibleTarget ` check in
1829+ // needed for the `hasNoCompatibleNonBlanketTarget ` check in
18451830 // `ArgSatisfiesBlanketLikeConstraintInput::hasBlanketCandidate`
1846- derefChain .isEmpty ( )
1831+ exists ( ImplItemNode i |
1832+ derefChain .isEmpty ( ) and
1833+ blanketLikeCandidate ( this , _, selfPos , _, i , _, _, _) and
1834+ i .isBlanketImplementation ( )
1835+ )
18471836 ) and
18481837 strippedType =
18491838 this .getComplexStrippedSelfType ( selfPos , derefChain , TNoBorrowKind ( ) , strippedTypePath ) and
18501839 n = - 1
18511840 or
1841+ this .hasNoCompatibleNonBlanketTargetNoBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1842+ strippedType , n - 1 ) and
18521843 exists ( Type t |
1853- this .hasNoCompatibleNonBlanketTargetNoBorrowToIndexRec ( selfPos , derefChain ,
1854- strippedTypePath , strippedType , n , t ) and
1844+ t = getNthLookupType ( strippedType , n ) and
18551845 this .hasNoCompatibleNonBlanketTargetCheck ( selfPos , derefChain , TNoBorrowKind ( ) ,
18561846 strippedTypePath , t )
18571847 )
18581848 }
18591849
1860- pragma [ nomagic]
1861- private predicate hasNoCompatibleNonBlanketTargetNoBorrowToIndexRec (
1862- FunctionPosition selfPos , DerefChain derefChain , TypePath strippedTypePath , Type strippedType ,
1863- int n , Type t
1864- ) {
1865- this .hasNoCompatibleNonBlanketTargetNoBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1866- strippedType , n - 1 ) and
1867- t = getNthLookupType ( strippedType , n )
1868- }
1869-
18701850 /**
18711851 * Holds if the candidate receiver type represented by `derefChain` does not have
18721852 * a matching non-blanket call target at `selfPos`.
@@ -1893,24 +1873,15 @@ private module AssocFunctionResolution {
18931873 strippedTypePath ) and
18941874 n = - 1
18951875 or
1876+ this .hasNoCompatibleTargetSharedBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1877+ strippedType , n - 1 ) and
18961878 exists ( Type t |
1897- this .hasNoCompatibleTargetSharedBorrowToIndexRec ( selfPos , derefChain , strippedTypePath ,
1898- strippedType , n , t ) and
1879+ t = getNthLookupType ( strippedType , n ) and
18991880 this .hasNoCompatibleNonBlanketLikeTargetCheck ( selfPos , derefChain , TSomeBorrowKind ( false ) ,
19001881 strippedTypePath , t )
19011882 )
19021883 }
19031884
1904- pragma [ nomagic]
1905- private predicate hasNoCompatibleTargetSharedBorrowToIndexRec (
1906- FunctionPosition selfPos , DerefChain derefChain , TypePath strippedTypePath , Type strippedType ,
1907- int n , Type t
1908- ) {
1909- this .hasNoCompatibleTargetSharedBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1910- strippedType , n - 1 ) and
1911- t = getNthLookupType ( strippedType , n )
1912- }
1913-
19141885 /**
19151886 * Holds if the candidate receiver type represented by `derefChain`, followed
19161887 * by a shared borrow, does not have a matching call target at `selfPos`.
@@ -1934,24 +1905,15 @@ private module AssocFunctionResolution {
19341905 this .getComplexStrippedSelfType ( selfPos , derefChain , TSomeBorrowKind ( true ) , strippedTypePath ) and
19351906 n = - 1
19361907 or
1908+ this .hasNoCompatibleTargetMutBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1909+ strippedType , n - 1 ) and
19371910 exists ( Type t |
1938- this .hasNoCompatibleTargetMutBorrowToIndexRec ( selfPos , derefChain , strippedTypePath ,
1939- strippedType , n , t ) and
1911+ t = getNthLookupType ( strippedType , n ) and
19401912 this .hasNoCompatibleNonBlanketLikeTargetCheck ( selfPos , derefChain , TSomeBorrowKind ( true ) ,
19411913 strippedTypePath , t )
19421914 )
19431915 }
19441916
1945- pragma [ nomagic]
1946- private predicate hasNoCompatibleTargetMutBorrowToIndexRec (
1947- FunctionPosition selfPos , DerefChain derefChain , TypePath strippedTypePath , Type strippedType ,
1948- int n , Type t
1949- ) {
1950- this .hasNoCompatibleTargetMutBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1951- strippedType , n - 1 ) and
1952- t = getNthLookupType ( strippedType , n )
1953- }
1954-
19551917 /**
19561918 * Holds if the candidate receiver type represented by `derefChain`, followed
19571919 * by a `mut` borrow, does not have a matching call target at `selfPos`.
@@ -1976,24 +1938,15 @@ private module AssocFunctionResolution {
19761938 strippedTypePath ) and
19771939 n = - 1
19781940 or
1941+ this .hasNoCompatibleNonBlanketTargetSharedBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1942+ strippedType , n - 1 ) and
19791943 exists ( Type t |
1980- this .hasNoCompatibleNonBlanketTargetSharedBorrowToIndexRec ( selfPos , derefChain ,
1981- strippedTypePath , strippedType , n , t ) and
1944+ t = getNthLookupType ( strippedType , n ) and
19821945 this .hasNoCompatibleNonBlanketTargetCheck ( selfPos , derefChain , TSomeBorrowKind ( false ) ,
19831946 strippedTypePath , t )
19841947 )
19851948 }
19861949
1987- pragma [ nomagic]
1988- private predicate hasNoCompatibleNonBlanketTargetSharedBorrowToIndexRec (
1989- FunctionPosition selfPos , DerefChain derefChain , TypePath strippedTypePath , Type strippedType ,
1990- int n , Type t
1991- ) {
1992- this .hasNoCompatibleNonBlanketTargetSharedBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1993- strippedType , n - 1 ) and
1994- t = getNthLookupType ( strippedType , n )
1995- }
1996-
19971950 /**
19981951 * Holds if the candidate receiver type represented by `derefChain`, followed
19991952 * by a shared borrow, does not have a matching non-blanket call target at `selfPos`.
@@ -2019,24 +1972,15 @@ private module AssocFunctionResolution {
20191972 this .getComplexStrippedSelfType ( selfPos , derefChain , TSomeBorrowKind ( true ) , strippedTypePath ) and
20201973 n = - 1
20211974 or
1975+ this .hasNoCompatibleNonBlanketTargetMutBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
1976+ strippedType , n - 1 ) and
20221977 exists ( Type t |
2023- this .hasNoCompatibleNonBlanketTargetMutBorrowToIndexRec ( selfPos , derefChain ,
2024- strippedTypePath , strippedType , n , t ) and
1978+ t = getNthLookupType ( strippedType , n ) and
20251979 this .hasNoCompatibleNonBlanketTargetCheck ( selfPos , derefChain , TSomeBorrowKind ( true ) ,
20261980 strippedTypePath , t )
20271981 )
20281982 }
20291983
2030- pragma [ nomagic]
2031- private predicate hasNoCompatibleNonBlanketTargetMutBorrowToIndexRec (
2032- FunctionPosition selfPos , DerefChain derefChain , TypePath strippedTypePath , Type strippedType ,
2033- int n , Type t
2034- ) {
2035- this .hasNoCompatibleNonBlanketTargetMutBorrowToIndex ( selfPos , derefChain , strippedTypePath ,
2036- strippedType , n - 1 ) and
2037- t = getNthLookupType ( strippedType , n )
2038- }
2039-
20401984 /**
20411985 * Holds if the candidate receiver type represented by `derefChain`, followed
20421986 * by a `mut` borrow, does not have a matching non-blanket call target at `selfPos`.
@@ -2486,7 +2430,7 @@ private module AssocFunctionResolution {
24862430 // this is to account for codebases that use the (unstable) specialization feature
24872431 // (https://rust-lang.github.io/rfcs/1210-impl-specialization.html), as well as
24882432 // cases where our blanket implementation filtering is not precise enough.
2489- ( afcc .hasNoCompatibleNonBlanketTarget ( ) or not impl . isBlanketImplementation ( ) )
2433+ if impl . isBlanketImplementation ( ) then afcc .hasNoCompatibleNonBlanketTarget ( ) else any ( )
24902434 |
24912435 borrow .isNoBorrow ( )
24922436 or
0 commit comments