Skip to content

Commit

Permalink
It is correct to lower ! to _.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nadrieril committed Jan 31, 2024
1 parent 5ad7454 commit ee2cddd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions compiler/rustc_pattern_analysis/src/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,8 +680,9 @@ impl<'p, 'tcx> RustcMatchCheckCtxt<'p, 'tcx> {
cx.pattern_arena.alloc_from_iter(pats.into_iter().map(|p| self.lower_pat(p)))
}
PatKind::Never => {
// FIXME(never_patterns): handle `!` in exhaustiveness. This is a sane default
// in the meantime.
// A never pattern matches all the values of its type (namely none). Moreover it
// must be compatible with other constructors, since we can use `!` on a type like
// `Result<!, !>` which has other constructors. Hence we lower it as a wildcard.
ctor = Wildcard;
fields = &[];
}
Expand Down

0 comments on commit ee2cddd

Please sign in to comment.