@@ -18,7 +18,7 @@ use rustc_span::def_id::LocalDefId;
18
18
use rustc_span:: { DUMMY_SP , Span } ;
19
19
use rustc_trait_selection:: error_reporting:: traits:: ArgKind ;
20
20
use rustc_trait_selection:: traits;
21
- use rustc_type_ir:: ClosureKind ;
21
+ use rustc_type_ir:: { ClosureKind , Upcast as _ } ;
22
22
use tracing:: { debug, instrument, trace} ;
23
23
24
24
use super :: { CoroutineTypes , Expectation , FnCtxt , check_fn} ;
@@ -312,16 +312,18 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
312
312
. iter_instantiated_copied ( self . tcx , args)
313
313
. map ( |( c, s) | ( c. as_predicate ( ) , s) ) ,
314
314
) ,
315
- ty:: Dynamic ( object_type, ..) => {
316
- let sig = object_type. projection_bounds ( ) . find_map ( |pb| {
317
- let pb = pb. with_self_ty ( self . tcx , self . tcx . types . trait_object_dummy_self ) ;
318
- self . deduce_sig_from_projection ( None , closure_kind, pb)
319
- } ) ;
320
- let kind = object_type
321
- . principal_def_id ( )
322
- . and_then ( |did| self . tcx . fn_trait_kind_from_def_id ( did) ) ;
323
- ( sig, kind)
324
- }
315
+ ty:: Dynamic ( data, ..) => self . deduce_closure_signature_from_predicates (
316
+ expected_ty,
317
+ closure_kind,
318
+ data. iter ( ) . map ( |bound| {
319
+ (
320
+ bound
321
+ . with_self_ty ( self . tcx , self . tcx . types . trait_object_dummy_self )
322
+ . upcast ( self . tcx ) ,
323
+ DUMMY_SP ,
324
+ )
325
+ } ) ,
326
+ ) ,
325
327
ty:: Infer ( ty:: TyVar ( vid) ) => self . deduce_closure_signature_from_predicates (
326
328
Ty :: new_var ( self . tcx , self . root_var ( vid) ) ,
327
329
closure_kind,
0 commit comments