@@ -798,13 +798,16 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
798
798
bug ! ( "`resolve_ty_and_res_fully_qualified_call` called on `LangItem`" )
799
799
}
800
800
} ;
801
+
802
+ self . register_wf_obligation (
803
+ ty. raw . into ( ) ,
804
+ qself. span ,
805
+ ObligationCauseCode :: WellFormed ( None ) ,
806
+ ) ;
807
+ self . select_obligations_where_possible ( |_| { } ) ;
808
+
801
809
if let Some ( & cached_result) = self . typeck_results . borrow ( ) . type_dependent_defs ( ) . get ( hir_id)
802
810
{
803
- self . register_wf_obligation (
804
- ty. raw . into ( ) ,
805
- qself. span ,
806
- ObligationCauseCode :: WellFormed ( None ) ,
807
- ) ;
808
811
// Return directly on cache hit. This is useful to avoid doubly reporting
809
812
// errors with default match binding modes. See #44614.
810
813
let def = cached_result. map_or ( Res :: Err , |( kind, def_id) | Res :: Def ( kind, def_id) ) ;
@@ -824,18 +827,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
824
827
825
828
let trait_missing_method =
826
829
matches ! ( error, method:: MethodError :: NoMatch ( _) ) && ty. normalized . is_trait ( ) ;
827
- // If we have a path like `MyTrait::missing_method`, then don't register
828
- // a WF obligation for `dyn MyTrait` when method lookup fails. Otherwise,
829
- // register a WF obligation so that we can detect any additional
830
- // errors in the self type.
831
- if !trait_missing_method {
832
- self . register_wf_obligation (
833
- ty. raw . into ( ) ,
834
- qself. span ,
835
- ObligationCauseCode :: WellFormed ( None ) ,
836
- ) ;
837
- }
838
-
839
830
if item_name. name != kw:: Empty {
840
831
self . report_method_error (
841
832
hir_id,
@@ -849,14 +840,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
849
840
result
850
841
} ) ;
851
842
852
- if result. is_ok ( ) {
853
- self . register_wf_obligation (
854
- ty. raw . into ( ) ,
855
- qself. span ,
856
- ObligationCauseCode :: WellFormed ( None ) ,
857
- ) ;
858
- }
859
-
860
843
// Write back the new resolution.
861
844
self . write_resolution ( hir_id, result) ;
862
845
(
0 commit comments