about summary refs log tree commit diff
path: root/compiler/rustc_const_eval
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2023-06-16 02:10:10 +0000
committerMichael Goulet <michael@errs.io>2023-06-17 03:32:46 +0000
commitd97d4ebecc502bcb5eda2cdaa513e0e7922a377e (patch)
treed30e65674b87510c2b93cf2860102d54738b5d6d /compiler/rustc_const_eval
parent2835d9d1d3ab3f09f0117cad8f0a6e0abe142282 (diff)
downloadrust-d97d4ebecc502bcb5eda2cdaa513e0e7922a377e.tar.gz
rust-d97d4ebecc502bcb5eda2cdaa513e0e7922a377e.zip
Remove even more redundant builtin candidates
Diffstat (limited to 'compiler/rustc_const_eval')
-rw-r--r--compiler/rustc_const_eval/src/transform/check_consts/check.rs6
1 files changed, 5 insertions, 1 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 d4cde7e2c65..106cf111474 100644
--- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs
@@ -781,7 +781,11 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
                             );
                             return;
                         }
-                        Ok(Some(ImplSource::Closure(_))) => {
+                        // Closure: Fn{Once|Mut}
+                        Ok(Some(ImplSource::Builtin(_)))
+                            if poly_trait_pred.self_ty().skip_binder().is_closure()
+                                && tcx.fn_trait_kind_from_def_id(trait_id).is_some() =>
+                        {
                             let ty::Closure(closure_def_id, substs) =
                                 *poly_trait_pred.self_ty().no_bound_vars().unwrap().kind()
                             else {