@@ -2440,23 +2440,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24402440 self . cause ( span, ObligationCauseCode :: MiscObligation )
24412441 }
24422442
2443- /// Resolves type variables in `ty` if possible. Unlike the infcx
2443+ /// Resolves type and const variables in `ty` if possible. Unlike the infcx
24442444 /// version (resolve_vars_if_possible), this version will
24452445 /// also select obligations if it seems useful, in an effort
24462446 /// to get more type information.
2447- fn resolve_type_vars_with_obligations ( & self , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > {
2448- debug ! ( "resolve_type_vars_with_obligations (ty={:?})" , ty) ;
2447+ fn resolve_vars_with_obligations ( & self , mut ty : Ty < ' tcx > ) -> Ty < ' tcx > {
2448+ debug ! ( "resolve_vars_with_obligations (ty={:?})" , ty) ;
24492449
24502450 // No Infer()? Nothing needs doing.
2451- if !ty. has_infer_types ( ) {
2452- debug ! ( "resolve_type_vars_with_obligations : ty={:?}" , ty) ;
2451+ if !ty. has_infer_types ( ) && !ty . has_infer_consts ( ) {
2452+ debug ! ( "resolve_vars_with_obligations : ty={:?}" , ty) ;
24532453 return ty;
24542454 }
24552455
24562456 // If `ty` is a type variable, see whether we already know what it is.
24572457 ty = self . resolve_vars_if_possible ( & ty) ;
2458- if !ty. has_infer_types ( ) {
2459- debug ! ( "resolve_type_vars_with_obligations : ty={:?}" , ty) ;
2458+ if !ty. has_infer_types ( ) && !ty . has_infer_consts ( ) {
2459+ debug ! ( "resolve_vars_with_obligations : ty={:?}" , ty) ;
24602460 return ty;
24612461 }
24622462
@@ -2467,7 +2467,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
24672467 self . select_obligations_where_possible ( false , |_| { } ) ;
24682468 ty = self . resolve_vars_if_possible ( & ty) ;
24692469
2470- debug ! ( "resolve_type_vars_with_obligations : ty={:?}" , ty) ;
2470+ debug ! ( "resolve_vars_with_obligations : ty={:?}" , ty) ;
24712471 ty
24722472 }
24732473
@@ -3668,7 +3668,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
36683668 formal_ret : Ty < ' tcx > ,
36693669 formal_args : & [ Ty < ' tcx > ] )
36703670 -> Vec < Ty < ' tcx > > {
3671- let formal_ret = self . resolve_type_vars_with_obligations ( formal_ret) ;
3671+ let formal_ret = self . resolve_vars_with_obligations ( formal_ret) ;
36723672 let ret_ty = match expected_ret. only_has_type ( self ) {
36733673 Some ( ret) => ret,
36743674 None => return Vec :: new ( )
@@ -4517,7 +4517,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
45174517 err. span_suggestion (
45184518 span,
45194519 "try adding a return type" ,
4520- format ! ( "-> {} " , self . resolve_type_vars_with_obligations ( found) ) ,
4520+ format ! ( "-> {} " , self . resolve_vars_with_obligations ( found) ) ,
45214521 Applicability :: MachineApplicable ) ;
45224522 true
45234523 }
@@ -4993,7 +4993,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
49934993 // If no resolution is possible, then an error is reported.
49944994 // Numeric inference variables may be left unresolved.
49954995 pub fn structurally_resolved_type ( & self , sp : Span , ty : Ty < ' tcx > ) -> Ty < ' tcx > {
4996- let ty = self . resolve_type_vars_with_obligations ( ty) ;
4996+ let ty = self . resolve_vars_with_obligations ( ty) ;
49974997 if !ty. is_ty_var ( ) {
49984998 ty
49994999 } else {
0 commit comments