let module = self.tcx.hir.get_module_parent(scrut.id);
if inlined_arms.is_empty() {
let scrutinee_is_uninhabited = if self.tcx.sess.features.borrow().never_type {
- pat_ty.is_uninhabited_from(module, self.tcx)
+ self.tcx.is_ty_uninhabited_from(module, pat_ty)
} else {
self.conservative_is_uninhabited(pat_ty)
};
"refutable pattern in {}: `{}` not covered",
origin, pattern_string
);
- diag.span_label(pat.span, format!("pattern `{}` not covered", pattern_string));
+ let label_msg = match pat.node {
+ PatKind::Path(hir::QPath::Resolved(None, ref path))
+ if path.segments.len() == 1 && path.segments[0].parameters.is_none() => {
+ format!("interpreted as a {} pattern, not new variable", path.def.kind_name())
+ }
+ _ => format!("pattern `{}` not covered", pattern_string),
+ };
+ diag.span_label(pat.span, label_msg);
diag.emit();
});
}
let mut checker = MutationChecker {
cx,
};
- ExprUseVisitor::new(&mut checker, cx.tcx, cx.param_env, cx.region_scope_tree, cx.tables)
+ ExprUseVisitor::new(&mut checker, cx.tcx, cx.param_env, cx.region_scope_tree, cx.tables, None)
.walk_expr(guard);
}