@@ -717,27 +717,13 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
717
717
Resolver { tcx : fcx. tcx , infcx : fcx, span, body, replaced_with_error : false }
718
718
}
719
719
720
- fn report_type_error ( & self , t : Ty < ' tcx > ) {
720
+ fn report_error ( & self , p : impl Into < ty :: GenericArg < ' tcx > > ) {
721
721
if !self . tcx . sess . has_errors ( ) . is_some ( ) {
722
722
self . infcx
723
723
. emit_inference_failure_err (
724
724
Some ( self . body . id ( ) ) ,
725
725
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 ( ) ,
741
727
E0282 ,
742
728
false ,
743
729
)
@@ -782,7 +768,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> {
782
768
}
783
769
Err ( _) => {
784
770
debug ! ( "Resolver::fold_ty: input type `{:?}` not fully resolvable" , t) ;
785
- self . report_type_error ( t) ;
771
+ self . report_error ( t) ;
786
772
self . replaced_with_error = true ;
787
773
self . tcx ( ) . ty_error ( )
788
774
}
@@ -799,7 +785,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for Resolver<'cx, 'tcx> {
799
785
Ok ( ct) => self . tcx . erase_regions ( ct) ,
800
786
Err ( _) => {
801
787
debug ! ( "Resolver::fold_const: input const `{:?}` not fully resolvable" , ct) ;
802
- self . report_const_error ( ct) ;
788
+ self . report_error ( ct) ;
803
789
self . replaced_with_error = true ;
804
790
self . tcx ( ) . const_error ( ct. ty ( ) )
805
791
}
0 commit comments