diff options
| author | leonardo.yvens <leoyvens@gmail.com> | 2018-01-27 18:17:44 -0200 |
|---|---|---|
| committer | leonardo.yvens <leoyvens@gmail.com> | 2018-01-27 18:17:44 -0200 |
| commit | b813718f6dff49b851fcd18a5674640554bda2e5 (patch) | |
| tree | 0b585f7ff06cb5ecb9c4b44f82567cbb8c45c8df | |
| parent | f8c140465f20217913f14b7423f7110d0cc7b57c (diff) | |
| download | rust-b813718f6dff49b851fcd18a5674640554bda2e5.tar.gz rust-b813718f6dff49b851fcd18a5674640554bda2e5.zip | |
Refactor away `fn must_be_known_in_context`
| -rw-r--r-- | src/librustc_typeck/check/mod.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index b1645ed9228..0395b3eb4aa 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -4940,18 +4940,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { if !ty.is_ty_var() { ty } else { - self.must_be_known_in_context(sp, ty) - } - } - - fn must_be_known_in_context(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx> { - if !self.is_tainted_by_errors() { - type_error_struct!(self.tcx.sess, sp, ty, E0619, - "the type of this value must be known in this context") - .emit(); + if !self.is_tainted_by_errors() { + type_error_struct!(self.tcx.sess, sp, ty, E0619, + "the type of this value must be known in this context") + .emit(); + } + self.demand_suptype(sp, self.tcx.types.err, ty); + self.tcx.types.err } - self.demand_suptype(sp, self.tcx.types.err, ty); - self.tcx.types.err } fn with_breakable_ctxt<F: FnOnce() -> R, R>(&self, id: ast::NodeId, |
