Refactor away fn must_be_known_in_context

This commit is contained in:
leonardo.yvens 2018-01-27 18:17:44 -02:00
parent f8c140465f
commit b813718f6d

View file

@ -4940,20 +4940,16 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
if !ty.is_ty_var() {
ty
} else {
self.must_be_known_in_context(sp, ty)
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
}
}
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();
}
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,
ctxt: BreakableCtxt<'gcx, 'tcx>, f: F)
-> (BreakableCtxt<'gcx, 'tcx>, R) {