Skip to content

Commit cca4b12

Browse files
author
Markus Westerlind
committed
a
1 parent a5c4370 commit cca4b12

File tree

3 files changed

+14
-21
lines changed

3 files changed

+14
-21
lines changed

compiler/rustc_trait_selection/src/traits/fulfill.rs

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -218,22 +218,16 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
218218
&mut self,
219219
infcx: &InferCtxt<'_, 'tcx>,
220220
) -> Result<(), Vec<FulfillmentError<'tcx>>> {
221-
let result = (|| {
222-
self.select_where_possible(infcx)?;
223-
224-
let errors: Vec<_> = self
225-
.predicates
226-
.to_errors(CodeAmbiguity)
227-
.into_iter()
228-
.map(to_fulfillment_error)
229-
.collect();
230-
231-
if errors.is_empty() { Ok(()) } else { Err(errors) }
232-
})();
233-
if let Some(offset) = self.predicates.take_watcher_offset() {
234-
infcx.deregister_unify_watcher(offset);
235-
}
236-
result
221+
self.select_where_possible(infcx)?;
222+
223+
let errors: Vec<_> = self
224+
.predicates
225+
.to_errors(CodeAmbiguity)
226+
.into_iter()
227+
.map(to_fulfillment_error)
228+
.collect();
229+
230+
if errors.is_empty() { Ok(()) } else { Err(errors) }
237231
}
238232

239233
fn select_where_possible(
@@ -543,9 +537,7 @@ impl<'a, 'b, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'b, 'tcx> {
543537
stalled_on.extend(
544538
substs
545539
.types()
546-
.filter_map(|arg| {
547-
TyOrConstInferVar::maybe_from_generic_arg(arg)
548-
})
540+
.filter_map(|ty| TyOrConstInferVar::maybe_from_ty(ty))
549541
.map(|ty| infcx.root_ty_or_const(ty)),
550542
);
551543
Err(ErrorHandled::TooGeneric)

compiler/rustc_typeck/src/check/check.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use rustc_hir::lang_items::LangItem;
1111
use rustc_hir::{ItemKind, Node};
1212
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
1313
use rustc_infer::infer::{RegionVariableOrigin, TyCtxtInferExt};
14+
use rustc_infer::traits::TraitEngine;
1415
use rustc_middle::ty::fold::TypeFoldable;
1516
use rustc_middle::ty::subst::GenericArgKind;
1617
use rustc_middle::ty::util::{Discr, IntTypeExt, Representability};
@@ -616,7 +617,7 @@ fn check_opaque_meets_bounds<'tcx>(
616617

617618
// Check that all obligations are satisfied by the implementation's
618619
// version.
619-
if let Err(ref errors) = inh.fulfillment_cx.borrow_mut().select_all_or_error(&infcx) {
620+
if let Err(ref errors) = inh.fulfillment_cx.borrow_mut().select_or_error(&infcx) {
620621
infcx.report_fulfillment_errors(errors, None, false);
621622
}
622623

compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
702702
fallback_has_occurred: bool,
703703
mutate_fullfillment_errors: impl Fn(&mut Vec<traits::FulfillmentError<'tcx>>),
704704
) {
705-
let result = self.fulfillment_cx.borrow_mut().select_all_where_possible(self);
705+
let result = self.fulfillment_cx.borrow_mut().select_where_possible(self);
706706
if let Err(mut errors) = result {
707707
mutate_fullfillment_errors(&mut errors);
708708
self.report_fulfillment_errors(&errors, self.inh.body_id, fallback_has_occurred);

0 commit comments

Comments
 (0)