Fix match_same_arms FP with associated consts#16701
Fix match_same_arms FP with associated consts#16701samueltardieu merged 1 commit intorust-lang:masterfrom
match_same_arms FP with associated consts#16701Conversation
|
rustbot has assigned @samueltardieu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
You are right. I think the proper fix might be changing const-eval equivalence of two |
Can't you just check that the constant belongs to an inherent impl and not a trait? Wouldn't this work? && let Some((DefKind::AssocConst { .. }, did)) = self.typeck.type_dependent_def(id)
&& self.tcx.inherent_impl_of_assoc(did).is_some() => |
|
That is correct. The only thing you need to do is make sure the constant is from an inherent impl and not a trait impl. |
|
Indeed. Thanks for both of you :) |
|
Though what I'm considering is that is it really proper for match true {
false => 1 + 1,
true => 0 + 2,
}; |
Closes #16698
changelog: [
match_same_arms] fix FP with associated consts