about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-03-22 05:33:18 +0000
committerbors <bors@rust-lang.org>2023-03-22 05:33:18 +0000
commit9bdb4881c7e6061fa8acdbb3ddfcd2dd7e11cc89 (patch)
treec59f7768d8b6601fa8f8cda2ccbed52cf652e3dd /src
parent5fa73a75ce94faf1d1008ec96c043134ef0df427 (diff)
parentb8541eb76769798cc34908dc815cc17b6a7a91bc (diff)
downloadrust-9bdb4881c7e6061fa8acdbb3ddfcd2dd7e11cc89.tar.gz
rust-9bdb4881c7e6061fa8acdbb3ddfcd2dd7e11cc89.zip
Auto merge of #109119 - lcnr:trait-system-cleanup, r=compiler-errors
a general type system cleanup

removes the helper functions `traits::fully_solve_X` as they add more complexity then they are worth. It's confusing which of these helpers should be used in which context.

changes the way we deal with overflow to always add depth in `evaluate_predicates_recursively`. It may make sense to actually fully transition to not have `recursion_depth` on obligations but that's probably a bit too much for this PR.

also removes some other small - and imo unnecessary - helpers.

r? types
Diffstat (limited to 'src')
-rw-r--r--src/tools/clippy/clippy_lints/src/future_not_send.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/tools/clippy/clippy_lints/src/future_not_send.rs b/src/tools/clippy/clippy_lints/src/future_not_send.rs
index 9fb73a371b8..ed0bd58c770 100644
--- a/src/tools/clippy/clippy_lints/src/future_not_send.rs
+++ b/src/tools/clippy/clippy_lints/src/future_not_send.rs
@@ -9,7 +9,7 @@ use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::def_id::LocalDefId;
 use rustc_span::{sym, Span};
 use rustc_trait_selection::traits::error_reporting::suggestions::TypeErrCtxtExt;
-use rustc_trait_selection::traits::{self, FulfillmentError};
+use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt};
 
 declare_clippy_lint! {
     /// ### What it does
@@ -79,8 +79,10 @@ impl<'tcx> LateLintPass<'tcx> for FutureNotSend {
                 let send_trait = cx.tcx.get_diagnostic_item(sym::Send).unwrap();
                 let span = decl.output.span();
                 let infcx = cx.tcx.infer_ctxt().build();
+                let ocx = ObligationCtxt::new(&infcx);
                 let cause = traits::ObligationCause::misc(span, fn_def_id);
-                let send_errors = traits::fully_solve_bound(&infcx, cause, cx.param_env, ret_ty, send_trait);
+                ocx.register_bound(cause, cx.param_env, ret_ty, send_trait);
+                let send_errors = ocx.select_all_or_error();
                 if !send_errors.is_empty() {
                     span_lint_and_then(
                         cx,