@@ -2440,23 +2440,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2440
2440
self . cause ( span, ObligationCauseCode :: MiscObligation )
2441
2441
}
2442
2442
2443
- /// Resolves type variables in `ty` if possible. Unlike the infcx
2443
+ /// Resolves type and const variables in `ty` if possible. Unlike the infcx
2444
2444
/// version (resolve_vars_if_possible), this version will
2445
2445
/// also select obligations if it seems useful, in an effort
2446
2446
/// 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) ;
2449
2449
2450
2450
// 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) ;
2453
2453
return ty;
2454
2454
}
2455
2455
2456
2456
// If `ty` is a type variable, see whether we already know what it is.
2457
2457
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) ;
2460
2460
return ty;
2461
2461
}
2462
2462
@@ -2467,7 +2467,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
2467
2467
self . select_obligations_where_possible ( false , |_| { } ) ;
2468
2468
ty = self . resolve_vars_if_possible ( & ty) ;
2469
2469
2470
- debug ! ( "resolve_type_vars_with_obligations : ty={:?}" , ty) ;
2470
+ debug ! ( "resolve_vars_with_obligations : ty={:?}" , ty) ;
2471
2471
ty
2472
2472
}
2473
2473
@@ -3668,7 +3668,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3668
3668
formal_ret : Ty < ' tcx > ,
3669
3669
formal_args : & [ Ty < ' tcx > ] )
3670
3670
-> 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) ;
3672
3672
let ret_ty = match expected_ret. only_has_type ( self ) {
3673
3673
Some ( ret) => ret,
3674
3674
None => return Vec :: new ( )
@@ -4517,7 +4517,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
4517
4517
err. span_suggestion (
4518
4518
span,
4519
4519
"try adding a return type" ,
4520
- format ! ( "-> {} " , self . resolve_type_vars_with_obligations ( found) ) ,
4520
+ format ! ( "-> {} " , self . resolve_vars_with_obligations ( found) ) ,
4521
4521
Applicability :: MachineApplicable ) ;
4522
4522
true
4523
4523
}
@@ -4993,7 +4993,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
4993
4993
// If no resolution is possible, then an error is reported.
4994
4994
// Numeric inference variables may be left unresolved.
4995
4995
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) ;
4997
4997
if !ty. is_ty_var ( ) {
4998
4998
ty
4999
4999
} else {
0 commit comments