about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-31 00:59:04 +0000
committerbors <bors@rust-lang.org>2023-03-31 00:59:04 +0000
commit276029deae08ad5b62f7d1ef2ea1acb7f5f529d8 (patch)
treeb3c7e8355da075912340b427d186b4bdc7273ad9
parentc1d3610ac1ddd1cd605479274047fd0a3f37d220 (diff)
parent1d7192d6ea5a5fdbd90788f41d0e948a4dedeefa (diff)
Auto merge of #109750 - compiler-errors:deep-reject-less-permissive-num-var, r=lcnr
numeric vars can only be unified with numerical types in deep reject

Don't consider numeric vars (int and float vars) to unify with non-numeric types during deep reject. This helps us reject incompatible impls sooner.
-rw-r--r--compiler/rustc_middle/src/ty/fast_reject.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/fast_reject.rs b/compiler/rustc_middle/src/ty/fast_reject.rs
index 61cde923e9a..31d00b65e98 100644
--- a/compiler/rustc_middle/src/ty/fast_reject.rs
+++ b/compiler/rustc_middle/src/ty/fast_reject.rs
@@ -322,6 +322,10 @@ impl DeepRejectCtxt {
                 TreatParams::AsCandidateKey => true,
             },
 
+            ty::Infer(ty::IntVar(_)) => impl_ty.is_integral(),
+
+            ty::Infer(ty::FloatVar(_)) => impl_ty.is_floating_point(),
+
             ty::Infer(_) => true,
 
             // As we're walking the whole type, it may encounter projections