Add never_patterns feature gate
This commit is contained in:
parent
bf86fe130c
commit
02e50f03bf
6 changed files with 8 additions and 2 deletions
|
|
@ -1017,6 +1017,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
|
|||
}
|
||||
e.hash(&mut self.s);
|
||||
},
|
||||
PatKind::Never => {},
|
||||
PatKind::Wild => {},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1707,6 +1707,7 @@ pub fn is_refutable(cx: &LateContext<'_>, pat: &Pat<'_>) -> bool {
|
|||
|
||||
match pat.kind {
|
||||
PatKind::Wild => false,
|
||||
PatKind::Never => false, // If `!` typechecked then the type is empty, so not refutable.
|
||||
PatKind::Binding(_, _, _, pat) => pat.map_or(false, |pat| is_refutable(cx, pat)),
|
||||
PatKind::Box(pat) | PatKind::Ref(pat, _) => is_refutable(cx, pat),
|
||||
PatKind::Lit(..) | PatKind::Range(..) => true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue