@@ -20,10 +20,7 @@ use rustc_span::source_map::Spanned;
20
20
use rustc_span:: symbol:: { kw, sym, Ident } ;
21
21
use rustc_span:: { BytePos , Span , DUMMY_SP } ;
22
22
use rustc_target:: abi:: FieldIdx ;
23
- use rustc_trait_selection:: traits:: {
24
- error_reporting:: TypeErrCtxtExt , ObligationCause , Pattern , StructurallyNormalizeExt ,
25
- TraitEngine , TraitEngineExt ,
26
- } ;
23
+ use rustc_trait_selection:: traits:: { ObligationCause , Pattern } ;
27
24
use ty:: VariantDef ;
28
25
29
26
use std:: cmp;
@@ -1987,22 +1984,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1987
1984
tcx. require_lang_item ( hir:: LangItem :: DerefTarget , Some ( span) ) ,
1988
1985
[ expected] ,
1989
1986
) ;
1990
-
1991
- let mut fulfill_cx = <dyn TraitEngine < ' _ > >:: new ( & self . infcx ) ;
1992
- let cause = self . pattern_cause ( pat_info. top_info , span) ;
1993
- let normalized_ty = match self
1994
- . infcx
1995
- . at ( & cause, self . param_env )
1996
- . structurally_normalize ( ty, & mut * fulfill_cx)
1997
- {
1998
- Ok ( normalized_ty) => normalized_ty,
1999
- Err ( errors) => {
2000
- let reported = self . infcx . err_ctxt ( ) . report_fulfillment_errors ( errors) ;
2001
- return Ty :: new_error ( tcx, reported) ;
2002
- }
2003
- } ;
2004
-
2005
- let ty = self . resolve_vars_if_possible ( normalized_ty) ;
1987
+ let ty = self . normalize ( span, ty) ;
1988
+ let ty = self . try_structurally_resolve_type ( span, ty) ;
1989
+ let ty = self . resolve_vars_if_possible ( ty) ;
2006
1990
self . check_pat ( inner, ty, pat_info) ;
2007
1991
expected
2008
1992
}
0 commit comments