about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAli MJ Al-Nasrawy <alimjalnasrawy@gmail.com>2023-11-09 10:12:56 +0000
committerlcnr <rust@lcnr.de>2024-01-16 09:25:28 +0100
commit66090ef7ba5f8586879f8029400a1cc851e7c57f (patch)
tree4d92a3fbf6076d5bf9fc29b588d61d630e11b46d
parentaac2f84794d3122216e07a5a6b00b6facf5e9f16 (diff)
downloadrust-66090ef7ba5f8586879f8029400a1cc851e7c57f.tar.gz
rust-66090ef7ba5f8586879f8029400a1cc851e7c57f.zip
try fast path for wf type ops
-rw-r--r--compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs b/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs
index e21ede47f6d..14f14ae6e2e 100644
--- a/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs
+++ b/compiler/rustc_trait_selection/src/traits/query/type_op/prove_predicate.rs
@@ -30,6 +30,23 @@ impl<'tcx> super::QueryTypeOp<'tcx> for ProvePredicate<'tcx> {
             }
         }
 
+        if let ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) =
+            key.value.predicate.kind().skip_binder()
+        {
+            match arg.as_type()?.kind() {
+                ty::Param(_)
+                | ty::Bool
+                | ty::Char
+                | ty::Int(_)
+                | ty::Float(_)
+                | ty::Str
+                | ty::Uint(_) => {
+                    return Some(());
+                }
+                _ => {}
+            }
+        }
+
         None
     }