MatchExpressionArmPattern -> Pattern

Current name is too specific for incoming changes.
This commit is contained in:
Mazdak Farrokhzad 2019-12-30 07:42:46 +01:00
parent 960acb044b
commit e952377ddc
5 changed files with 6 additions and 11 deletions

View file

@ -581,7 +581,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
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));

View file

@ -2580,7 +2580,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
match *cause_code {
ObligationCauseCode::ExprAssignable
| ObligationCauseCode::MatchExpressionArm { .. }
| ObligationCauseCode::MatchExpressionArmPattern { .. }
| ObligationCauseCode::Pattern { .. }
| ObligationCauseCode::IfExpression { .. }
| ObligationCauseCode::IfExpressionWithNoElse
| ObligationCauseCode::MainFunctionType

View file

@ -249,8 +249,8 @@ pub enum ObligationCauseCode<'tcx> {
/// 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>,
},

View file

@ -521,9 +521,7 @@ impl<'a, 'tcx> Lift<'tcx> for traits::ObligationCauseCode<'a> {
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 }))
}

View file

@ -87,10 +87,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
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)
};