Skip to content

Commit c564898

Browse files
committed
Remove a now-useless field
1 parent 3d4b9b8 commit c564898

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

compiler/rustc_typeck/src/check/_match.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_errors::{Applicability, DiagnosticBuilder};
44
use rustc_hir::{self as hir, ExprKind};
55
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
66
use rustc_infer::traits::Obligation;
7-
use rustc_middle::ty::{self, ToPredicate, Ty, TyS};
7+
use rustc_middle::ty::{self, ToPredicate, Ty, TyS, TypeFoldable};
88
use rustc_span::{MultiSpan, Span};
99
use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt;
1010
use rustc_trait_selection::traits::{
@@ -506,9 +506,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
506506
outer_ty: &'tcx TyS<'tcx>,
507507
orig_expected: Expectation<'tcx>,
508508
) -> Option<Span> {
509-
match (orig_expected, self.ret_coercion_impl_trait.map(|ty| (self.body_id.owner, ty))) {
510-
(Expectation::ExpectHasType(expected), Some(_))
511-
if self.in_tail_expr && self.can_coerce(outer_ty, expected) =>
509+
match orig_expected {
510+
Expectation::ExpectHasType(expected)
511+
if self.in_tail_expr
512+
&& self.ret_coercion.as_ref()?.borrow().merged_ty().has_opaque_types()
513+
&& self.can_coerce(outer_ty, expected) =>
512514
{
513515
let obligations = self.fulfillment_cx.borrow().pending_obligations();
514516
let mut suggest_box = !obligations.is_empty();

compiler/rustc_typeck/src/check/check.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,6 @@ pub(super) fn check_fn<'a, 'tcx>(
9595

9696
fcx.ret_coercion = Some(RefCell::new(CoerceMany::new(declared_ret_ty)));
9797
fcx.ret_type_span = Some(decl.output.span());
98-
if let ty::Opaque(..) = declared_ret_ty.kind() {
99-
// FIXME(oli-obk): remove this and have diagnostics check the signature's return type directly
100-
// as we don't reveal here anymore.
101-
fcx.ret_coercion_impl_trait = Some(declared_ret_ty);
102-
}
10398

10499
let span = body.value.span;
105100

compiler/rustc_typeck/src/check/fn_ctxt/mod.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ pub struct FnCtxt<'a, 'tcx> {
5757
/// any).
5858
pub(super) ret_coercion: Option<RefCell<DynamicCoerceMany<'tcx>>>,
5959

60-
pub(super) ret_coercion_impl_trait: Option<Ty<'tcx>>,
61-
6260
pub(super) ret_type_span: Option<Span>,
6361

6462
/// Used exclusively to reduce cost of advanced evaluation used for
@@ -130,7 +128,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
130128
param_env,
131129
err_count_on_creation: inh.tcx.sess.err_count(),
132130
ret_coercion: None,
133-
ret_coercion_impl_trait: None,
134131
ret_type_span: None,
135132
in_tail_expr: false,
136133
ret_coercion_span: Cell::new(None),

0 commit comments

Comments
 (0)