]> git.lizzy.rs Git - rust.git/commitdiff
MatchExpressionArmPattern -> Pattern
authorMazdak Farrokhzad <twingoow@gmail.com>
Mon, 30 Dec 2019 06:42:46 +0000 (07:42 +0100)
committerMazdak Farrokhzad <twingoow@gmail.com>
Mon, 30 Dec 2019 12:50:20 +0000 (13:50 +0100)
Current name is too specific for incoming changes.

src/librustc/infer/error_reporting/mod.rs
src/librustc/traits/error_reporting.rs
src/librustc/traits/mod.rs
src/librustc/traits/structural_impls.rs
src/librustc_typeck/check/demand.rs

index f0f0e2cdeb9c159b5ca22ccd1367a4f89feecc44..ae629adf8fb5384451ab6e1fa8f230cbe1b5dcf5 100644 (file)
@@ -581,7 +581,7 @@ fn note_error_origin(
         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));
index 878675f981259069f6694dfcc91dc87475310e28..5819e7aa5c25dc8391c59d4aca708632ba8ce89c 100644 (file)
@@ -2580,7 +2580,7 @@ fn note_obligation_cause_code<T>(
         match *cause_code {
             ObligationCauseCode::ExprAssignable
             | ObligationCauseCode::MatchExpressionArm { .. }
-            | ObligationCauseCode::MatchExpressionArmPattern { .. }
+            | ObligationCauseCode::Pattern { .. }
             | ObligationCauseCode::IfExpression { .. }
             | ObligationCauseCode::IfExpressionWithNoElse
             | ObligationCauseCode::MainFunctionType
index e6ecf1b676e85f8aba2febb9460e5bca16e2925f..6142dc25f22282ae2c73f7b0adab1e11533ec03e 100644 (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>,
     },
index ed0842d80988f1d2170a73db7ecea1988f227052..cfc27438b50fd82e5d9906181a25dcbfdba67704 100644 (file)
@@ -521,9 +521,7 @@ fn lift_to_tcx(&self, tcx: TyCtxt<'tcx>) -> Option<Self::Lifted> {
                     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 }))
             }
index 68f2943e9e1d25c1fd0b0562147434a6d7c5da29..c11bd6704e4c32b4f97f480fb80259154f60e267 100644 (file)
@@ -87,10 +87,7 @@ pub fn demand_eqtype_pat_diag(
         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)
         };