Skip to content

Commit

Permalink
Fix rebase and add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Sep 14, 2020
1 parent dc53cfe commit c6f2ddf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion compiler/rustc_typeck/src/check/_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_infer::traits::Obligation;
use rustc_middle::ty::{self, ToPredicate, Ty};
use rustc_span::Span;
use rustc_trait_selection::opaque_types::InferCtxtExt as _;
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _;
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
use rustc_trait_selection::traits::{
IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode,
};
Expand Down Expand Up @@ -153,12 +153,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
);
suggest_box &= self.infcx.predicate_must_hold_modulo_regions(&obl);
if !suggest_box {
// We've encountered some obligation that didn't hold, so the
// return expression can't just be boxed. We don't need to
// evaluate the rest of the obligations.
break;
}
}
_ => {}
}
}
// If all the obligations hold (or there are no obligations) the tail expression
// we can suggest to return a boxed trait object instead of an opaque type.
if suggest_box { self.ret_type_span.clone() } else { None }
}
_ => None,
Expand Down

0 comments on commit c6f2ddf

Please sign in to comment.