summaryrefslogtreecommitdiffstats
path: root/src/librustc_typeck/check/demand.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc_typeck/check/demand.rs')
-rw-r--r--src/librustc_typeck/check/demand.rs16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/librustc_typeck/check/demand.rs b/src/librustc_typeck/check/demand.rs
index 4331d44..32df6c4 100644
--- a/src/librustc_typeck/check/demand.rs
+++ b/src/librustc_typeck/check/demand.rs
@@ -65,13 +65,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
65 } 65 }
66 } 66 }
67 67
68 pub fn demand_eqtype_pat( 68 pub fn demand_eqtype_pat_diag(
69 &self, 69 &self,
70 cause_span: Span, 70 cause_span: Span,
71 expected: Ty<'tcx>, 71 expected: Ty<'tcx>,
72 actual: Ty<'tcx>, 72 actual: Ty<'tcx>,
73 match_expr_span: Option<Span>, 73 match_expr_span: Option<Span>,
74 ) { 74 ) -> Option<DiagnosticBuilder<'tcx>> {
75 let cause = if let Some(span) = match_expr_span { 75 let cause = if let Some(span) = match_expr_span {
76 self.cause( 76 self.cause(
77 cause_span, 77 cause_span,
@@ -80,9 +80,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
80 } else { 80 } else {
81 self.misc(cause_span) 81 self.misc(cause_span)
82 }; 82 };
83 self.demand_eqtype_with_origin(&cause, expected, actual).map(|mut err| err.emit()); 83 self.demand_eqtype_with_origin(&cause, expected, actual)
84 } 84 }
85 85
86 pub fn demand_eqtype_pat(
87 &self,
88 cause_span: Span,
89 expected: Ty<'tcx>,
90 actual: Ty<'tcx>,
91 match_expr_span: Option<Span>,
92 ) {
93 self.demand_eqtype_pat_diag(cause_span, expected, actual, match_expr_span)
94 .map(|mut err| err.emit());
95 }
86 96
87 pub fn demand_coerce(&self, 97 pub fn demand_coerce(&self,
88 expr: &hir::Expr, 98 expr: &hir::Expr,