Skip to content

Commit

Permalink
Auto merge of rust-lang#109750 - compiler-errors:deep-reject-less-per…
Browse files Browse the repository at this point in the history
…missive-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.
  • Loading branch information
bors committed Mar 31, 2023
2 parents c1d3610 + 1d7192d commit 276029d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions compiler/rustc_middle/src/ty/fast_reject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 276029d

Please # to comment.