From b884205cf451463c9b0bda6e694831c1494e28d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Thu, 14 Nov 2019 11:34:46 -0800 Subject: [PATCH] review comments --- src/librustc_typeck/check/mod.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index be56157287c..25cd6a74b6e 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -705,14 +705,9 @@ fn register_predicate(&self, obligation: traits::PredicateObligation<'tcx>) { span_bug!(obligation.cause.span, "escaping bound vars in predicate {:?}", obligation); } - let _ = self.fulfillment_cx - .try_borrow_mut() - .map_err(|e| self.tcx.sess.delay_span_bug(obligation.cause.span, &format!( - "fullfillment context already borrowed: {:?} - {:?}", - e, - obligation, - ))) - .map(|mut cx| cx.register_predicate_obligation(self, obligation)); + self.fulfillment_cx + .borrow_mut() + .register_predicate_obligation(self, obligation); } fn register_predicates(&self, obligations: I) @@ -3111,7 +3106,8 @@ fn select_obligations_where_possible( fallback_has_occurred: bool, mutate_fullfillment_errors: impl Fn(&mut Vec>), ) { - if let Err(mut errors) = self.fulfillment_cx.borrow_mut().select_where_possible(self) { + let result = self.fulfillment_cx.borrow_mut().select_where_possible(self); + if let Err(mut errors) = result { mutate_fullfillment_errors(&mut errors); self.report_fulfillment_errors(&errors, self.inh.body_id, fallback_has_occurred); }