@@ -4,7 +4,7 @@ use std::collections::BTreeMap;
44
55use rustc_abi:: { FieldIdx , VariantIdx } ;
66use rustc_data_structures:: fx:: FxIndexMap ;
7- use rustc_errors:: { Applicability , Diag , EmissionGuarantee , MultiSpan } ;
7+ use rustc_errors:: { Applicability , Diag , EmissionGuarantee , MultiSpan , listify } ;
88use rustc_hir:: def:: { CtorKind , Namespace } ;
99use rustc_hir:: { self as hir, CoroutineKind , LangItem } ;
1010use rustc_index:: IndexSlice ;
@@ -29,7 +29,7 @@ use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
2929use rustc_trait_selection:: error_reporting:: traits:: call_kind:: { CallDesugaringKind , call_kind} ;
3030use rustc_trait_selection:: infer:: InferCtxtExt ;
3131use rustc_trait_selection:: traits:: {
32- FulfillmentErrorCode , type_known_to_meet_bound_modulo_regions,
32+ FulfillmentError , FulfillmentErrorCode , type_known_to_meet_bound_modulo_regions,
3333} ;
3434use tracing:: debug;
3535
@@ -370,6 +370,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
370370 ProjectionElem :: Downcast ( ..) => ( ) ,
371371 ProjectionElem :: OpaqueCast ( ..) => ( ) ,
372372 ProjectionElem :: Subtype ( ..) => ( ) ,
373+ ProjectionElem :: UnwrapUnsafeBinder ( _) => ( ) ,
373374 ProjectionElem :: Field ( field, _ty) => {
374375 // FIXME(project-rfc_2229#36): print capture precisely here.
375376 if let Some ( field) = self . is_upvar_field_projection ( PlaceRef {
@@ -450,9 +451,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
450451 PlaceRef { local, projection : proj_base } . ty ( self . body , self . infcx . tcx )
451452 }
452453 ProjectionElem :: Downcast ( ..) => place. ty ( self . body , self . infcx . tcx ) ,
453- ProjectionElem :: Subtype ( ty) | ProjectionElem :: OpaqueCast ( ty ) => {
454- PlaceTy :: from_ty ( * ty)
455- }
454+ ProjectionElem :: Subtype ( ty)
455+ | ProjectionElem :: OpaqueCast ( ty)
456+ | ProjectionElem :: UnwrapUnsafeBinder ( ty ) => PlaceTy :: from_ty ( * ty ) ,
456457 ProjectionElem :: Field ( _, field_type) => PlaceTy :: from_ty ( * field_type) ,
457458 } ,
458459 } ;
@@ -1433,17 +1434,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
14331434 error. obligation. predicate,
14341435 )
14351436 }
1436- [ errors @ .. , last ] => {
1437+ _ => {
14371438 format ! (
14381439 "you could `clone` the value and consume it, if the \
1439- following trait bounds could be satisfied: \
1440- {} and `{}`",
1441- errors
1442- . iter( )
1443- . map( |e| format!( "`{}`" , e. obligation. predicate) )
1444- . collect:: <Vec <_>>( )
1445- . join( ", " ) ,
1446- last. obligation. predicate,
1440+ following trait bounds could be satisfied: {}",
1441+ listify( & errors, |e: & FulfillmentError <' tcx>| format!(
1442+ "`{}`" ,
1443+ e. obligation. predicate
1444+ ) )
1445+ . unwrap( ) ,
14471446 )
14481447 }
14491448 } ;
0 commit comments