Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions compiler/rustc_mir_build/src/thir/pattern/check_match.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::usefulness::Usefulness::*;
use super::usefulness::{
compute_match_usefulness, expand_pattern, MatchArm, MatchCheckCtxt, UsefulnessReport,
compute_match_usefulness, expand_pattern, MatchArm, MatchCheckCtxt, Reachability,
UsefulnessReport,
};
use super::{PatCtxt, PatKind, PatternError};

Expand Down Expand Up @@ -398,10 +398,11 @@ fn report_arm_reachability<'p, 'tcx>(
report: &UsefulnessReport<'p, 'tcx>,
source: hir::MatchSource,
) {
use Reachability::*;
let mut catchall = None;
for (arm_index, (arm, is_useful)) in report.arm_usefulness.iter().enumerate() {
match is_useful {
NotUseful => {
Unreachable => {
match source {
hir::MatchSource::WhileDesugar => bug!(),

Expand Down Expand Up @@ -430,17 +431,16 @@ fn report_arm_reachability<'p, 'tcx>(
hir::MatchSource::AwaitDesugar | hir::MatchSource::TryDesugar => {}
}
}
Useful(unreachables) if unreachables.is_empty() => {}
Reachable(unreachables) if unreachables.is_empty() => {}
// The arm is reachable, but contains unreachable subpatterns (from or-patterns).
Useful(unreachables) => {
let mut unreachables: Vec<_> = unreachables.iter().collect();
Reachable(unreachables) => {
let mut unreachables = unreachables.clone();
// Emit lints in the order in which they occur in the file.
unreachables.sort_unstable();
for span in unreachables {
unreachable_pattern(cx.tcx, span, arm.hir_id, None);
}
}
UsefulWithWitness(_) => bug!(),
}
if !arm.has_guard && catchall.is_none() && pat_is_catchall(arm.pat) {
catchall = Some(arm.pat.span);
Expand Down
2 changes: 0 additions & 2 deletions compiler/rustc_mir_build/src/thir/pattern/deconstruct_pat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -724,8 +724,6 @@ impl<'tcx> Constructor<'tcx> {
where
'tcx: 'a,
{
debug!("Constructor::split({:#?})", self);

match self {
Wildcard => {
let mut split_wildcard = SplitWildcard::new(pcx);
Expand Down
Loading