@@ -717,27 +717,13 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
717717 Resolver { tcx : fcx. tcx , infcx : fcx, span, body, replaced_with_error : false }
718718 }
719719
720- fn report_type_error ( & self , t : Ty < ' tcx > ) {
720+ fn report_error ( & self , p : impl Into < ty :: GenericArg < ' tcx > > ) {
721721 if !self . tcx . sess . has_errors ( ) . is_some ( ) {
722722 self . infcx
723723 . emit_inference_failure_err (
724724 Some ( self . body . id ( ) ) ,
725725 self . span . to_span ( self . tcx ) ,
726- t. into ( ) ,
727- E0282 ,
728- false ,
729- )
730- . emit ( ) ;
731- }
732- }
733-
734- fn report_const_error ( & self , c : ty:: Const < ' tcx > ) {
735- if self . tcx . sess . has_errors ( ) . is_none ( ) {
736- self . infcx
737- . emit_inference_failure_err (
738- Some ( self . body . id ( ) ) ,
739- self . span . to_span ( self . tcx ) ,
740- c. into ( ) ,
726+ p. into ( ) ,
741727 E0282 ,
742728 false ,
743729 )
@@ -782,7 +768,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> {
782768 }
783769 Err ( _) => {
784770 debug ! ( "Resolver::fold_ty: input type `{:?}` not fully resolvable" , t) ;
785- self . report_type_error ( t) ;
771+ self . report_error ( t) ;
786772 self . replaced_with_error = true ;
787773 self . tcx ( ) . ty_error ( )
788774 }
@@ -799,7 +785,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> {
799785 Ok ( ct) => self . tcx . erase_regions ( ct) ,
800786 Err ( _) => {
801787 debug ! ( "Resolver::fold_const: input const `{:?}` not fully resolvable" , ct) ;
802- self . report_const_error ( ct) ;
788+ self . report_error ( ct) ;
803789 self . replaced_with_error = true ;
804790 self . tcx ( ) . const_error ( ct. ty ( ) )
805791 }
0 commit comments