about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-03-07 11:35:58 +0100
committerGitHub <noreply@github.com>2022-03-07 11:35:58 +0100
commitc0c452ba9bd66eac4e6bee9508bbf5be273f5b13 (patch)
tree9d75ddcac7d9dff0929fb5db1cef5dea648f6531 /compiler
parenta795f0f5367d35c7c5e8f03228037ae0aa0fee6a (diff)
parent5ddaa2d5e53344ff8b88d98e61e3dd36edb803e9 (diff)
Rollup merge of #94688 - compiler-errors:free-regions-in-copy-predicate-check, r=oli-obk
Erase regions when checking for missing Copy predicates

Fixes #94662
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
index 684a3ced5a0..2a74e1ce8b1 100644
--- a/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
+++ b/compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
@@ -448,8 +448,16 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                                 self.mir_hir_id(),
                                 rustc_infer::traits::ObligationCauseCode::MiscObligation,
                             );
-                            fulfill_cx.register_bound(&infcx, self.param_env, ty, copy_did, cause);
-                            let errors = fulfill_cx.select_where_possible(&infcx);
+                            fulfill_cx.register_bound(
+                                &infcx,
+                                self.param_env,
+                                // Erase any region vids from the type, which may not be resolved
+                                infcx.tcx.erase_regions(ty),
+                                copy_did,
+                                cause,
+                            );
+                            // Select all, including ambiguous predicates
+                            let errors = fulfill_cx.select_all_or_error(&infcx);
 
                             // Only emit suggestion if all required predicates are on generic
                             errors