Auto merge of #90700 - fee1-dead:select-returns-vec, r=davidtwco

Make `select_*` methods return `Vec` for `TraitEngine`

This reduces some complexity as an empty vec means no errors and non-empty vec means errors occurred.
This commit is contained in:
bors 2021-11-09 11:16:38 +00:00
commit 36d547571c

View File

@ -77,13 +77,13 @@ fn check_fn(
if is_future { if is_future {
let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap(); let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
let span = decl.output.span(); let span = decl.output.span();
let send_result = cx.tcx.infer_ctxt().enter(|infcx| { let send_errors = cx.tcx.infer_ctxt().enter(|infcx| {
let cause = traits::ObligationCause::misc(span, hir_id); let cause = traits::ObligationCause::misc(span, hir_id);
let mut fulfillment_cx = traits::FulfillmentContext::new(); let mut fulfillment_cx = traits::FulfillmentContext::new();
fulfillment_cx.register_bound(&infcx, cx.param_env, ret_ty, send_trait, cause); fulfillment_cx.register_bound(&infcx, cx.param_env, ret_ty, send_trait, cause);
fulfillment_cx.select_all_or_error(&infcx) fulfillment_cx.select_all_or_error(&infcx)
}); });
if let Err(send_errors) = send_result { if !send_errors.is_empty() {
span_lint_and_then( span_lint_and_then(
cx, cx,
FUTURE_NOT_SEND, FUTURE_NOT_SEND,