fmt
This commit is contained in:
parent
f1126f1272
commit
d863021521
8 changed files with 18 additions and 42 deletions
|
@ -188,7 +188,7 @@ impl<'tcx> AutoTraitFinder<'tcx> {
|
|||
let mut fulfill = FulfillmentContext::new();
|
||||
fulfill.register_bound(&infcx, full_env, ty, trait_did, ObligationCause::dummy());
|
||||
let errors = fulfill.select_all_or_error(&infcx);
|
||||
|
||||
|
||||
if !errors.is_empty() {
|
||||
panic!("Unable to fulfill trait {:?} for '{:?}': {:?}", trait_did, ty, errors);
|
||||
}
|
||||
|
|
|
@ -49,10 +49,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
|||
self.obligations.insert(obligation);
|
||||
}
|
||||
|
||||
fn select_all_or_error(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Vec<FulfillmentError<'tcx>> {
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
{
|
||||
let errors = self.select_where_possible(infcx);
|
||||
|
||||
|
@ -62,8 +59,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
|||
}
|
||||
|
||||
// any remaining obligations are errors
|
||||
self
|
||||
.obligations
|
||||
self.obligations
|
||||
.iter()
|
||||
.map(|obligation| FulfillmentError {
|
||||
obligation: obligation.clone(),
|
||||
|
|
|
@ -126,10 +126,7 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
|
|||
}
|
||||
|
||||
/// Attempts to select obligations using `selcx`.
|
||||
fn select(
|
||||
&mut self,
|
||||
selcx: &mut SelectionContext<'a, 'tcx>,
|
||||
) -> Vec<FulfillmentError<'tcx>> {
|
||||
fn select(&mut self, selcx: &mut SelectionContext<'a, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
let span = debug_span!("select", obligation_forest_size = ?self.predicates.len());
|
||||
let _enter = span.enter();
|
||||
|
||||
|
@ -223,10 +220,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
|||
.register_obligation(PendingPredicateObligation { obligation, stalled_on: vec![] });
|
||||
}
|
||||
|
||||
fn select_all_or_error(
|
||||
&mut self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Vec<FulfillmentError<'tcx>> {
|
||||
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||
{
|
||||
let errors = self.select_where_possible(infcx);
|
||||
if !errors.is_empty() {
|
||||
|
@ -234,12 +228,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
self
|
||||
.predicates
|
||||
.to_errors(CodeAmbiguity)
|
||||
.into_iter()
|
||||
.map(to_fulfillment_error)
|
||||
.collect()
|
||||
self.predicates.to_errors(CodeAmbiguity).into_iter().map(to_fulfillment_error).collect()
|
||||
}
|
||||
|
||||
fn select_all_with_constness_or_error(
|
||||
|
@ -254,12 +243,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
self
|
||||
.predicates
|
||||
.to_errors(CodeAmbiguity)
|
||||
.into_iter()
|
||||
.map(to_fulfillment_error)
|
||||
.collect()
|
||||
self.predicates.to_errors(CodeAmbiguity).into_iter().map(to_fulfillment_error).collect()
|
||||
}
|
||||
|
||||
fn select_where_possible(
|
||||
|
|
|
@ -78,7 +78,7 @@ fn scrape_region_constraints<'tcx, Op: super::TypeOp<'tcx, Output = R>, R>(
|
|||
debug_assert!(obligations.iter().all(|o| o.cause.body_id == dummy_body_id));
|
||||
fulfill_cx.register_predicate_obligations(infcx, obligations);
|
||||
let errors = fulfill_cx.select_all_or_error(infcx);
|
||||
if !errors.is_empty() {
|
||||
if !errors.is_empty() {
|
||||
infcx.tcx.sess.diagnostic().delay_span_bug(
|
||||
DUMMY_SP,
|
||||
&format!("errors selecting obligation during MIR typeck: {:?}", errors),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue