@@ -1830,12 +1830,18 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
1830
1830
( TransmutabilityCandidate , _) | ( _, TransmutabilityCandidate ) => DropVictim :: No ,
1831
1831
1832
1832
// (*)
1833
- ( BuiltinCandidate { has_nested : false } | ConstDestructCandidate ( _) , _) => {
1834
- DropVictim :: Yes
1835
- }
1836
- ( _, BuiltinCandidate { has_nested : false } | ConstDestructCandidate ( _) ) => {
1837
- DropVictim :: No
1838
- }
1833
+ (
1834
+ BuiltinCandidate { has_nested : false }
1835
+ | ConstDestructCandidate ( _)
1836
+ | MetadataCastCandidate { require_eq : false } ,
1837
+ _,
1838
+ ) => DropVictim :: Yes ,
1839
+ (
1840
+ _,
1841
+ BuiltinCandidate { has_nested : false }
1842
+ | ConstDestructCandidate ( _)
1843
+ | MetadataCastCandidate { require_eq : false } ,
1844
+ ) => DropVictim :: No ,
1839
1845
1840
1846
( ParamCandidate ( other) , ParamCandidate ( victim) ) => {
1841
1847
let same_except_bound_vars = other. skip_binder ( ) . trait_ref
@@ -1873,6 +1879,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
1873
1879
| BuiltinUnsizeCandidate
1874
1880
| TraitUpcastingUnsizeCandidate ( _)
1875
1881
| BuiltinCandidate { .. }
1882
+ | MetadataCastCandidate { .. }
1876
1883
| TraitAliasCandidate
1877
1884
| ObjectCandidate ( _)
1878
1885
| ProjectionCandidate ( _) ,
@@ -1903,6 +1910,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
1903
1910
| BuiltinUnsizeCandidate
1904
1911
| TraitUpcastingUnsizeCandidate ( _)
1905
1912
| BuiltinCandidate { has_nested : true }
1913
+ | MetadataCastCandidate { require_eq : true }
1906
1914
| TraitAliasCandidate ,
1907
1915
ParamCandidate ( ref victim_cand) ,
1908
1916
) => {
@@ -1939,6 +1947,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
1939
1947
| BuiltinUnsizeCandidate
1940
1948
| TraitUpcastingUnsizeCandidate ( _)
1941
1949
| BuiltinCandidate { .. }
1950
+ | MetadataCastCandidate { .. }
1942
1951
| TraitAliasCandidate ,
1943
1952
) => DropVictim :: Yes ,
1944
1953
@@ -1955,6 +1964,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
1955
1964
| BuiltinUnsizeCandidate
1956
1965
| TraitUpcastingUnsizeCandidate ( _)
1957
1966
| BuiltinCandidate { .. }
1967
+ | MetadataCastCandidate { .. }
1958
1968
| TraitAliasCandidate ,
1959
1969
ObjectCandidate ( _) | ProjectionCandidate ( _) ,
1960
1970
) => DropVictim :: No ,
@@ -2063,6 +2073,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
2063
2073
| BuiltinUnsizeCandidate
2064
2074
| TraitUpcastingUnsizeCandidate ( _)
2065
2075
| BuiltinCandidate { has_nested : true }
2076
+ | MetadataCastCandidate { require_eq : true }
2066
2077
| TraitAliasCandidate ,
2067
2078
ImplCandidate ( _)
2068
2079
| ClosureCandidate { .. }
@@ -2075,6 +2086,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
2075
2086
| BuiltinUnsizeCandidate
2076
2087
| TraitUpcastingUnsizeCandidate ( _)
2077
2088
| BuiltinCandidate { has_nested : true }
2089
+ | MetadataCastCandidate { require_eq : true }
2078
2090
| TraitAliasCandidate ,
2079
2091
) => DropVictim :: No ,
2080
2092
}
0 commit comments