@@ -314,7 +314,7 @@ impl<'a, 'gcx, 'tcx> Expectation<'tcx> {
314
314
315
315
/// Like `only_has_type`, but instead of returning `None` if no
316
316
/// hard constraint exists, creates a fresh type variable.
317
- fn only_has_type_or_fresh_var ( self , fcx : & FnCtxt < ' a , ' gcx , ' tcx > , span : Span ) -> Ty < ' tcx > {
317
+ fn coercion_target_type ( self , fcx : & FnCtxt < ' a , ' gcx , ' tcx > , span : Span ) -> Ty < ' tcx > {
318
318
self . only_has_type ( fcx)
319
319
. unwrap_or_else ( || fcx. next_ty_var ( TypeVariableOrigin :: MiscVariable ( span) ) )
320
320
}
@@ -2862,7 +2862,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
2862
2862
// `expected` if it represents a *hard* constraint
2863
2863
// (`only_has_type`); otherwise, we just go with a
2864
2864
// fresh type variable.
2865
- let coerce_to_ty = expected. only_has_type_or_fresh_var ( self , sp) ;
2865
+ let coerce_to_ty = expected. coercion_target_type ( self , sp) ;
2866
2866
let mut coerce: DynamicCoerceMany = CoerceMany :: new ( coerce_to_ty) ;
2867
2867
2868
2868
let if_cause = self . cause ( sp, ObligationCauseCode :: IfExpression ) ;
@@ -3683,7 +3683,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
3683
3683
let coerce = match source {
3684
3684
// you can only use break with a value from a normal `loop { }`
3685
3685
hir:: LoopSource :: Loop => {
3686
- let coerce_to = expected. only_has_type_or_fresh_var ( self , body. span ) ;
3686
+ let coerce_to = expected. coercion_target_type ( self , body. span ) ;
3687
3687
Some ( CoerceMany :: new ( coerce_to) )
3688
3688
}
3689
3689
0 commit comments