@@ -82,7 +82,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
8282
8383 // While we don't allow *arbitrary* coercions here, we *do* allow
8484 // coercions from ! to `expected`.
85- if self . try_structurally_resolve_type ( expr . span , ty) . is_never ( )
85+ if self . resolve_vars_with_obligations ( ty) . is_never ( )
8686 && self . tcx . expr_guaranteed_to_constitute_read_for_never ( expr)
8787 {
8888 if let Some ( adjustments) = self . typeck_results . borrow ( ) . adjustments ( ) . get ( expr. hir_id ) {
@@ -300,7 +300,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
300300 // unless it's a place expression that isn't being read from, in which case
301301 // diverging would be unsound since we may never actually read the `!`.
302302 // e.g. `let _ = *never_ptr;` with `never_ptr: *const !`.
303- if self . try_structurally_resolve_type ( expr . span , ty) . is_never ( )
303+ if self . resolve_vars_with_obligations ( ty) . is_never ( )
304304 && self . tcx . expr_guaranteed_to_constitute_read_for_never ( expr)
305305 {
306306 self . diverges . set ( self . diverges . get ( ) | Diverges :: always ( expr. span ) ) ;
@@ -454,7 +454,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
454454 expr : & ' tcx hir:: Expr < ' tcx > ,
455455 ) -> Ty < ' tcx > {
456456 let hint = expected. only_has_type ( self ) . map_or ( NoExpectation , |ty| {
457- match self . try_structurally_resolve_type ( expr . span , ty) . kind ( ) {
457+ match self . resolve_vars_with_obligations ( ty) . kind ( ) {
458458 ty:: Ref ( _, ty, _) | ty:: RawPtr ( ty, _) => {
459459 if oprnd. is_syntactic_place_expr ( ) {
460460 // Places may legitimately have unsized types.
@@ -1187,7 +1187,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
11871187 let cond_diverges = self . diverges . get ( ) ;
11881188 self . diverges . set ( Diverges :: Maybe ) ;
11891189
1190- let expected = orig_expected. try_structurally_resolve_and_adjust_for_branches ( self , sp ) ;
1190+ let expected = orig_expected. try_structurally_resolve_and_adjust_for_branches ( self ) ;
11911191 let then_ty = self . check_expr_with_expectation ( then_expr, expected) ;
11921192 let then_diverges = self . diverges . get ( ) ;
11931193 self . diverges . set ( Diverges :: Maybe ) ;
@@ -1457,7 +1457,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14571457 expected : Expectation < ' tcx > ,
14581458 ) -> Ty < ' tcx > {
14591459 let rcvr_t = self . check_expr ( rcvr) ;
1460- let rcvr_t = self . try_structurally_resolve_type ( rcvr . span , rcvr_t) ;
1460+ let rcvr_t = self . resolve_vars_with_obligations ( rcvr_t) ;
14611461
14621462 match self . lookup_method ( rcvr_t, segment, segment. ident . span , expr, rcvr, args) {
14631463 Ok ( method) => {
@@ -1644,11 +1644,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
16441644 let coerce_to = expected
16451645 . to_option ( self )
16461646 . and_then ( |uty| {
1647- self . try_structurally_resolve_type ( expr . span , uty)
1647+ self . resolve_vars_with_obligations ( uty)
16481648 . builtin_index ( )
16491649 // Avoid using the original type variable as the coerce_to type, as it may resolve
16501650 // during the first coercion instead of being the LUB type.
1651- . filter ( |t| !self . try_structurally_resolve_type ( expr . span , * t) . is_ty_var ( ) )
1651+ . filter ( |t| !self . resolve_vars_with_obligations ( * t) . is_ty_var ( ) )
16521652 } )
16531653 . unwrap_or_else ( || self . next_ty_var ( expr. span ) ) ;
16541654 let mut coerce = CoerceMany :: with_capacity ( coerce_to, args. len ( ) ) ;
@@ -1773,7 +1773,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
17731773 ) -> Ty < ' tcx > {
17741774 let mut expectations = expected
17751775 . only_has_type ( self )
1776- . and_then ( |ty| self . try_structurally_resolve_type ( expr . span , ty) . opt_tuple_fields ( ) )
1776+ . and_then ( |ty| self . resolve_vars_with_obligations ( ty) . opt_tuple_fields ( ) )
17771777 . unwrap_or_default ( )
17781778 . iter ( ) ;
17791779
@@ -1847,7 +1847,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18471847 ) {
18481848 let tcx = self . tcx ;
18491849
1850- let adt_ty = self . try_structurally_resolve_type ( path_span , adt_ty) ;
1850+ let adt_ty = self . resolve_vars_with_obligations ( adt_ty) ;
18511851 let adt_ty_hint = expected. only_has_type ( self ) . and_then ( |expected| {
18521852 self . fudge_inference_if_ok ( || {
18531853 let ocx = ObligationCtxt :: new ( self ) ;
0 commit comments