@@ -2007,15 +2007,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2007
2007
self . prove_predicate (
2008
2008
ty:: ClauseKind :: WellFormed ( src_ty. into ( ) ) ,
2009
2009
location. to_locations ( ) ,
2010
- ConstraintCategory :: Cast { unsize_to : None } ,
2010
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2011
2011
) ;
2012
2012
2013
2013
let src_ty = self . normalize ( src_ty, location) ;
2014
2014
if let Err ( terr) = self . sub_types (
2015
2015
src_ty,
2016
2016
* ty,
2017
2017
location. to_locations ( ) ,
2018
- ConstraintCategory :: Cast { unsize_to : None } ,
2018
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2019
2019
) {
2020
2020
span_mirbug ! (
2021
2021
self ,
@@ -2036,7 +2036,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2036
2036
self . prove_predicate (
2037
2037
ty:: ClauseKind :: WellFormed ( src_ty. into ( ) ) ,
2038
2038
location. to_locations ( ) ,
2039
- ConstraintCategory :: Cast { unsize_to : None } ,
2039
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2040
2040
) ;
2041
2041
2042
2042
// The type that we see in the fcx is like
@@ -2049,7 +2049,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2049
2049
src_ty,
2050
2050
* ty,
2051
2051
location. to_locations ( ) ,
2052
- ConstraintCategory :: Cast { unsize_to : None } ,
2052
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2053
2053
) {
2054
2054
span_mirbug ! (
2055
2055
self ,
@@ -2074,7 +2074,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2074
2074
ty_fn_ptr_from,
2075
2075
* ty,
2076
2076
location. to_locations ( ) ,
2077
- ConstraintCategory :: Cast { unsize_to : None } ,
2077
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2078
2078
) {
2079
2079
span_mirbug ! (
2080
2080
self ,
@@ -2103,7 +2103,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2103
2103
ty_fn_ptr_from,
2104
2104
* ty,
2105
2105
location. to_locations ( ) ,
2106
- ConstraintCategory :: Cast { unsize_to : None } ,
2106
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2107
2107
) {
2108
2108
span_mirbug ! (
2109
2109
self ,
@@ -2128,6 +2128,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2128
2128
trait_ref,
2129
2129
location. to_locations ( ) ,
2130
2130
ConstraintCategory :: Cast {
2131
+ is_coercion : true ,
2131
2132
unsize_to : Some ( tcx. fold_regions ( ty, |r, _| {
2132
2133
if let ty:: ReVar ( _) = r. kind ( ) {
2133
2134
tcx. lifetimes . re_erased
@@ -2155,7 +2156,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2155
2156
. iter ( )
2156
2157
. map ( |predicate| predicate. with_self_ty ( tcx, self_ty) ) ,
2157
2158
location. to_locations ( ) ,
2158
- ConstraintCategory :: Cast { unsize_to : None } ,
2159
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2159
2160
) ;
2160
2161
2161
2162
let outlives_predicate = tcx. mk_predicate ( Binder :: dummy (
@@ -2166,7 +2167,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2166
2167
self . prove_predicate (
2167
2168
outlives_predicate,
2168
2169
location. to_locations ( ) ,
2169
- ConstraintCategory :: Cast { unsize_to : None } ,
2170
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2170
2171
) ;
2171
2172
}
2172
2173
@@ -2184,7 +2185,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2184
2185
* ty_from,
2185
2186
* ty_to,
2186
2187
location. to_locations ( ) ,
2187
- ConstraintCategory :: Cast { unsize_to : None } ,
2188
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2188
2189
) {
2189
2190
span_mirbug ! (
2190
2191
self ,
@@ -2246,7 +2247,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2246
2247
* ty_elem,
2247
2248
* ty_to,
2248
2249
location. to_locations ( ) ,
2249
- ConstraintCategory :: Cast { unsize_to : None } ,
2250
+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
2250
2251
) {
2251
2252
span_mirbug ! (
2252
2253
self ,
@@ -2427,7 +2428,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
2427
2428
src_obj,
2428
2429
dst_obj,
2429
2430
location. to_locations ( ) ,
2430
- ConstraintCategory :: Cast { unsize_to : None } ,
2431
+ ConstraintCategory :: Cast {
2432
+ is_coercion : false ,
2433
+ unsize_to : None ,
2434
+ } ,
2431
2435
)
2432
2436
. unwrap ( ) ;
2433
2437
}
0 commit comments