@@ -4,7 +4,7 @@ use std::collections::BTreeMap;
4
4
5
5
use rustc_abi:: { FieldIdx , VariantIdx } ;
6
6
use rustc_data_structures:: fx:: FxIndexMap ;
7
- use rustc_errors:: { Applicability , Diag , EmissionGuarantee , MultiSpan } ;
7
+ use rustc_errors:: { Applicability , Diag , EmissionGuarantee , MultiSpan , listify } ;
8
8
use rustc_hir:: def:: { CtorKind , Namespace } ;
9
9
use rustc_hir:: { self as hir, CoroutineKind , LangItem } ;
10
10
use rustc_index:: IndexSlice ;
@@ -29,7 +29,7 @@ use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
29
29
use rustc_trait_selection:: error_reporting:: traits:: call_kind:: { CallDesugaringKind , call_kind} ;
30
30
use rustc_trait_selection:: infer:: InferCtxtExt ;
31
31
use rustc_trait_selection:: traits:: {
32
- FulfillmentErrorCode , type_known_to_meet_bound_modulo_regions,
32
+ FulfillmentError , FulfillmentErrorCode , type_known_to_meet_bound_modulo_regions,
33
33
} ;
34
34
use tracing:: debug;
35
35
@@ -370,6 +370,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
370
370
ProjectionElem :: Downcast ( ..) => ( ) ,
371
371
ProjectionElem :: OpaqueCast ( ..) => ( ) ,
372
372
ProjectionElem :: Subtype ( ..) => ( ) ,
373
+ ProjectionElem :: UnwrapUnsafeBinder ( _) => ( ) ,
373
374
ProjectionElem :: Field ( field, _ty) => {
374
375
// FIXME(project-rfc_2229#36): print capture precisely here.
375
376
if let Some ( field) = self . is_upvar_field_projection ( PlaceRef {
@@ -450,9 +451,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
450
451
PlaceRef { local, projection : proj_base } . ty ( self . body , self . infcx . tcx )
451
452
}
452
453
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 ) ,
456
457
ProjectionElem :: Field ( _, field_type) => PlaceTy :: from_ty ( * field_type) ,
457
458
} ,
458
459
} ;
@@ -1433,17 +1434,15 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
1433
1434
error. obligation. predicate,
1434
1435
)
1435
1436
}
1436
- [ errors @ .. , last ] => {
1437
+ _ => {
1437
1438
format ! (
1438
1439
"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( ) ,
1447
1446
)
1448
1447
}
1449
1448
} ;
0 commit comments