Rollup merge of #120590 - compiler-errors:dead, r=Nilstrieb
Remove unused args from functions `#[instrument]` suppresses the unused arguments from a function, *and* suppresses unused methods too! This PR removes things which are only used via `#[instrument]` calls, and fixes some other errors (privacy?) that I will comment inline. It's possible that some of these arguments were being passed in for the purposes of being instrumented, but I am unconvinced by most of them.
This commit is contained in:
commit
4ffb1a7f3d
22 changed files with 32 additions and 124 deletions
|
@ -243,9 +243,7 @@ impl<'tcx> dyn AstConv<'tcx> + '_ {
|
|||
speculative: bool,
|
||||
dup_bindings: &mut FxHashMap<DefId, Span>,
|
||||
path_span: Span,
|
||||
constness: ty::BoundConstness,
|
||||
only_self_bounds: OnlySelfBounds,
|
||||
polarity: ty::ImplPolarity,
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
// Given something like `U: SomeTrait<T = X>`, we want to produce a
|
||||
// predicate like `<U as SomeTrait>::T = X`. This is somewhat
|
||||
|
|
|
@ -16,7 +16,7 @@ use rustc_middle::ty::{
|
|||
self, GenericArgsRef, GenericParamDef, GenericParamDefKind, IsSuggestable, Ty, TyCtxt,
|
||||
};
|
||||
use rustc_session::lint::builtin::LATE_BOUND_LIFETIME_ARGUMENTS;
|
||||
use rustc_span::{symbol::kw, Span};
|
||||
use rustc_span::symbol::kw;
|
||||
use smallvec::SmallVec;
|
||||
|
||||
/// Report an error that a generic argument did not match the generic parameter that was
|
||||
|
@ -404,7 +404,6 @@ pub fn create_args_for_parent_generic_args<'tcx: 'a, 'a>(
|
|||
/// Used specifically for function calls.
|
||||
pub fn check_generic_arg_count_for_call(
|
||||
tcx: TyCtxt<'_>,
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
generics: &ty::Generics,
|
||||
seg: &hir::PathSegment<'_>,
|
||||
|
@ -418,17 +417,7 @@ pub fn check_generic_arg_count_for_call(
|
|||
};
|
||||
let has_self = generics.parent.is_none() && generics.has_self;
|
||||
|
||||
check_generic_arg_count(
|
||||
tcx,
|
||||
span,
|
||||
def_id,
|
||||
seg,
|
||||
generics,
|
||||
gen_args,
|
||||
gen_pos,
|
||||
has_self,
|
||||
seg.infer_args,
|
||||
)
|
||||
check_generic_arg_count(tcx, def_id, seg, generics, gen_args, gen_pos, has_self, seg.infer_args)
|
||||
}
|
||||
|
||||
/// Checks that the correct number of generic arguments have been provided.
|
||||
|
@ -436,7 +425,6 @@ pub fn check_generic_arg_count_for_call(
|
|||
#[instrument(skip(tcx, gen_pos), level = "debug")]
|
||||
pub(crate) fn check_generic_arg_count(
|
||||
tcx: TyCtxt<'_>,
|
||||
span: Span,
|
||||
def_id: DefId,
|
||||
seg: &hir::PathSegment<'_>,
|
||||
gen_params: &ty::Generics,
|
||||
|
|
|
@ -25,7 +25,7 @@ use rustc_hir as hir;
|
|||
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
|
||||
use rustc_hir::def_id::{DefId, LocalDefId};
|
||||
use rustc_hir::intravisit::{walk_generics, Visitor as _};
|
||||
use rustc_hir::{GenericArg, GenericArgs, OpaqueTyOrigin};
|
||||
use rustc_hir::{GenericArg, GenericArgs};
|
||||
use rustc_infer::infer::{InferCtxt, TyCtxtInferExt};
|
||||
use rustc_infer::traits::ObligationCause;
|
||||
use rustc_middle::middle::stability::AllowUnstable;
|
||||
|
@ -379,7 +379,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
|
||||
let mut arg_count = check_generic_arg_count(
|
||||
tcx,
|
||||
span,
|
||||
def_id,
|
||||
seg,
|
||||
generics,
|
||||
|
@ -773,9 +772,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
speculative,
|
||||
&mut dup_bindings,
|
||||
binding.span,
|
||||
constness,
|
||||
only_self_bounds,
|
||||
polarity,
|
||||
);
|
||||
// Okay to ignore `Err` because of `ErrorGuaranteed` (see above).
|
||||
}
|
||||
|
@ -2493,7 +2490,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
let opaque_ty = tcx.hir().item(item_id);
|
||||
|
||||
match opaque_ty.kind {
|
||||
hir::ItemKind::OpaqueTy(&hir::OpaqueTy { origin, .. }) => {
|
||||
hir::ItemKind::OpaqueTy(&hir::OpaqueTy { .. }) => {
|
||||
let local_def_id = item_id.owner_id.def_id;
|
||||
// If this is an RPITIT and we are using the new RPITIT lowering scheme, we
|
||||
// generate the def_id of an associated type for the trait and return as
|
||||
|
@ -2503,7 +2500,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
} else {
|
||||
local_def_id.to_def_id()
|
||||
};
|
||||
self.impl_trait_ty_to_ty(def_id, lifetimes, origin, in_trait)
|
||||
self.impl_trait_ty_to_ty(def_id, lifetimes, in_trait)
|
||||
}
|
||||
ref i => bug!("`impl Trait` pointed to non-opaque type?? {:#?}", i),
|
||||
}
|
||||
|
@ -2559,7 +2556,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
|||
&self,
|
||||
def_id: DefId,
|
||||
lifetimes: &[hir::GenericArg<'_>],
|
||||
origin: OpaqueTyOrigin,
|
||||
in_trait: bool,
|
||||
) -> Ty<'tcx> {
|
||||
debug!("impl_trait_ty_to_ty(def_id={:?}, lifetimes={:?})", def_id, lifetimes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue