File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -674,10 +674,13 @@ impl<'db> InferenceTable<'db> {
674674 let args = [ ty, arg_ty] ;
675675 let trait_ref = TraitRef :: new ( self . interner ( ) , fn_trait. into ( ) , args) ;
676676
677+ let proj_args = self
678+ . infer_ctxt
679+ . fill_rest_fresh_args ( output_assoc_type. into ( ) , args. into_iter ( ) . map ( Into :: into) ) ;
677680 let projection = Ty :: new_alias (
678681 self . interner ( ) ,
679682 rustc_type_ir:: AliasTyKind :: Projection ,
680- AliasTy :: new ( self . interner ( ) , output_assoc_type. into ( ) , args ) ,
683+ AliasTy :: new ( self . interner ( ) , output_assoc_type. into ( ) , proj_args ) ,
681684 ) ;
682685
683686 let pred = Predicate :: upcast_from ( trait_ref, self . interner ( ) ) ;
Original file line number Diff line number Diff line change @@ -524,3 +524,31 @@ fn g(it: *const (dyn Trait)) {
524524"# ,
525525 ) ;
526526}
527+
528+ #[ test]
529+ fn regression_20951 ( ) {
530+ check_infer (
531+ r#"
532+ //- minicore: async_fn
533+ trait DoesSomething {
534+ fn do_something(&self) -> impl Future<Output = usize>;
535+ }
536+
537+ impl<F> DoesSomething for F
538+ where
539+ F: AsyncFn() -> usize,
540+ {
541+ fn do_something(&self) -> impl Future<Output = usize> {
542+ self()
543+ }
544+ }
545+ "# ,
546+ expect ! [ [ r#"
547+ 43..47 'self': &'? Self
548+ 168..172 'self': &'? F
549+ 205..227 '{ ... }': <F as AsyncFnMut<()>>::CallRefFuture<'<erased>>
550+ 215..219 'self': &'? F
551+ 215..221 'self()': <F as AsyncFnMut<()>>::CallRefFuture<'<erased>>
552+ "# ] ] ,
553+ ) ;
554+ }
You can’t perform that action at this time.
0 commit comments