about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-06-16 01:16:40 +0000
committerMichael Goulet <michael@errs.io>2023-06-17 03:32:46 +0000
commit2835d9d1d3ab3f09f0117cad8f0a6e0abe142282 (patch)
tree2f8f302a9f4657a5a5b70ecfbc53139f425cc3e1 /compiler/rustc_const_eval/src
parent1311bb56f3946fcdcf8dd54fecf245ef408e6d04 (diff)
downloadrust-2835d9d1d3ab3f09f0117cad8f0a6e0abe142282.tar.gz
rust-2835d9d1d3ab3f09f0117cad8f0a6e0abe142282.zip
Simplify even more candidates
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs9
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
index 57d939747aa..d4cde7e2c65 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -781,8 +781,13 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
                             );
                             return;
                         }
-                        Ok(Some(ImplSource::Closure(data))) => {
-                            if !tcx.is_const_fn_raw(data.closure_def_id) {
+                        Ok(Some(ImplSource::Closure(_))) => {
+                            let ty::Closure(closure_def_id, substs) =
+                                *poly_trait_pred.self_ty().no_bound_vars().unwrap().kind()
+                            else {
+                                unreachable!()
+                            };
+                            if !tcx.is_const_fn_raw(closure_def_id) {
                                 self.check_op(ops::FnCallNonConst {
                                     caller,
                                     callee,