Fix missing match arm false error on unknown type
This commit is contained in:
parent
2eaf79cfbb
commit
c822bb68ce
@ -223,10 +223,10 @@ impl<'a, 'b> ExprValidator<'a, 'b> {
|
||||
db.body_with_source_map(self.owner.into());
|
||||
|
||||
let match_expr_ty = match infer.type_of_expr.get(match_expr) {
|
||||
Some(ty) => ty,
|
||||
// If we can't resolve the type of the match expression
|
||||
// we cannot perform exhaustiveness checks.
|
||||
None => return,
|
||||
None | Some(Ty::Unknown) => return,
|
||||
Some(ty) => ty,
|
||||
};
|
||||
|
||||
let cx = MatchCheckCtx { match_expr, body, infer: infer.clone(), db };
|
||||
|
@ -1342,12 +1342,10 @@ fn panic(a: Category, b: Category) {
|
||||
enum Option<T> { Some(T), None }
|
||||
|
||||
fn main() {
|
||||
// FIXME: This is a false positive, as the `Never` type is not known here.
|
||||
// `Never` is deliberately not defined so that it's an uninferred type.
|
||||
match Option::<Never>::None {
|
||||
None => (),
|
||||
Some(never) => match never {},
|
||||
// ^^^^^ Missing match arm
|
||||
}
|
||||
}
|
||||
"#,
|
||||
|
Loading…
x
Reference in New Issue
Block a user