@@ -2007,15 +2007,15 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20072007 self . prove_predicate (
20082008 ty:: ClauseKind :: WellFormed ( src_ty. into ( ) ) ,
20092009 location. to_locations ( ) ,
2010- ConstraintCategory :: Cast { unsize_to : None } ,
2010+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
20112011 ) ;
20122012
20132013 let src_ty = self . normalize ( src_ty, location) ;
20142014 if let Err ( terr) = self . sub_types (
20152015 src_ty,
20162016 * ty,
20172017 location. to_locations ( ) ,
2018- ConstraintCategory :: Cast { unsize_to : None } ,
2018+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
20192019 ) {
20202020 span_mirbug ! (
20212021 self ,
@@ -2036,7 +2036,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20362036 self . prove_predicate (
20372037 ty:: ClauseKind :: WellFormed ( src_ty. into ( ) ) ,
20382038 location. to_locations ( ) ,
2039- ConstraintCategory :: Cast { unsize_to : None } ,
2039+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
20402040 ) ;
20412041
20422042 // The type that we see in the fcx is like
@@ -2049,7 +2049,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20492049 src_ty,
20502050 * ty,
20512051 location. to_locations ( ) ,
2052- ConstraintCategory :: Cast { unsize_to : None } ,
2052+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
20532053 ) {
20542054 span_mirbug ! (
20552055 self ,
@@ -2074,7 +2074,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
20742074 ty_fn_ptr_from,
20752075 * ty,
20762076 location. to_locations ( ) ,
2077- ConstraintCategory :: Cast { unsize_to : None } ,
2077+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
20782078 ) {
20792079 span_mirbug ! (
20802080 self ,
@@ -2103,7 +2103,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21032103 ty_fn_ptr_from,
21042104 * ty,
21052105 location. to_locations ( ) ,
2106- ConstraintCategory :: Cast { unsize_to : None } ,
2106+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
21072107 ) {
21082108 span_mirbug ! (
21092109 self ,
@@ -2128,6 +2128,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21282128 trait_ref,
21292129 location. to_locations ( ) ,
21302130 ConstraintCategory :: Cast {
2131+ is_coercion : true ,
21312132 unsize_to : Some ( tcx. fold_regions ( ty, |r, _| {
21322133 if let ty:: ReVar ( _) = r. kind ( ) {
21332134 tcx. lifetimes . re_erased
@@ -2155,7 +2156,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21552156 . iter ( )
21562157 . map ( |predicate| predicate. with_self_ty ( tcx, self_ty) ) ,
21572158 location. to_locations ( ) ,
2158- ConstraintCategory :: Cast { unsize_to : None } ,
2159+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
21592160 ) ;
21602161
21612162 let outlives_predicate = tcx. mk_predicate ( Binder :: dummy (
@@ -2166,7 +2167,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21662167 self . prove_predicate (
21672168 outlives_predicate,
21682169 location. to_locations ( ) ,
2169- ConstraintCategory :: Cast { unsize_to : None } ,
2170+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
21702171 ) ;
21712172 }
21722173
@@ -2184,7 +2185,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
21842185 * ty_from,
21852186 * ty_to,
21862187 location. to_locations ( ) ,
2187- ConstraintCategory :: Cast { unsize_to : None } ,
2188+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
21882189 ) {
21892190 span_mirbug ! (
21902191 self ,
@@ -2246,7 +2247,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
22462247 * ty_elem,
22472248 * ty_to,
22482249 location. to_locations ( ) ,
2249- ConstraintCategory :: Cast { unsize_to : None } ,
2250+ ConstraintCategory :: Cast { is_coercion : true , unsize_to : None } ,
22502251 ) {
22512252 span_mirbug ! (
22522253 self ,
@@ -2427,7 +2428,10 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
24272428 src_obj,
24282429 dst_obj,
24292430 location. to_locations ( ) ,
2430- ConstraintCategory :: Cast { unsize_to : None } ,
2431+ ConstraintCategory :: Cast {
2432+ is_coercion : false ,
2433+ unsize_to : None ,
2434+ } ,
24312435 )
24322436 . unwrap ( ) ;
24332437 }
0 commit comments