From e952377ddc7bdddfee03ee09f3530a1c025f1d99 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Mon, 30 Dec 2019 07:42:46 +0100 Subject: [PATCH] MatchExpressionArmPattern -> Pattern Current name is too specific for incoming changes. --- src/librustc/infer/error_reporting/mod.rs | 2 +- src/librustc/traits/error_reporting.rs | 2 +- src/librustc/traits/mod.rs | 4 ++-- src/librustc/traits/structural_impls.rs | 4 +--- src/librustc_typeck/check/demand.rs | 5 +---- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/librustc/infer/error_reporting/mod.rs b/src/librustc/infer/error_reporting/mod.rs index f0f0e2cdeb9..ae629adf8fb 100644 --- a/src/librustc/infer/error_reporting/mod.rs +++ b/src/librustc/infer/error_reporting/mod.rs @@ -581,7 +581,7 @@ fn note_error_origin( exp_found: Option>>, ) { 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)); diff --git a/src/librustc/traits/error_reporting.rs b/src/librustc/traits/error_reporting.rs index 878675f9812..5819e7aa5c2 100644 --- a/src/librustc/traits/error_reporting.rs +++ b/src/librustc/traits/error_reporting.rs @@ -2580,7 +2580,7 @@ fn note_obligation_cause_code( match *cause_code { ObligationCauseCode::ExprAssignable | ObligationCauseCode::MatchExpressionArm { .. } - | ObligationCauseCode::MatchExpressionArmPattern { .. } + | ObligationCauseCode::Pattern { .. } | ObligationCauseCode::IfExpression { .. } | ObligationCauseCode::IfExpressionWithNoElse | ObligationCauseCode::MainFunctionType diff --git a/src/librustc/traits/mod.rs b/src/librustc/traits/mod.rs index e6ecf1b676e..6142dc25f22 100644 --- a/src/librustc/traits/mod.rs +++ b/src/librustc/traits/mod.rs @@ -249,8 +249,8 @@ pub enum ObligationCauseCode<'tcx> { /// Computing common supertype in the arms of a match expression MatchExpressionArm(Box>), - /// 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>, }, diff --git a/src/librustc/traits/structural_impls.rs b/src/librustc/traits/structural_impls.rs index ed0842d8098..cfc27438b50 100644 --- a/src/librustc/traits/structural_impls.rs +++ b/src/librustc/traits/structural_impls.rs @@ -521,9 +521,7 @@ fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option { 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 })) } diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs index 68f2943e9e1..c11bd6704e4 100644 --- a/src/librustc_typeck/check/demand.rs +++ b/src/librustc_typeck/check/demand.rs @@ -87,10 +87,7 @@ pub fn demand_eqtype_pat_diag( match_expr_span: Option, ) -> Option> { 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) }; -- 2.44.0