Fix tools

This commit is contained in:
Michael Goulet 2024-07-21 15:32:40 -04:00
parent ce8a625092
commit e9e9495f21
4 changed files with 7 additions and 4 deletions

View File

@ -2244,7 +2244,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
/// ///
/// Returns `true` if an async-await specific note was added to the diagnostic. /// Returns `true` if an async-await specific note was added to the diagnostic.
#[instrument(level = "debug", skip_all, fields(?obligation.predicate, ?obligation.cause.span))] #[instrument(level = "debug", skip_all, fields(?obligation.predicate, ?obligation.cause.span))]
pub(super) fn maybe_note_obligation_cause_for_async_await<G: EmissionGuarantee>( pub fn maybe_note_obligation_cause_for_async_await<G: EmissionGuarantee>(
&self, &self,
err: &mut Diag<'_, G>, err: &mut Diag<'_, G>,
obligation: &PredicateObligation<'tcx>, obligation: &PredicateObligation<'tcx>,

View File

@ -16,6 +16,7 @@ use clippy_utils::source::snippet_opt;
use clippy_utils::ty::is_must_use_ty; use clippy_utils::ty::is_must_use_ty;
use clippy_utils::visitors::for_each_expr_without_closures; use clippy_utils::visitors::for_each_expr_without_closures;
use clippy_utils::{return_ty, trait_ref_of_method}; use clippy_utils::{return_ty, trait_ref_of_method};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use core::ops::ControlFlow; use core::ops::ControlFlow;
@ -117,11 +118,11 @@ fn check_needless_must_use(
// Ignore async functions unless Future::Output type is a must_use type // Ignore async functions unless Future::Output type is a must_use type
if sig.header.is_async() { if sig.header.is_async() {
let infcx = cx.tcx.infer_ctxt().build(); let infcx = cx.tcx.infer_ctxt().build();
if let Some(future_ty) = infcx.get_impl_future_output_ty(return_ty(cx, item_id)) if let Some(future_ty) = infcx.err_ctxt().get_impl_future_output_ty(return_ty(cx, item_id))
&& !is_must_use_ty(cx, future_ty) && !is_must_use_ty(cx, future_ty)
{ {
return; return;
} };
} }
span_lint_and_help( span_lint_and_help(

View File

@ -9,6 +9,7 @@ use rustc_middle::ty::{self, AliasTy, ClauseKind, PredicateKind};
use rustc_session::declare_lint_pass; use rustc_session::declare_lint_pass;
use rustc_span::def_id::LocalDefId; use rustc_span::def_id::LocalDefId;
use rustc_span::{sym, Span}; use rustc_span::{sym, Span};
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt}; use rustc_trait_selection::traits::{self, FulfillmentError, ObligationCtxt};
declare_clippy_lint! { declare_clippy_lint! {

View File

@ -15,6 +15,7 @@ use rustc_lint::{LateContext, LateLintPass, LintContext};
use rustc_middle::lint::in_external_macro; use rustc_middle::lint::in_external_macro;
use rustc_session::impl_lint_pass; use rustc_session::impl_lint_pass;
use rustc_span::Span; use rustc_span::Span;
use rustc_trait_selection::error_reporting::InferCtxtErrorExt;
use std::ops::Deref; use std::ops::Deref;
declare_clippy_lint! { declare_clippy_lint! {
@ -159,7 +160,7 @@ impl NoEffect {
// Remove `impl Future<Output = T>` to get `T` // Remove `impl Future<Output = T>` to get `T`
if cx.tcx.ty_is_opaque_future(ret_ty) if cx.tcx.ty_is_opaque_future(ret_ty)
&& let Some(true_ret_ty) = && let Some(true_ret_ty) =
cx.tcx.infer_ctxt().build().get_impl_future_output_ty(ret_ty) cx.tcx.infer_ctxt().build().err_ctxt().get_impl_future_output_ty(ret_ty)
{ {
ret_ty = true_ret_ty; ret_ty = true_ret_ty;
} }