fmt
This commit is contained in:
parent
f1126f1272
commit
d863021521
8 changed files with 18 additions and 42 deletions
|
@ -46,10 +46,7 @@ pub trait TraitEngine<'tcx>: 'tcx {
|
||||||
obligation: PredicateObligation<'tcx>,
|
obligation: PredicateObligation<'tcx>,
|
||||||
);
|
);
|
||||||
|
|
||||||
fn select_all_or_error(
|
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>>;
|
||||||
&mut self,
|
|
||||||
infcx: &InferCtxt<'_, 'tcx>,
|
|
||||||
) -> Vec<FulfillmentError<'tcx>>;
|
|
||||||
|
|
||||||
fn select_all_with_constness_or_error(
|
fn select_all_with_constness_or_error(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -59,10 +56,8 @@ pub trait TraitEngine<'tcx>: 'tcx {
|
||||||
self.select_all_or_error(infcx)
|
self.select_all_or_error(infcx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_where_possible(
|
fn select_where_possible(&mut self, infcx: &InferCtxt<'_, 'tcx>)
|
||||||
&mut self,
|
-> Vec<FulfillmentError<'tcx>>;
|
||||||
infcx: &InferCtxt<'_, 'tcx>,
|
|
||||||
) -> Vec<FulfillmentError<'tcx>>;
|
|
||||||
|
|
||||||
// FIXME(fee1-dead) this should not provide a default body for chalk as chalk should be updated
|
// FIXME(fee1-dead) this should not provide a default body for chalk as chalk should be updated
|
||||||
fn select_with_constness_where_possible(
|
fn select_with_constness_where_possible(
|
||||||
|
|
|
@ -49,10 +49,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||||
self.obligations.insert(obligation);
|
self.obligations.insert(obligation);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_all_or_error(
|
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||||
&mut self,
|
|
||||||
infcx: &InferCtxt<'_, 'tcx>,
|
|
||||||
) -> Vec<FulfillmentError<'tcx>> {
|
|
||||||
{
|
{
|
||||||
let errors = self.select_where_possible(infcx);
|
let errors = self.select_where_possible(infcx);
|
||||||
|
|
||||||
|
@ -62,8 +59,7 @@ impl TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// any remaining obligations are errors
|
// any remaining obligations are errors
|
||||||
self
|
self.obligations
|
||||||
.obligations
|
|
||||||
.iter()
|
.iter()
|
||||||
.map(|obligation| FulfillmentError {
|
.map(|obligation| FulfillmentError {
|
||||||
obligation: obligation.clone(),
|
obligation: obligation.clone(),
|
||||||
|
|
|
@ -126,10 +126,7 @@ impl<'a, 'tcx> FulfillmentContext<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Attempts to select obligations using `selcx`.
|
/// Attempts to select obligations using `selcx`.
|
||||||
fn select(
|
fn select(&mut self, selcx: &mut SelectionContext<'a, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||||
&mut self,
|
|
||||||
selcx: &mut SelectionContext<'a, 'tcx>,
|
|
||||||
) -> Vec<FulfillmentError<'tcx>> {
|
|
||||||
let span = debug_span!("select", obligation_forest_size = ?self.predicates.len());
|
let span = debug_span!("select", obligation_forest_size = ?self.predicates.len());
|
||||||
let _enter = span.enter();
|
let _enter = span.enter();
|
||||||
|
|
||||||
|
@ -223,10 +220,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||||
.register_obligation(PendingPredicateObligation { obligation, stalled_on: vec![] });
|
.register_obligation(PendingPredicateObligation { obligation, stalled_on: vec![] });
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_all_or_error(
|
fn select_all_or_error(&mut self, infcx: &InferCtxt<'_, 'tcx>) -> Vec<FulfillmentError<'tcx>> {
|
||||||
&mut self,
|
|
||||||
infcx: &InferCtxt<'_, 'tcx>,
|
|
||||||
) -> Vec<FulfillmentError<'tcx>> {
|
|
||||||
{
|
{
|
||||||
let errors = self.select_where_possible(infcx);
|
let errors = self.select_where_possible(infcx);
|
||||||
if !errors.is_empty() {
|
if !errors.is_empty() {
|
||||||
|
@ -234,12 +228,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
self.predicates.to_errors(CodeAmbiguity).into_iter().map(to_fulfillment_error).collect()
|
||||||
.predicates
|
|
||||||
.to_errors(CodeAmbiguity)
|
|
||||||
.into_iter()
|
|
||||||
.map(to_fulfillment_error)
|
|
||||||
.collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_all_with_constness_or_error(
|
fn select_all_with_constness_or_error(
|
||||||
|
@ -254,12 +243,7 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self
|
self.predicates.to_errors(CodeAmbiguity).into_iter().map(to_fulfillment_error).collect()
|
||||||
.predicates
|
|
||||||
.to_errors(CodeAmbiguity)
|
|
||||||
.into_iter()
|
|
||||||
.map(to_fulfillment_error)
|
|
||||||
.collect()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_where_possible(
|
fn select_where_possible(
|
||||||
|
|
|
@ -1430,7 +1430,8 @@ pub fn check_type_bounds<'tcx>(
|
||||||
|
|
||||||
// Check that all obligations are satisfied by the implementation's
|
// Check that all obligations are satisfied by the implementation's
|
||||||
// version.
|
// version.
|
||||||
let errors = inh.fulfillment_cx.borrow_mut().select_all_with_constness_or_error(&infcx, constness);
|
let errors =
|
||||||
|
inh.fulfillment_cx.borrow_mut().select_all_with_constness_or_error(&infcx, constness);
|
||||||
if !errors.is_empty() {
|
if !errors.is_empty() {
|
||||||
infcx.report_fulfillment_errors(&errors, None, false);
|
infcx.report_fulfillment_errors(&errors, None, false);
|
||||||
return Err(ErrorReported);
|
return Err(ErrorReported);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue