1
Fork 0

Fix liveness analysis in the presence of never patterns

This commit is contained in:
Nadrieril 2024-02-20 02:55:40 +01:00
parent 7168c13579
commit 5e0e5b1efb
2 changed files with 11 additions and 4 deletions

View file

@ -526,8 +526,8 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
}
fn define_bindings_in_pat(&mut self, pat: &hir::Pat<'_>, mut succ: LiveNode) -> LiveNode {
// In an or-pattern, only consider the first pattern; any later patterns
// must have the same bindings, and we also consider the first pattern
// In an or-pattern, only consider the first non-never pattern; any later patterns
// must have the same bindings, and we also consider that pattern
// to be the "authoritative" set of ids.
pat.each_binding_or_first(&mut |_, hir_id, pat_sp, ident| {
let ln = self.live_node(hir_id, pat_sp);