Current name is too specific for incoming changes.
exp_found: Option<ty::error::ExpectedFound<Ty<'tcx>>>,
) {
match cause.code {
- ObligationCauseCode::MatchExpressionArmPattern { span, ty } => {
+ ObligationCauseCode::Pattern { span, ty } => {
if ty.is_suggestable() {
// don't show type `_`
err.span_label(span, format!("this expression has type `{}`", ty));
match *cause_code {
ObligationCauseCode::ExprAssignable
| ObligationCauseCode::MatchExpressionArm { .. }
- | ObligationCauseCode::MatchExpressionArmPattern { .. }
+ | ObligationCauseCode::Pattern { .. }
| ObligationCauseCode::IfExpression { .. }
| ObligationCauseCode::IfExpressionWithNoElse
| ObligationCauseCode::MainFunctionType
/// Computing common supertype in the arms of a match expression
MatchExpressionArm(Box<MatchExpressionArmCause<'tcx>>),
- /// Computing common supertype in the pattern guard for the arms of a match expression
- MatchExpressionArmPattern {
+ /// Type error arising from type checking a pattern against an expected type.
+ Pattern {
span: Span,
ty: Ty<'tcx>,
},
discrim_hir_id,
})
}),
- super::MatchExpressionArmPattern { span, ty } => {
- tcx.lift(&ty).map(|ty| super::MatchExpressionArmPattern { span, ty })
- }
+ super::Pattern { span, ty } => tcx.lift(&ty).map(|ty| super::Pattern { span, ty }),
super::IfExpression(box super::IfExpressionCause { then, outer, semicolon }) => {
Some(super::IfExpression(box super::IfExpressionCause { then, outer, semicolon }))
}
match_expr_span: Option<Span>,
) -> Option<DiagnosticBuilder<'tcx>> {
let cause = if let Some(span) = match_expr_span {
- self.cause(
- cause_span,
- ObligationCauseCode::MatchExpressionArmPattern { span, ty: expected },
- )
+ self.cause(cause_span, ObligationCauseCode::Pattern { span, ty: expected })
} else {
self.misc(cause_span)
};