Remove some unused arguments and update a comment

This commit is contained in:
Oli Scherer 2022-01-27 15:33:15 +00:00
parent dc36b38526
commit 3d4b9b8b8b
3 changed files with 7 additions and 8 deletions

View File

@ -61,8 +61,10 @@ bitflags! {
| TypeFlags::HAS_CT_INFER.bits
| TypeFlags::HAS_TY_PLACEHOLDER.bits
| TypeFlags::HAS_CT_PLACEHOLDER.bits
// Opaque types may get resolved in the current scope and must
// thus not be transported to other queries if it can be avoided.
// The `evaluate_obligation` query does not return further
// obligations. If it evaluates an obligation with an opaque
// type, that opaque type may get compared to another type,
// constraining it. We would lose this information.
// FIXME: differentiate between crate-local opaque types
// and opaque types from other crates, as only opaque types
// from the local crate can possibly be a local name

View File

@ -98,8 +98,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let arm_ty = self.check_expr_with_expectation(&arm.body, expected);
all_arms_diverge &= self.diverges.get();
let opt_suggest_box_span =
self.opt_suggest_box_span(arm.body.span, arm_ty, orig_expected);
let opt_suggest_box_span = self.opt_suggest_box_span(arm_ty, orig_expected);
let (arm_span, semi_span) =
self.get_appropriate_arm_semicolon_removal_span(&arms, i, prior_arm_ty, arm_ty);
@ -504,12 +503,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// provide a structured suggestion in that case.
pub(crate) fn opt_suggest_box_span(
&self,
_span: Span,
outer_ty: &'tcx TyS<'tcx>,
orig_expected: Expectation<'tcx>,
) -> Option<Span> {
match (orig_expected, self.ret_coercion_impl_trait.map(|ty| (self.body_id.owner, ty))) {
(Expectation::ExpectHasType(expected), Some((_id, _ty)))
(Expectation::ExpectHasType(expected), Some(_))
if self.in_tail_expr && self.can_coerce(outer_ty, expected) =>
{
let obligations = self.fulfillment_cx.borrow().pending_obligations();

View File

@ -948,8 +948,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
};
let else_diverges = self.diverges.get();
let opt_suggest_box_span =
self.opt_suggest_box_span(else_expr.span, else_ty, orig_expected);
let opt_suggest_box_span = self.opt_suggest_box_span(else_ty, orig_expected);
let if_cause =
self.if_cause(sp, then_expr, else_expr, then_ty, else_ty, opt_suggest_box_span);