about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-06-10 23:17:02 +0000
committerMichael Goulet <michael@errs.io>2023-06-10 23:21:38 +0000
commite49b4625df65bdbbd36de83a3f209a8031d65fec (patch)
treef700c78f5a6154d1e5585ec58c36aa9b8f70d573
parent397641f3bd4f4211d0a1e9ada8d477bf495735b2 (diff)
downloadrust-e49b4625df65bdbbd36de83a3f209a8031d65fec.tar.gz
rust-e49b4625df65bdbbd36de83a3f209a8031d65fec.zip
Don't compute opt_suggest_box_span for TAIT
-rw-r--r--compiler/rustc_hir_typeck/src/_match.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_hir_typeck/src/_match.rs b/compiler/rustc_hir_typeck/src/_match.rs
index 7d2f7e87608..444ff90595c 100644
--- a/compiler/rustc_hir_typeck/src/_match.rs
+++ b/compiler/rustc_hir_typeck/src/_match.rs
@@ -510,6 +510,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
                     ..
                 } = self.type_var_origin(expected)? else { return None; };
 
+                let Some(rpit_local_def_id) = rpit_def_id.as_local() else { return None; };
+                if !matches!(
+                    self.tcx.hir().expect_item(rpit_local_def_id).expect_opaque_ty().origin,
+                    hir::OpaqueTyOrigin::FnReturn(..)
+                ) {
+                    return None;
+                }
+
                 let sig = self.body_fn_sig()?;
 
                 let substs = sig.output().walk().find_map(|arg| {