about summary refs log tree commit diff
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2021-02-11 13:37:00 +0300
committerÖmer Sinan Ağacan <omeragacan@gmail.com>2021-02-18 16:43:43 +0300
commitad47fb1ca9d1eb66752611ae9f4d2c183daa9145 (patch)
treef6cbeb8ee5194728e5efb2b5eaa7866067196063
parent5fd1ebe50f5bea799efd4ab70a816a731df34319 (diff)
Check opaque type def ids before bailing out
-rw-r--r--compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
index 67068322733..37e9e6b4d3d 100644
--- a/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
+++ b/compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
@@ -1073,6 +1073,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
         };
         let last_expr_ty = self.node_ty(last_expr.hir_id);
         let needs_box = match (last_expr_ty.kind(), expected_ty.kind()) {
+            (ty::Opaque(last_def_id, _), ty::Opaque(exp_def_id, _))
+                if last_def_id == exp_def_id =>
+            {
+                StatementAsExpression::CorrectType
+            }
             (ty::Opaque(last_def_id, last_bounds), ty::Opaque(exp_def_id, exp_bounds)) => {
                 debug!(
                     "both opaque, likely future {:?} {:?} {:?} {:?}",