mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk
rustc: Remove needless lifetimes
This commit is contained in:
commit
d23cb738d2
@ -51,7 +51,7 @@ pub fn beautify_doc_string(data: Symbol, kind: CommentKind) -> Symbol {
|
||||
if i != 0 || j != lines.len() { Some((i, j)) } else { None }
|
||||
}
|
||||
|
||||
fn get_horizontal_trim<'a>(lines: &'a [&str], kind: CommentKind) -> Option<String> {
|
||||
fn get_horizontal_trim(lines: &[&str], kind: CommentKind) -> Option<String> {
|
||||
let mut i = usize::MAX;
|
||||
let mut first = true;
|
||||
|
||||
|
@ -414,7 +414,7 @@ fn compute_hir_hash(
|
||||
})
|
||||
}
|
||||
|
||||
pub fn lower_to_hir<'hir>(tcx: TyCtxt<'hir>, (): ()) -> hir::Crate<'hir> {
|
||||
pub fn lower_to_hir(tcx: TyCtxt<'_>, (): ()) -> hir::Crate<'_> {
|
||||
let sess = tcx.sess;
|
||||
let krate = tcx.untracked_crate.steal();
|
||||
let mut resolver = tcx.resolver_for_lowering(()).steal();
|
||||
|
@ -28,10 +28,10 @@ pub use super::{
|
||||
/// that shows how to do this at `src/test/run-make/obtain-borrowck/`.
|
||||
///
|
||||
/// * Polonius is highly unstable, so expect regular changes in its signature or other details.
|
||||
pub fn get_body_with_borrowck_facts<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub fn get_body_with_borrowck_facts(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> BodyWithBorrowckFacts<'tcx> {
|
||||
) -> BodyWithBorrowckFacts<'_> {
|
||||
let (input_body, promoted) = tcx.mir_promoted(def);
|
||||
let infcx = tcx.infer_ctxt().with_opaque_type_inference(DefiningAnchor::Bind(def.did)).build();
|
||||
let input_body: &Body<'_> = &input_body.borrow();
|
||||
|
@ -9,7 +9,7 @@ use rustc_middle::mir::{Body, Local, Location};
|
||||
/// Find all uses of (including assignments to) a [`Local`].
|
||||
///
|
||||
/// Uses `BTreeSet` so output is deterministic.
|
||||
pub(super) fn find<'tcx>(body: &Body<'tcx>, local: Local) -> BTreeSet<Location> {
|
||||
pub(super) fn find(body: &Body<'_>, local: Local) -> BTreeSet<Location> {
|
||||
let mut visitor = AllLocalUsesVisitor { for_local: local, uses: BTreeSet::default() };
|
||||
visitor.visit_body(body);
|
||||
visitor.uses
|
||||
|
@ -124,10 +124,7 @@ pub fn provide(providers: &mut Providers) {
|
||||
};
|
||||
}
|
||||
|
||||
fn mir_borrowck<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx BorrowCheckResult<'tcx> {
|
||||
fn mir_borrowck(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> &BorrowCheckResult<'_> {
|
||||
let (input_body, promoted) = tcx.mir_promoted(def);
|
||||
debug!("run query mir_borrowck: {}", tcx.def_path_str(def.did.to_def_id()));
|
||||
|
||||
|
@ -85,7 +85,7 @@ impl UniversalRegionRelations<'_> {
|
||||
/// outlives `fr` and (b) is not local.
|
||||
///
|
||||
/// (*) If there are multiple competing choices, we return all of them.
|
||||
pub(crate) fn non_local_upper_bounds<'a>(&'a self, fr: RegionVid) -> Vec<RegionVid> {
|
||||
pub(crate) fn non_local_upper_bounds(&self, fr: RegionVid) -> Vec<RegionVid> {
|
||||
debug!("non_local_upper_bound(fr={:?})", fr);
|
||||
let res = self.non_local_bounds(&self.inverse_outlives, fr);
|
||||
assert!(!res.is_empty(), "can't find an upper bound!?");
|
||||
@ -148,9 +148,9 @@ impl UniversalRegionRelations<'_> {
|
||||
/// Helper for `non_local_upper_bounds` and `non_local_lower_bounds`.
|
||||
/// Repeatedly invokes `postdom_parent` until we find something that is not
|
||||
/// local. Returns `None` if we never do so.
|
||||
fn non_local_bounds<'a>(
|
||||
fn non_local_bounds(
|
||||
&self,
|
||||
relation: &'a TransitiveRelation<RegionVid>,
|
||||
relation: &TransitiveRelation<RegionVid>,
|
||||
fr0: RegionVid,
|
||||
) -> Vec<RegionVid> {
|
||||
// This method assumes that `fr0` is one of the universally
|
||||
|
@ -352,7 +352,7 @@ pub fn parse_asm_args<'a>(
|
||||
///
|
||||
/// This function must be called immediately after the option token is parsed.
|
||||
/// Otherwise, the suggestion will be incorrect.
|
||||
fn err_duplicate_option<'a>(p: &mut Parser<'a>, symbol: Symbol, span: Span) {
|
||||
fn err_duplicate_option(p: &mut Parser<'_>, symbol: Symbol, span: Span) {
|
||||
let mut err = p
|
||||
.sess
|
||||
.span_diagnostic
|
||||
|
@ -52,7 +52,7 @@ pub fn linkage_to_gcc(linkage: Linkage) -> FunctionType {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn compile_codegen_unit<'tcx>(tcx: TyCtxt<'tcx>, cgu_name: Symbol, supports_128bit_integers: bool) -> (ModuleCodegen<GccContext>, u64) {
|
||||
pub fn compile_codegen_unit(tcx: TyCtxt<'_>, cgu_name: Symbol, supports_128bit_integers: bool) -> (ModuleCodegen<GccContext>, u64) {
|
||||
let prof_timer = tcx.prof.generic_activity("codegen_module");
|
||||
let start_time = Instant::now();
|
||||
|
||||
|
@ -44,7 +44,7 @@ pub fn bytes_in_context<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, bytes: &[u8]) ->
|
||||
context.new_array_constructor(None, typ, &elements)
|
||||
}
|
||||
|
||||
pub fn type_is_pointer<'gcc>(typ: Type<'gcc>) -> bool {
|
||||
pub fn type_is_pointer(typ: Type<'_>) -> bool {
|
||||
typ.get_pointee().is_some()
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ impl ExtraBackendMethods for GccCodegenBackend {
|
||||
mods
|
||||
}
|
||||
|
||||
fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: Symbol) -> (ModuleCodegen<Self::Module>, u64) {
|
||||
fn compile_codegen_unit(&self, tcx: TyCtxt<'_>, cgu_name: Symbol) -> (ModuleCodegen<Self::Module>, u64) {
|
||||
base::compile_codegen_unit(tcx, cgu_name, *self.supports_128bit_integers.lock().expect("lock"))
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ use std::ffi::CString;
|
||||
/// implementing this Rust version, and though the format documentation is very explicit and
|
||||
/// detailed, some undocumented details in Clang's implementation (that may or may not be important)
|
||||
/// were also replicated for Rust's Coverage Map.
|
||||
pub fn finalize<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
|
||||
pub fn finalize(cx: &CodegenCx<'_, '_>) {
|
||||
let tcx = cx.tcx;
|
||||
|
||||
// Ensure the installed version of LLVM supports at least Coverage Map
|
||||
@ -284,7 +284,7 @@ fn save_function_record(
|
||||
/// "code coverage dead code cgu" during the partitioning process. This prevents us from generating
|
||||
/// code regions for the same function more than once which can lead to linker errors regarding
|
||||
/// duplicate symbols.
|
||||
fn add_unused_functions<'ll, 'tcx>(cx: &CodegenCx<'ll, 'tcx>) {
|
||||
fn add_unused_functions(cx: &CodegenCx<'_, '_>) {
|
||||
assert!(cx.codegen_unit.is_code_coverage_dead_code_cgu());
|
||||
|
||||
let tcx = cx.tcx;
|
||||
|
@ -111,7 +111,7 @@ macro_rules! return_if_di_node_created_in_meantime {
|
||||
|
||||
/// Extract size and alignment from a TyAndLayout.
|
||||
#[inline]
|
||||
fn size_and_align_of<'tcx>(ty_and_layout: TyAndLayout<'tcx>) -> (Size, Align) {
|
||||
fn size_and_align_of(ty_and_layout: TyAndLayout<'_>) -> (Size, Align) {
|
||||
(ty_and_layout.size, ty_and_layout.align.abi)
|
||||
}
|
||||
|
||||
|
@ -2390,11 +2390,11 @@ extern "C" {
|
||||
|
||||
pub fn LLVMRustSetDataLayoutFromTargetMachine<'a>(M: &'a Module, TM: &'a TargetMachine);
|
||||
|
||||
pub fn LLVMRustBuildOperandBundleDef<'a>(
|
||||
pub fn LLVMRustBuildOperandBundleDef(
|
||||
Name: *const c_char,
|
||||
Inputs: *const &'a Value,
|
||||
Inputs: *const &'_ Value,
|
||||
NumInputs: c_uint,
|
||||
) -> &'a mut OperandBundleDef<'a>;
|
||||
) -> &mut OperandBundleDef<'_>;
|
||||
pub fn LLVMRustFreeOperandBundleDef<'a>(Bundle: &'a mut OperandBundleDef<'a>);
|
||||
|
||||
pub fn LLVMRustPositionBuilderAtStart<'a>(B: &Builder<'a>, BB: &'a BasicBlock);
|
||||
|
@ -607,21 +607,21 @@ fn link_dwarf_object<'a>(
|
||||
}
|
||||
|
||||
impl<Relocations> ThorinSession<Relocations> {
|
||||
fn alloc_mmap<'arena>(&'arena self, data: Mmap) -> &'arena Mmap {
|
||||
fn alloc_mmap(&self, data: Mmap) -> &Mmap {
|
||||
(*self.arena_mmap.alloc(data)).borrow()
|
||||
}
|
||||
}
|
||||
|
||||
impl<Relocations> thorin::Session<Relocations> for ThorinSession<Relocations> {
|
||||
fn alloc_data<'arena>(&'arena self, data: Vec<u8>) -> &'arena [u8] {
|
||||
fn alloc_data(&self, data: Vec<u8>) -> &[u8] {
|
||||
(*self.arena_data.alloc(data)).borrow()
|
||||
}
|
||||
|
||||
fn alloc_relocation<'arena>(&'arena self, data: Relocations) -> &'arena Relocations {
|
||||
fn alloc_relocation(&self, data: Relocations) -> &Relocations {
|
||||
(*self.arena_relocations.alloc(data)).borrow()
|
||||
}
|
||||
|
||||
fn read_input<'arena>(&'arena self, path: &Path) -> std::io::Result<&'arena [u8]> {
|
||||
fn read_input(&self, path: &Path) -> std::io::Result<&[u8]> {
|
||||
let file = File::open(&path)?;
|
||||
let mmap = (unsafe { Mmap::map(file) })?;
|
||||
Ok(self.alloc_mmap(mmap))
|
||||
|
@ -163,10 +163,10 @@ fn is_reachable_non_generic_provider_extern(tcx: TyCtxt<'_>, def_id: DefId) -> b
|
||||
tcx.reachable_non_generics(def_id.krate).contains_key(&def_id)
|
||||
}
|
||||
|
||||
fn exported_symbols_provider_local<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn exported_symbols_provider_local(
|
||||
tcx: TyCtxt<'_>,
|
||||
cnum: CrateNum,
|
||||
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportInfo)] {
|
||||
) -> &[(ExportedSymbol<'_>, SymbolExportInfo)] {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
if !tcx.sess.opts.output_types.should_codegen() {
|
||||
|
@ -10,7 +10,7 @@ pub mod type_names;
|
||||
/// NOTE: This is somewhat inconsistent right now: For empty enums and enums with a single
|
||||
/// fieldless variant, we generate DW_TAG_struct_type, although a
|
||||
/// DW_TAG_enumeration_type would be a better fit.
|
||||
pub fn wants_c_like_enum_debuginfo<'tcx>(enum_type_and_layout: TyAndLayout<'tcx>) -> bool {
|
||||
pub fn wants_c_like_enum_debuginfo(enum_type_and_layout: TyAndLayout<'_>) -> bool {
|
||||
match enum_type_and_layout.ty.kind() {
|
||||
ty::Adt(adt_def, _) => {
|
||||
if !adt_def.is_enum() {
|
||||
|
@ -65,7 +65,7 @@ impl<'a, 'tcx> VirtualIndex {
|
||||
|
||||
/// This takes a valid `self` receiver type and extracts the principal trait
|
||||
/// ref of the type.
|
||||
fn expect_dyn_trait_in_self<'tcx>(ty: Ty<'tcx>) -> ty::PolyExistentialTraitRef<'tcx> {
|
||||
fn expect_dyn_trait_in_self(ty: Ty<'_>) -> ty::PolyExistentialTraitRef<'_> {
|
||||
for arg in ty.peel_refs().walk() {
|
||||
if let GenericArgKind::Type(ty) = arg.unpack() {
|
||||
if let ty::Dynamic(data, _, _) = ty.kind() {
|
||||
|
@ -419,7 +419,7 @@ pub fn from_target_feature(
|
||||
|
||||
/// Computes the set of target features used in a function for the purposes of
|
||||
/// inline assembly.
|
||||
fn asm_target_features<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> &'tcx FxHashSet<Symbol> {
|
||||
fn asm_target_features(tcx: TyCtxt<'_>, did: DefId) -> &FxHashSet<Symbol> {
|
||||
let mut target_features = tcx.sess.unstable_target_features.clone();
|
||||
if tcx.def_kind(did).has_codegen_attrs() {
|
||||
let attrs = tcx.codegen_fn_attrs(did);
|
||||
|
@ -205,10 +205,7 @@ impl SelfProfilerRef {
|
||||
/// VerboseTimingGuard returned from this call is dropped. In addition to recording
|
||||
/// a measureme event, "verbose" generic activities also print a timing entry to
|
||||
/// stderr if the compiler is invoked with -Ztime-passes.
|
||||
pub fn verbose_generic_activity<'a>(
|
||||
&'a self,
|
||||
event_label: &'static str,
|
||||
) -> VerboseTimingGuard<'a> {
|
||||
pub fn verbose_generic_activity(&self, event_label: &'static str) -> VerboseTimingGuard<'_> {
|
||||
let message =
|
||||
if self.print_verbose_generic_activities { Some(event_label.to_owned()) } else { None };
|
||||
|
||||
@ -216,11 +213,11 @@ impl SelfProfilerRef {
|
||||
}
|
||||
|
||||
/// Like `verbose_generic_activity`, but with an extra arg.
|
||||
pub fn verbose_generic_activity_with_arg<'a, A>(
|
||||
&'a self,
|
||||
pub fn verbose_generic_activity_with_arg<A>(
|
||||
&self,
|
||||
event_label: &'static str,
|
||||
event_arg: A,
|
||||
) -> VerboseTimingGuard<'a>
|
||||
) -> VerboseTimingGuard<'_>
|
||||
where
|
||||
A: Borrow<str> + Into<String>,
|
||||
{
|
||||
|
@ -199,7 +199,7 @@ impl<T: Eq + Hash + Copy> TransitiveRelation<T> {
|
||||
/// Viewing the relation as a graph, computes the "mutual
|
||||
/// immediate postdominator" of a set of points (if one
|
||||
/// exists). See `postdom_upper_bound` for details.
|
||||
pub fn mutual_immediate_postdominator<'a>(&'a self, mut mubs: Vec<T>) -> Option<T> {
|
||||
pub fn mutual_immediate_postdominator(&self, mut mubs: Vec<T>) -> Option<T> {
|
||||
loop {
|
||||
match mubs.len() {
|
||||
0 => return None,
|
||||
|
@ -178,7 +178,7 @@ impl<V: Eq + Hash> UnordSet<V> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn items<'a>(&'a self) -> UnordItems<&'a V, impl Iterator<Item = &'a V>> {
|
||||
pub fn items(&self) -> UnordItems<&V, impl Iterator<Item = &V>> {
|
||||
UnordItems(self.inner.iter())
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ impl<K: Eq + Hash, V> UnordMap<K, V> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn items<'a>(&'a self) -> UnordItems<(&'a K, &'a V), impl Iterator<Item = (&'a K, &'a V)>> {
|
||||
pub fn items(&self) -> UnordItems<(&K, &V), impl Iterator<Item = (&K, &V)>> {
|
||||
UnordItems(self.inner.iter())
|
||||
}
|
||||
|
||||
@ -311,7 +311,7 @@ impl<V> UnordBag<V> {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn items<'a>(&'a self) -> UnordItems<&'a V, impl Iterator<Item = &'a V>> {
|
||||
pub fn items(&self) -> UnordItems<&V, impl Iterator<Item = &V>> {
|
||||
UnordItems(self.inner.iter())
|
||||
}
|
||||
|
||||
|
@ -549,9 +549,7 @@ fn icu_locale_from_unic_langid(lang: LanguageIdentifier) -> Option<icu_locid::Lo
|
||||
icu_locid::Locale::try_from_bytes(lang.to_string().as_bytes()).ok()
|
||||
}
|
||||
|
||||
pub fn fluent_value_from_str_list_sep_by_and<'source>(
|
||||
l: Vec<Cow<'source, str>>,
|
||||
) -> FluentValue<'source> {
|
||||
pub fn fluent_value_from_str_list_sep_by_and(l: Vec<Cow<'_, str>>) -> FluentValue<'_> {
|
||||
// Fluent requires 'static value here for its AnyEq usages.
|
||||
#[derive(Clone, PartialEq, Debug)]
|
||||
struct FluentStrListSepByAnd(Vec<String>);
|
||||
|
@ -356,7 +356,7 @@ fn parse_sep_and_kleene_op(
|
||||
// `$$` or a meta-variable is the lhs of a macro but shouldn't.
|
||||
//
|
||||
// For example, `macro_rules! foo { ( ${length()} ) => {} }`
|
||||
fn span_dollar_dollar_or_metavar_in_the_lhs_err<'sess>(sess: &'sess ParseSess, token: &Token) {
|
||||
fn span_dollar_dollar_or_metavar_in_the_lhs_err(sess: &ParseSess, token: &Token) {
|
||||
sess.span_diagnostic
|
||||
.span_err(token.span, &format!("unexpected token: {}", pprust::token_to_string(token)));
|
||||
sess.span_diagnostic.span_note_without_error(
|
||||
|
@ -164,7 +164,7 @@
|
||||
//! fn node_id(&'a self, n: &Nd) -> dot::Id<'a> {
|
||||
//! dot::Id::new(format!("N{}", n)).unwrap()
|
||||
//! }
|
||||
//! fn node_label<'b>(&'b self, n: &Nd) -> dot::LabelText<'b> {
|
||||
//! fn node_label(&self, n: &Nd) -> dot::LabelText<'_> {
|
||||
//! dot::LabelText::LabelStr(self.nodes[*n].into())
|
||||
//! }
|
||||
//! fn edge_label<'b>(&'b self, _: &Ed) -> dot::LabelText<'b> {
|
||||
|
@ -162,7 +162,7 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
|
||||
}
|
||||
|
||||
/// Check that a `static` is inhabited.
|
||||
fn check_static_inhabited<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
fn check_static_inhabited(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
// Make sure statics are inhabited.
|
||||
// Other parts of the compiler assume that there are no uninhabited places. In principle it
|
||||
// would be enough to check this for `extern` statics, as statics with an initializer will
|
||||
@ -212,7 +212,7 @@ fn check_static_inhabited<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
|
||||
/// Checks that an opaque type does not contain cycles and does not use `Self` or `T::Foo`
|
||||
/// projections that would result in "inheriting lifetimes".
|
||||
fn check_opaque<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
|
||||
fn check_opaque(tcx: TyCtxt<'_>, id: hir::ItemId) {
|
||||
let item = tcx.hir().item(id);
|
||||
let hir::ItemKind::OpaqueTy(hir::OpaqueTy { origin, .. }) = item.kind else {
|
||||
tcx.sess.delay_span_bug(tcx.hir().span(id.hir_id()), "expected opaque item");
|
||||
@ -245,8 +245,8 @@ fn check_opaque<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
|
||||
/// Checks that an opaque type does not use `Self` or `T::Foo` projections that would result
|
||||
/// in "inheriting lifetimes".
|
||||
#[instrument(level = "debug", skip(tcx, span))]
|
||||
pub(super) fn check_opaque_for_inheriting_lifetimes<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(super) fn check_opaque_for_inheriting_lifetimes(
|
||||
tcx: TyCtxt<'_>,
|
||||
def_id: LocalDefId,
|
||||
span: Span,
|
||||
) {
|
||||
@ -496,7 +496,7 @@ fn is_enum_of_nonnullable_ptr<'tcx>(
|
||||
matches!(field.ty(tcx, substs).kind(), ty::FnPtr(..) | ty::Ref(..))
|
||||
}
|
||||
|
||||
fn check_static_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
fn check_static_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
if tcx.codegen_fn_attrs(def_id).import_linkage.is_some() {
|
||||
if match tcx.type_of(def_id).kind() {
|
||||
ty::RawPtr(_) => false,
|
||||
@ -508,7 +508,7 @@ fn check_static_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_item_type<'tcx>(tcx: TyCtxt<'tcx>, id: hir::ItemId) {
|
||||
fn check_item_type(tcx: TyCtxt<'_>, id: hir::ItemId) {
|
||||
debug!(
|
||||
"check_item_type(it.def_id={:?}, it.name={})",
|
||||
id.owner_id,
|
||||
@ -1160,7 +1160,7 @@ pub(super) fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, adt: ty::AdtDef<'tcx>)
|
||||
}
|
||||
|
||||
#[allow(trivial_numeric_casts)]
|
||||
fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
fn check_enum(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
let def = tcx.adt_def(def_id);
|
||||
def.destructor(tcx); // force the destructor to be evaluated
|
||||
|
||||
|
@ -1517,8 +1517,8 @@ fn compare_generic_param_kinds<'tcx>(
|
||||
}
|
||||
|
||||
/// Use `tcx.compare_assoc_const_impl_item_with_trait_item` instead
|
||||
pub(crate) fn raw_compare_const_impl<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(crate) fn raw_compare_const_impl(
|
||||
tcx: TyCtxt<'_>,
|
||||
(impl_const_item_def, trait_const_item_def): (LocalDefId, DefId),
|
||||
) -> Result<(), ErrorGuaranteed> {
|
||||
let impl_const_item = tcx.associated_item(impl_const_item_def);
|
||||
|
@ -115,10 +115,10 @@ fn adt_destructor(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::Destructor> {
|
||||
|
||||
/// Given a `DefId` for an opaque type in return position, find its parent item's return
|
||||
/// expressions.
|
||||
fn get_owner_return_paths<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn get_owner_return_paths(
|
||||
tcx: TyCtxt<'_>,
|
||||
def_id: LocalDefId,
|
||||
) -> Option<(LocalDefId, ReturnsVisitor<'tcx>)> {
|
||||
) -> Option<(LocalDefId, ReturnsVisitor<'_>)> {
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let parent_id = tcx.hir().get_parent_item(hir_id).def_id;
|
||||
tcx.hir().find_by_def_id(parent_id).and_then(|node| node.body_id()).map(|body_id| {
|
||||
|
@ -1673,7 +1673,7 @@ fn check_method_receiver<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn e0307<'tcx>(tcx: TyCtxt<'tcx>, span: Span, receiver_ty: Ty<'_>) {
|
||||
fn e0307(tcx: TyCtxt<'_>, span: Span, receiver_ty: Ty<'_>) {
|
||||
struct_span_err!(
|
||||
tcx.sess.diagnostic(),
|
||||
span,
|
||||
|
@ -171,7 +171,7 @@ fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
|
||||
}
|
||||
}
|
||||
|
||||
fn visit_implementation_of_coerce_unsized<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) {
|
||||
fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
|
||||
debug!("visit_implementation_of_coerce_unsized: impl_did={:?}", impl_did);
|
||||
|
||||
// Just compute this for the side-effects, in particular reporting
|
||||
@ -181,7 +181,7 @@ fn visit_implementation_of_coerce_unsized<'tcx>(tcx: TyCtxt<'tcx>, impl_did: Loc
|
||||
tcx.at(span).coerce_unsized_info(impl_did);
|
||||
}
|
||||
|
||||
fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx>, impl_did: LocalDefId) {
|
||||
fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: LocalDefId) {
|
||||
debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}", impl_did);
|
||||
|
||||
let impl_hir_id = tcx.hir().local_def_id_to_hir_id(impl_did);
|
||||
|
@ -839,7 +839,7 @@ fn convert_variant(
|
||||
)
|
||||
}
|
||||
|
||||
fn adt_def<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ty::AdtDef<'tcx> {
|
||||
fn adt_def(tcx: TyCtxt<'_>, def_id: DefId) -> ty::AdtDef<'_> {
|
||||
use rustc_hir::*;
|
||||
|
||||
let def_id = def_id.expect_local();
|
||||
|
@ -276,7 +276,7 @@ fn resolve_lifetimes(tcx: TyCtxt<'_>, local_def_id: hir::OwnerId) -> ResolveLife
|
||||
rl
|
||||
}
|
||||
|
||||
fn late_region_as_bound_region<'tcx>(tcx: TyCtxt<'tcx>, region: &Region) -> ty::BoundVariableKind {
|
||||
fn late_region_as_bound_region(tcx: TyCtxt<'_>, region: &Region) -> ty::BoundVariableKind {
|
||||
match region {
|
||||
Region::LateBound(_, _, def_id) => {
|
||||
let name = tcx.hir().name(tcx.hir().local_def_id_to_hir_id(def_id.expect_local()));
|
||||
@ -1018,7 +1018,7 @@ impl<'a, 'tcx> Visitor<'tcx> for LifetimeContext<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn object_lifetime_default<'tcx>(tcx: TyCtxt<'tcx>, param_def_id: DefId) -> ObjectLifetimeDefault {
|
||||
fn object_lifetime_default(tcx: TyCtxt<'_>, param_def_id: DefId) -> ObjectLifetimeDefault {
|
||||
debug_assert_eq!(tcx.def_kind(param_def_id), DefKind::TyParam);
|
||||
let param_def_id = param_def_id.expect_local();
|
||||
let parent_def_id = tcx.local_parent(param_def_id);
|
||||
|
@ -318,10 +318,10 @@ fn gather_explicit_predicates_of(tcx: TyCtxt<'_>, def_id: DefId) -> ty::GenericP
|
||||
}
|
||||
}
|
||||
|
||||
fn const_evaluatable_predicates_of<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn const_evaluatable_predicates_of(
|
||||
tcx: TyCtxt<'_>,
|
||||
def_id: LocalDefId,
|
||||
) -> FxIndexSet<(ty::Predicate<'tcx>, Span)> {
|
||||
) -> FxIndexSet<(ty::Predicate<'_>, Span)> {
|
||||
struct ConstCollector<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
preds: FxIndexSet<(ty::Predicate<'tcx>, Span)>,
|
||||
|
@ -157,11 +157,11 @@ fn check_constness(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId, impl2_node: Node,
|
||||
/// ```
|
||||
///
|
||||
/// Would return `S1 = [C]` and `S2 = [Vec<C>, C]`.
|
||||
fn get_impl_substs<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn get_impl_substs(
|
||||
tcx: TyCtxt<'_>,
|
||||
impl1_def_id: LocalDefId,
|
||||
impl2_node: Node,
|
||||
) -> Option<(SubstsRef<'tcx>, SubstsRef<'tcx>)> {
|
||||
) -> Option<(SubstsRef<'_>, SubstsRef<'_>)> {
|
||||
let infcx = &tcx.infer_ctxt().build();
|
||||
let ocx = ObligationCtxt::new(infcx);
|
||||
let param_env = tcx.param_env(impl1_def_id);
|
||||
|
@ -13,9 +13,9 @@ use super::utils::*;
|
||||
/// `global_inferred_outlives`: this is initially the empty map that
|
||||
/// was generated by walking the items in the crate. This will
|
||||
/// now be filled with inferred predicates.
|
||||
pub(super) fn infer_predicates<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
) -> FxHashMap<DefId, ty::EarlyBinder<RequiredPredicates<'tcx>>> {
|
||||
pub(super) fn infer_predicates(
|
||||
tcx: TyCtxt<'_>,
|
||||
) -> FxHashMap<DefId, ty::EarlyBinder<RequiredPredicates<'_>>> {
|
||||
debug!("infer_predicates");
|
||||
|
||||
let mut explicit_map = ExplicitPredicatesMap::new();
|
||||
|
@ -118,7 +118,7 @@ fn identity(_: Ty<'_>) -> Vec<Adjustment<'_>> {
|
||||
vec![]
|
||||
}
|
||||
|
||||
fn simple<'tcx>(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec<Adjustment<'tcx>> {
|
||||
fn simple<'tcx>(kind: Adjust<'tcx>) -> impl FnOnce(Ty<'tcx>) -> Vec<Adjustment<'_>> {
|
||||
move |target| vec![Adjustment { kind, target }]
|
||||
}
|
||||
|
||||
|
@ -756,8 +756,8 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx> {
|
||||
/// - When reporting the Place back to the Delegate, ensure that the UpvarId uses the enclosing
|
||||
/// closure as the DefId.
|
||||
fn walk_captures(&mut self, closure_expr: &hir::Closure<'_>) {
|
||||
fn upvar_is_local_variable<'tcx>(
|
||||
upvars: Option<&'tcx FxIndexMap<hir::HirId, hir::Upvar>>,
|
||||
fn upvar_is_local_variable(
|
||||
upvars: Option<&FxIndexMap<hir::HirId, hir::Upvar>>,
|
||||
upvar_id: hir::HirId,
|
||||
body_owner_is_closure: bool,
|
||||
) -> bool {
|
||||
|
@ -79,7 +79,7 @@ pub fn compute_drop_ranges<'a, 'tcx>(
|
||||
/// result of `foo`. On the other hand, if `place` points to `x` then `f` will
|
||||
/// be called both on the `ExprKind::Path` node that represents the expression
|
||||
/// as well as the HirId of the local `x` itself.
|
||||
fn for_each_consumable<'tcx>(hir: Map<'tcx>, place: TrackedValue, mut f: impl FnMut(TrackedValue)) {
|
||||
fn for_each_consumable(hir: Map<'_>, place: TrackedValue, mut f: impl FnMut(TrackedValue)) {
|
||||
f(place);
|
||||
let node = hir.find(place.hir_id());
|
||||
if let Some(Node::Expr(expr)) = node {
|
||||
|
@ -462,8 +462,8 @@ fn fatally_break_rust(sess: &Session) {
|
||||
));
|
||||
}
|
||||
|
||||
fn has_expected_num_generic_args<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn has_expected_num_generic_args(
|
||||
tcx: TyCtxt<'_>,
|
||||
trait_did: Option<DefId>,
|
||||
expected: usize,
|
||||
) -> bool {
|
||||
|
@ -904,7 +904,7 @@ enum Op {
|
||||
}
|
||||
|
||||
/// Dereferences a single level of immutable referencing.
|
||||
fn deref_ty_if_possible<'tcx>(ty: Ty<'tcx>) -> Ty<'tcx> {
|
||||
fn deref_ty_if_possible(ty: Ty<'_>) -> Ty<'_> {
|
||||
match ty.kind() {
|
||||
ty::Ref(_, ty, hir::Mutability::Not) => *ty,
|
||||
_ => ty,
|
||||
|
@ -1675,7 +1675,7 @@ fn apply_capture_kind_on_capture_ty<'tcx>(
|
||||
}
|
||||
|
||||
/// Returns the Span of where the value with the provided HirId would be dropped
|
||||
fn drop_location_span<'tcx>(tcx: TyCtxt<'tcx>, hir_id: hir::HirId) -> Span {
|
||||
fn drop_location_span(tcx: TyCtxt<'_>, hir_id: hir::HirId) -> Span {
|
||||
let owner_id = tcx.hir().get_enclosing_scope(hir_id).unwrap();
|
||||
|
||||
let owner_node = tcx.hir().get(owner_id);
|
||||
@ -1843,10 +1843,10 @@ fn restrict_precision_for_drop_types<'a, 'tcx>(
|
||||
/// - No projections are applied to raw pointers, since these require unsafe blocks. We capture
|
||||
/// them completely.
|
||||
/// - No projections are applied on top of Union ADTs, since these require unsafe blocks.
|
||||
fn restrict_precision_for_unsafe<'tcx>(
|
||||
mut place: Place<'tcx>,
|
||||
fn restrict_precision_for_unsafe(
|
||||
mut place: Place<'_>,
|
||||
mut curr_mode: ty::UpvarCapture,
|
||||
) -> (Place<'tcx>, ty::UpvarCapture) {
|
||||
) -> (Place<'_>, ty::UpvarCapture) {
|
||||
if place.base_ty.is_unsafe_ptr() {
|
||||
truncate_place_to_len_and_update_capture_kind(&mut place, &mut curr_mode, 0);
|
||||
}
|
||||
@ -1876,10 +1876,10 @@ fn restrict_precision_for_unsafe<'tcx>(
|
||||
/// - No Index projections are captured, since arrays are captured completely.
|
||||
/// - No unsafe block is required to capture `place`
|
||||
/// Returns the truncated place and updated capture mode.
|
||||
fn restrict_capture_precision<'tcx>(
|
||||
place: Place<'tcx>,
|
||||
fn restrict_capture_precision(
|
||||
place: Place<'_>,
|
||||
curr_mode: ty::UpvarCapture,
|
||||
) -> (Place<'tcx>, ty::UpvarCapture) {
|
||||
) -> (Place<'_>, ty::UpvarCapture) {
|
||||
let (mut place, mut curr_mode) = restrict_precision_for_unsafe(place, curr_mode);
|
||||
|
||||
if place.projections.is_empty() {
|
||||
@ -1904,10 +1904,10 @@ fn restrict_capture_precision<'tcx>(
|
||||
}
|
||||
|
||||
/// Truncate deref of any reference.
|
||||
fn adjust_for_move_closure<'tcx>(
|
||||
mut place: Place<'tcx>,
|
||||
fn adjust_for_move_closure(
|
||||
mut place: Place<'_>,
|
||||
mut kind: ty::UpvarCapture,
|
||||
) -> (Place<'tcx>, ty::UpvarCapture) {
|
||||
) -> (Place<'_>, ty::UpvarCapture) {
|
||||
let first_deref = place.projections.iter().position(|proj| proj.kind == ProjectionKind::Deref);
|
||||
|
||||
if let Some(idx) = first_deref {
|
||||
@ -1919,10 +1919,10 @@ fn adjust_for_move_closure<'tcx>(
|
||||
|
||||
/// Adjust closure capture just that if taking ownership of data, only move data
|
||||
/// from enclosing stack frame.
|
||||
fn adjust_for_non_move_closure<'tcx>(
|
||||
mut place: Place<'tcx>,
|
||||
fn adjust_for_non_move_closure(
|
||||
mut place: Place<'_>,
|
||||
mut kind: ty::UpvarCapture,
|
||||
) -> (Place<'tcx>, ty::UpvarCapture) {
|
||||
) -> (Place<'_>, ty::UpvarCapture) {
|
||||
let contains_deref =
|
||||
place.projections.iter().position(|proj| proj.kind == ProjectionKind::Deref);
|
||||
|
||||
@ -2225,10 +2225,10 @@ fn determine_place_ancestry_relation<'tcx>(
|
||||
/// // it is constrained to `'a`
|
||||
/// }
|
||||
/// ```
|
||||
fn truncate_capture_for_optimization<'tcx>(
|
||||
mut place: Place<'tcx>,
|
||||
fn truncate_capture_for_optimization(
|
||||
mut place: Place<'_>,
|
||||
mut curr_mode: ty::UpvarCapture,
|
||||
) -> (Place<'tcx>, ty::UpvarCapture) {
|
||||
) -> (Place<'_>, ty::UpvarCapture) {
|
||||
let is_shared_ref = |ty: Ty<'_>| matches!(ty.kind(), ty::Ref(.., hir::Mutability::Not));
|
||||
|
||||
// Find the right-most deref (if any). All the projections that come after this
|
||||
|
@ -432,10 +432,7 @@ fn walk_between<'q>(
|
||||
}
|
||||
}
|
||||
|
||||
fn filter_edges<'q>(
|
||||
query: &'q DepGraphQuery,
|
||||
nodes: &FxHashSet<DepKind>,
|
||||
) -> Vec<(DepKind, DepKind)> {
|
||||
fn filter_edges(query: &DepGraphQuery, nodes: &FxHashSet<DepKind>) -> Vec<(DepKind, DepKind)> {
|
||||
let uniq: FxHashSet<_> = query
|
||||
.edges()
|
||||
.into_iter()
|
||||
|
@ -2199,10 +2199,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||
);
|
||||
}
|
||||
|
||||
fn binding_suggestion<'tcx, S: fmt::Display>(
|
||||
fn binding_suggestion<S: fmt::Display>(
|
||||
err: &mut Diagnostic,
|
||||
type_param_span: Option<(Span, bool)>,
|
||||
bound_kind: GenericKind<'tcx>,
|
||||
bound_kind: GenericKind<'_>,
|
||||
sub: S,
|
||||
add_lt_sugg: Option<(Span, String)>,
|
||||
) {
|
||||
|
@ -304,7 +304,7 @@ fn check_panic_str<'tcx>(
|
||||
|
||||
/// Given the span of `some_macro!(args);`, gives the span of `(` and `)`,
|
||||
/// and the type of (opening) delimiter used.
|
||||
fn find_delimiters<'tcx>(cx: &LateContext<'tcx>, span: Span) -> Option<(Span, Span, char)> {
|
||||
fn find_delimiters(cx: &LateContext<'_>, span: Span) -> Option<(Span, Span, char)> {
|
||||
let snippet = cx.sess().parse_sess.source_map().span_to_snippet(span).ok()?;
|
||||
let (open, open_ch) = snippet.char_indices().find(|&(_, c)| "([{".contains(c))?;
|
||||
let close = snippet.rfind(|c| ")]}".contains(c))?;
|
||||
|
@ -1405,7 +1405,7 @@ declare_lint! {
|
||||
/// struct S;
|
||||
///
|
||||
/// impl S {
|
||||
/// fn late<'a, 'b>(self, _: &'a u8, _: &'b u8) {}
|
||||
/// fn late(self, _: &u8, _: &u8) {}
|
||||
/// }
|
||||
///
|
||||
/// fn main() {
|
||||
|
@ -29,7 +29,7 @@ impl SubdiagnosticDeriveBuilder {
|
||||
Self { diag, f }
|
||||
}
|
||||
|
||||
pub(crate) fn into_tokens<'a>(self, mut structure: Structure<'a>) -> TokenStream {
|
||||
pub(crate) fn into_tokens(self, mut structure: Structure<'_>) -> TokenStream {
|
||||
let implementation = {
|
||||
let ast = structure.ast();
|
||||
let span = ast.span().unwrap();
|
||||
|
@ -385,7 +385,7 @@ impl quote::ToTokens for Applicability {
|
||||
|
||||
/// Build the mapping of field names to fields. This allows attributes to peek values from
|
||||
/// other fields.
|
||||
pub(super) fn build_field_mapping<'v>(variant: &VariantInfo<'v>) -> HashMap<String, TokenStream> {
|
||||
pub(super) fn build_field_mapping(variant: &VariantInfo<'_>) -> HashMap<String, TokenStream> {
|
||||
let mut fields_map = FieldMap::new();
|
||||
for binding in variant.bindings() {
|
||||
if let Some(ident) = &binding.ast().ident {
|
||||
|
@ -520,8 +520,8 @@ impl<'a> CrateLoader<'a> {
|
||||
}))
|
||||
}
|
||||
|
||||
fn resolve_crate<'b>(
|
||||
&'b mut self,
|
||||
fn resolve_crate(
|
||||
&mut self,
|
||||
name: Symbol,
|
||||
span: Span,
|
||||
dep_kind: CrateDepKind,
|
||||
|
@ -1093,7 +1093,7 @@ fn should_encode_const(def_kind: DefKind) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
fn should_encode_trait_impl_trait_tys<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
|
||||
fn should_encode_trait_impl_trait_tys(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
|
||||
if tcx.def_kind(def_id) != DefKind::AssocFn {
|
||||
return false;
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ impl DepNodeExt for DepNode {
|
||||
/// DepNode. Condition (2) might not be fulfilled if a DepNode
|
||||
/// refers to something from the previous compilation session that
|
||||
/// has been removed.
|
||||
fn extract_def_id<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Option<DefId> {
|
||||
fn extract_def_id(&self, tcx: TyCtxt<'_>) -> Option<DefId> {
|
||||
if tcx.fingerprint_style(self.kind) == FingerprintStyle::DefPathHash {
|
||||
Some(tcx.def_path_hash_to_def_id(DefPathHash(self.hash.into()), &mut || {
|
||||
panic!("Failed to extract DefId: {:?} {}", self.kind, self.hash)
|
||||
|
@ -18,7 +18,7 @@ use rustc_span::Span;
|
||||
use rustc_target::spec::abi::Abi;
|
||||
|
||||
#[inline]
|
||||
pub fn associated_body<'hir>(node: Node<'hir>) -> Option<BodyId> {
|
||||
pub fn associated_body(node: Node<'_>) -> Option<BodyId> {
|
||||
match node {
|
||||
Node::Item(Item {
|
||||
kind: ItemKind::Const(_, body) | ItemKind::Static(.., body) | ItemKind::Fn(.., body),
|
||||
@ -41,7 +41,7 @@ pub fn associated_body<'hir>(node: Node<'hir>) -> Option<BodyId> {
|
||||
}
|
||||
}
|
||||
|
||||
fn is_body_owner<'hir>(node: Node<'hir>, hir_id: HirId) -> bool {
|
||||
fn is_body_owner(node: Node<'_>, hir_id: HirId) -> bool {
|
||||
match associated_body(node) {
|
||||
Some(b) => b.hir_id == hir_id,
|
||||
None => false,
|
||||
|
@ -223,8 +223,8 @@ pub fn deprecation_message_and_lint(
|
||||
)
|
||||
}
|
||||
|
||||
pub fn early_report_deprecation<'a>(
|
||||
lint_buffer: &'a mut LintBuffer,
|
||||
pub fn early_report_deprecation(
|
||||
lint_buffer: &mut LintBuffer,
|
||||
message: &str,
|
||||
suggestion: Option<Symbol>,
|
||||
lint: &'static Lint,
|
||||
|
@ -1767,9 +1767,9 @@ impl SourceScope {
|
||||
/// Finds the original HirId this MIR item came from.
|
||||
/// This is necessary after MIR optimizations, as otherwise we get a HirId
|
||||
/// from the function that was inlined instead of the function call site.
|
||||
pub fn lint_root<'tcx>(
|
||||
pub fn lint_root(
|
||||
self,
|
||||
source_scopes: &IndexVec<SourceScope, SourceScopeData<'tcx>>,
|
||||
source_scopes: &IndexVec<SourceScope, SourceScopeData<'_>>,
|
||||
) -> Option<HirId> {
|
||||
let mut data = &source_scopes[self];
|
||||
// FIXME(oli-obk): we should be able to just walk the `inlined_parent_scope`, but it
|
||||
|
@ -88,7 +88,7 @@ pub fn dump_mir<'tcx, F>(
|
||||
dump_matched_mir_node(tcx, pass_num, pass_name, disambiguator, body, extra_data);
|
||||
}
|
||||
|
||||
pub fn dump_enabled<'tcx>(tcx: TyCtxt<'tcx>, pass_name: &str, def_id: DefId) -> bool {
|
||||
pub fn dump_enabled(tcx: TyCtxt<'_>, pass_name: &str, def_id: DefId) -> bool {
|
||||
let Some(ref filters) = tcx.sess.opts.unstable_opts.dump_mir else {
|
||||
return false;
|
||||
};
|
||||
@ -421,7 +421,7 @@ impl<'tcx> ExtraComments<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn use_verbose<'tcx>(ty: Ty<'tcx>, fn_def: bool) -> bool {
|
||||
fn use_verbose(ty: Ty<'_>, fn_def: bool) -> bool {
|
||||
match *ty.kind() {
|
||||
ty::Int(_) | ty::Uint(_) | ty::Bool | ty::Char | ty::Float(_) => false,
|
||||
// Unit type
|
||||
|
@ -230,7 +230,7 @@ where
|
||||
}
|
||||
|
||||
/// Format a string showing the start line and column, and end line and column within a file.
|
||||
pub fn source_range_no_file<'tcx>(tcx: TyCtxt<'tcx>, span: Span) -> String {
|
||||
pub fn source_range_no_file(tcx: TyCtxt<'_>, span: Span) -> String {
|
||||
let source_map = tcx.sess.source_map();
|
||||
let start = source_map.lookup_char_pos(span.lo());
|
||||
let end = source_map.lookup_char_pos(span.hi());
|
||||
@ -322,7 +322,7 @@ fn block_span_viewable<'tcx>(
|
||||
Some(SpanViewable { bb, span, id, tooltip })
|
||||
}
|
||||
|
||||
fn compute_block_span<'tcx>(data: &BasicBlockData<'tcx>, body_span: Span) -> Span {
|
||||
fn compute_block_span(data: &BasicBlockData<'_>, body_span: Span) -> Span {
|
||||
let mut span = data.terminator().source_info.span;
|
||||
for statement_span in data.statements.iter().map(|statement| statement.source_info.span) {
|
||||
// Only combine Spans from the root context, and within the function's body_span.
|
||||
@ -522,12 +522,7 @@ where
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn write_coverage_gap<'tcx, W>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
lo: BytePos,
|
||||
hi: BytePos,
|
||||
w: &mut W,
|
||||
) -> io::Result<()>
|
||||
fn write_coverage_gap<W>(tcx: TyCtxt<'_>, lo: BytePos, hi: BytePos, w: &mut W) -> io::Result<()>
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
@ -582,8 +577,8 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn make_html_snippet<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn make_html_snippet(
|
||||
tcx: TyCtxt<'_>,
|
||||
span: Span,
|
||||
some_viewable: Option<&SpanViewable>,
|
||||
) -> Option<String> {
|
||||
@ -664,7 +659,7 @@ fn trim_span_hi(span: Span, to_pos: BytePos) -> Span {
|
||||
if to_pos >= span.hi() { span } else { span.with_hi(cmp::max(span.lo(), to_pos)) }
|
||||
}
|
||||
|
||||
fn fn_span<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Span {
|
||||
fn fn_span(tcx: TyCtxt<'_>, def_id: DefId) -> Span {
|
||||
let fn_decl_span = tcx.def_span(def_id);
|
||||
if let Some(body_span) = hir_body(tcx, def_id).map(|hir_body| hir_body.value.span) {
|
||||
if fn_decl_span.eq_ctxt(body_span) { fn_decl_span.to(body_span) } else { body_span }
|
||||
@ -673,7 +668,7 @@ fn fn_span<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Span {
|
||||
}
|
||||
}
|
||||
|
||||
fn hir_body<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<&'tcx rustc_hir::Body<'tcx>> {
|
||||
fn hir_body(tcx: TyCtxt<'_>, def_id: DefId) -> Option<&rustc_hir::Body<'_>> {
|
||||
let hir_node = tcx.hir().get_if_local(def_id).expect("expected DefId is local");
|
||||
hir::map::associated_body(hir_node).map(|fn_body_id| tcx.hir().body(fn_body_id))
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ pub fn reachable<'a, 'tcx>(
|
||||
}
|
||||
|
||||
/// Returns a `BitSet` containing all basic blocks reachable from the `START_BLOCK`.
|
||||
pub fn reachable_as_bitset<'tcx>(body: &Body<'tcx>) -> BitSet<BasicBlock> {
|
||||
pub fn reachable_as_bitset(body: &Body<'_>) -> BitSet<BasicBlock> {
|
||||
let mut iter = preorder(body);
|
||||
(&mut iter).for_each(drop);
|
||||
iter.visited
|
||||
|
@ -210,7 +210,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
Box::new(chalk_ir::TyData { kind: ty, flags: flags })
|
||||
}
|
||||
|
||||
fn ty_data<'a>(self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData<Self> {
|
||||
fn ty_data(self, ty: &Self::InternedType) -> &chalk_ir::TyData<Self> {
|
||||
ty
|
||||
}
|
||||
|
||||
@ -218,10 +218,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
Box::new(lifetime)
|
||||
}
|
||||
|
||||
fn lifetime_data<'a>(
|
||||
self,
|
||||
lifetime: &'a Self::InternedLifetime,
|
||||
) -> &'a chalk_ir::LifetimeData<Self> {
|
||||
fn lifetime_data(self, lifetime: &Self::InternedLifetime) -> &chalk_ir::LifetimeData<Self> {
|
||||
&lifetime
|
||||
}
|
||||
|
||||
@ -229,7 +226,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
Box::new(constant)
|
||||
}
|
||||
|
||||
fn const_data<'a>(self, constant: &'a Self::InternedConst) -> &'a chalk_ir::ConstData<Self> {
|
||||
fn const_data(self, constant: &Self::InternedConst) -> &chalk_ir::ConstData<Self> {
|
||||
&constant
|
||||
}
|
||||
|
||||
@ -246,10 +243,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
Box::new(data)
|
||||
}
|
||||
|
||||
fn generic_arg_data<'a>(
|
||||
self,
|
||||
data: &'a Self::InternedGenericArg,
|
||||
) -> &'a chalk_ir::GenericArgData<Self> {
|
||||
fn generic_arg_data(self, data: &Self::InternedGenericArg) -> &chalk_ir::GenericArgData<Self> {
|
||||
&data
|
||||
}
|
||||
|
||||
@ -257,7 +251,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
Box::new(goal)
|
||||
}
|
||||
|
||||
fn goal_data<'a>(self, goal: &'a Self::InternedGoal) -> &'a chalk_ir::GoalData<Self> {
|
||||
fn goal_data(self, goal: &Self::InternedGoal) -> &chalk_ir::GoalData<Self> {
|
||||
&goal
|
||||
}
|
||||
|
||||
@ -268,7 +262,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn goals_data<'a>(self, goals: &'a Self::InternedGoals) -> &'a [chalk_ir::Goal<Self>] {
|
||||
fn goals_data(self, goals: &Self::InternedGoals) -> &[chalk_ir::Goal<Self>] {
|
||||
goals
|
||||
}
|
||||
|
||||
@ -279,10 +273,10 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn substitution_data<'a>(
|
||||
fn substitution_data(
|
||||
self,
|
||||
substitution: &'a Self::InternedSubstitution,
|
||||
) -> &'a [chalk_ir::GenericArg<Self>] {
|
||||
substitution: &Self::InternedSubstitution,
|
||||
) -> &[chalk_ir::GenericArg<Self>] {
|
||||
substitution
|
||||
}
|
||||
|
||||
@ -293,10 +287,10 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
Box::new(data)
|
||||
}
|
||||
|
||||
fn program_clause_data<'a>(
|
||||
fn program_clause_data(
|
||||
self,
|
||||
clause: &'a Self::InternedProgramClause,
|
||||
) -> &'a chalk_ir::ProgramClauseData<Self> {
|
||||
clause: &Self::InternedProgramClause,
|
||||
) -> &chalk_ir::ProgramClauseData<Self> {
|
||||
&clause
|
||||
}
|
||||
|
||||
@ -307,10 +301,10 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn program_clauses_data<'a>(
|
||||
fn program_clauses_data(
|
||||
self,
|
||||
clauses: &'a Self::InternedProgramClauses,
|
||||
) -> &'a [chalk_ir::ProgramClause<Self>] {
|
||||
clauses: &Self::InternedProgramClauses,
|
||||
) -> &[chalk_ir::ProgramClause<Self>] {
|
||||
clauses
|
||||
}
|
||||
|
||||
@ -321,10 +315,10 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn quantified_where_clauses_data<'a>(
|
||||
fn quantified_where_clauses_data(
|
||||
self,
|
||||
clauses: &'a Self::InternedQuantifiedWhereClauses,
|
||||
) -> &'a [chalk_ir::QuantifiedWhereClause<Self>] {
|
||||
clauses: &Self::InternedQuantifiedWhereClauses,
|
||||
) -> &[chalk_ir::QuantifiedWhereClause<Self>] {
|
||||
clauses
|
||||
}
|
||||
|
||||
@ -335,10 +329,10 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn variable_kinds_data<'a>(
|
||||
fn variable_kinds_data(
|
||||
self,
|
||||
parameter_kinds: &'a Self::InternedVariableKinds,
|
||||
) -> &'a [chalk_ir::VariableKind<Self>] {
|
||||
parameter_kinds: &Self::InternedVariableKinds,
|
||||
) -> &[chalk_ir::VariableKind<Self>] {
|
||||
parameter_kinds
|
||||
}
|
||||
|
||||
@ -349,10 +343,10 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn canonical_var_kinds_data<'a>(
|
||||
fn canonical_var_kinds_data(
|
||||
self,
|
||||
canonical_var_kinds: &'a Self::InternedCanonicalVarKinds,
|
||||
) -> &'a [chalk_ir::CanonicalVarKind<Self>] {
|
||||
canonical_var_kinds: &Self::InternedCanonicalVarKinds,
|
||||
) -> &[chalk_ir::CanonicalVarKind<Self>] {
|
||||
canonical_var_kinds
|
||||
}
|
||||
|
||||
@ -363,10 +357,10 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn constraints_data<'a>(
|
||||
fn constraints_data(
|
||||
self,
|
||||
constraints: &'a Self::InternedConstraints,
|
||||
) -> &'a [chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>] {
|
||||
constraints: &Self::InternedConstraints,
|
||||
) -> &[chalk_ir::InEnvironment<chalk_ir::Constraint<Self>>] {
|
||||
constraints
|
||||
}
|
||||
|
||||
@ -377,10 +371,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
|
||||
data.into_iter().collect::<Result<Vec<_>, _>>()
|
||||
}
|
||||
|
||||
fn variances_data<'a>(
|
||||
self,
|
||||
variances: &'a Self::InternedVariances,
|
||||
) -> &'a [chalk_ir::Variance] {
|
||||
fn variances_data(self, variances: &Self::InternedVariances) -> &[chalk_ir::Variance] {
|
||||
variances
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ pub enum OverlapMode {
|
||||
}
|
||||
|
||||
impl OverlapMode {
|
||||
pub fn get<'tcx>(tcx: TyCtxt<'tcx>, trait_id: DefId) -> OverlapMode {
|
||||
pub fn get(tcx: TyCtxt<'_>, trait_id: DefId) -> OverlapMode {
|
||||
let with_negative_coherence = tcx.features().with_negative_coherence;
|
||||
let strict_coherence = tcx.has_attr(trait_id, sym::rustc_strict_coherence);
|
||||
|
||||
@ -254,11 +254,11 @@ impl<'tcx> Ancestors<'tcx> {
|
||||
///
|
||||
/// Returns `Err` if an error was reported while building the specialization
|
||||
/// graph.
|
||||
pub fn ancestors<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub fn ancestors(
|
||||
tcx: TyCtxt<'_>,
|
||||
trait_def_id: DefId,
|
||||
start_from_impl: DefId,
|
||||
) -> Result<Ancestors<'tcx>, ErrorGuaranteed> {
|
||||
) -> Result<Ancestors<'_>, ErrorGuaranteed> {
|
||||
let specialization_graph = tcx.specialization_graph_of(trait_def_id);
|
||||
|
||||
if let Some(reported) = specialization_graph.has_errored {
|
||||
|
@ -238,10 +238,7 @@ impl<'tcx> CapturedPlace<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn symbols_for_closure_captures<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def_id: (LocalDefId, LocalDefId),
|
||||
) -> Vec<Symbol> {
|
||||
fn symbols_for_closure_captures(tcx: TyCtxt<'_>, def_id: (LocalDefId, LocalDefId)) -> Vec<Symbol> {
|
||||
let typeck_results = tcx.typeck(def_id.0);
|
||||
let captures = typeck_results.closure_min_captures_flattened(def_id.1);
|
||||
captures.into_iter().map(|captured_place| captured_place.to_symbol(tcx)).collect()
|
||||
|
@ -239,7 +239,7 @@ impl<'tcx> Const<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn const_param_default<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Const<'tcx> {
|
||||
pub fn const_param_default(tcx: TyCtxt<'_>, def_id: DefId) -> Const<'_> {
|
||||
let default_def_id = match tcx.hir().get_by_def_id(def_id.expect_local()) {
|
||||
hir::Node::GenericParam(hir::GenericParam {
|
||||
kind: hir::GenericParamKind::Const { default: Some(ac), .. },
|
||||
|
@ -232,7 +232,7 @@ impl ScalarInt {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn try_to_machine_usize<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Result<u64, Size> {
|
||||
pub fn try_to_machine_usize(&self, tcx: TyCtxt<'_>) -> Result<u64, Size> {
|
||||
Ok(self.to_bits(tcx.data_layout.pointer_size)? as u64)
|
||||
}
|
||||
|
||||
|
@ -1518,7 +1518,7 @@ impl<'tcx, T: 'tcx + ?Sized> IntoPointer for InternedInSet<'tcx, T> {
|
||||
|
||||
#[allow(rustc::usage_of_ty_tykind)]
|
||||
impl<'tcx, T> Borrow<T> for InternedInSet<'tcx, WithCachedTypeInfo<T>> {
|
||||
fn borrow<'a>(&'a self) -> &'a T {
|
||||
fn borrow(&self) -> &T {
|
||||
&self.0.internee
|
||||
}
|
||||
}
|
||||
@ -1541,7 +1541,7 @@ impl<'tcx, T: Hash> Hash for InternedInSet<'tcx, WithCachedTypeInfo<T>> {
|
||||
}
|
||||
|
||||
impl<'tcx, T> Borrow<[T]> for InternedInSet<'tcx, List<T>> {
|
||||
fn borrow<'a>(&'a self) -> &'a [T] {
|
||||
fn borrow(&self) -> &[T] {
|
||||
&self.0[..]
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ impl FlagComputation {
|
||||
result
|
||||
}
|
||||
|
||||
pub fn for_predicate<'tcx>(binder: ty::Binder<'tcx, ty::PredicateKind<'_>>) -> FlagComputation {
|
||||
pub fn for_predicate(binder: ty::Binder<'_, ty::PredicateKind<'_>>) -> FlagComputation {
|
||||
let mut result = FlagComputation::new();
|
||||
result.add_predicate(binder);
|
||||
result
|
||||
|
@ -993,7 +993,7 @@ where
|
||||
/// might (from a foreign exception or similar).
|
||||
#[inline]
|
||||
#[tracing::instrument(level = "debug", skip(tcx))]
|
||||
pub fn fn_can_unwind<'tcx>(tcx: TyCtxt<'tcx>, fn_def_id: Option<DefId>, abi: SpecAbi) -> bool {
|
||||
pub fn fn_can_unwind(tcx: TyCtxt<'_>, fn_def_id: Option<DefId>, abi: SpecAbi) -> bool {
|
||||
if let Some(did) = fn_def_id {
|
||||
// Special attribute for functions which can't unwind.
|
||||
if tcx.codegen_fn_attrs(did).flags.contains(CodegenFnAttrFlags::NEVER_UNWIND) {
|
||||
|
@ -1248,7 +1248,7 @@ pub fn needs_drop_components<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_trivially_const_drop<'tcx>(ty: Ty<'tcx>) -> bool {
|
||||
pub fn is_trivially_const_drop(ty: Ty<'_>) -> bool {
|
||||
match *ty.kind() {
|
||||
ty::Bool
|
||||
| ty::Char
|
||||
|
@ -81,8 +81,8 @@ pub(in crate::build) struct PlaceBuilder<'tcx> {
|
||||
/// ProjectionElems `Downcast`, `ConstantIndex`, `Index`, or `Subslice` because those will never be
|
||||
/// part of a path that is captured by a closure. We stop applying projections once we see the first
|
||||
/// projection that isn't captured by a closure.
|
||||
fn convert_to_hir_projections_and_truncate_for_capture<'tcx>(
|
||||
mir_projections: &[PlaceElem<'tcx>],
|
||||
fn convert_to_hir_projections_and_truncate_for_capture(
|
||||
mir_projections: &[PlaceElem<'_>],
|
||||
) -> Vec<HirProjectionKind> {
|
||||
let mut hir_projections = Vec::new();
|
||||
let mut variant = None;
|
||||
|
@ -28,10 +28,10 @@ use rustc_target::spec::abi::Abi;
|
||||
|
||||
use super::lints;
|
||||
|
||||
pub(crate) fn mir_built<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(crate) fn mir_built(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx rustc_data_structures::steal::Steal<Body<'tcx>> {
|
||||
) -> &rustc_data_structures::steal::Steal<Body<'_>> {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_built(def);
|
||||
}
|
||||
@ -625,12 +625,12 @@ fn construct_const<'a, 'tcx>(
|
||||
///
|
||||
/// This is required because we may still want to run MIR passes on an item
|
||||
/// with type errors, but normal MIR construction can't handle that in general.
|
||||
fn construct_error<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn construct_error(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: LocalDefId,
|
||||
body_owner_kind: hir::BodyOwnerKind,
|
||||
err: ErrorGuaranteed,
|
||||
) -> Body<'tcx> {
|
||||
) -> Body<'_> {
|
||||
let span = tcx.def_span(def);
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def);
|
||||
let generator_kind = tcx.generator_kind(def);
|
||||
|
@ -703,7 +703,7 @@ impl UnsafeOpKind {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalDefId>) {
|
||||
pub fn check_unsafety(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) {
|
||||
// THIR unsafeck is gated under `-Z thir-unsafeck`
|
||||
if !tcx.sess.opts.unstable_opts.thir_unsafeck {
|
||||
return;
|
||||
@ -749,7 +749,7 @@ pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def: ty::WithOptConstParam<LocalD
|
||||
visitor.visit_expr(&thir[expr]);
|
||||
}
|
||||
|
||||
pub(crate) fn thir_check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
pub(crate) fn thir_check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) {
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(def_id, tcx) {
|
||||
tcx.thir_check_unsafety_for_const_arg(def)
|
||||
} else {
|
||||
@ -757,8 +757,8 @@ pub(crate) fn thir_check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn thir_check_unsafety_for_const_arg<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(crate) fn thir_check_unsafety_for_const_arg(
|
||||
tcx: TyCtxt<'_>,
|
||||
(did, param_did): (LocalDefId, DefId),
|
||||
) {
|
||||
check_unsafety(tcx, ty::WithOptConstParam { did, const_param_did: Some(param_did) })
|
||||
|
@ -18,10 +18,10 @@ use rustc_middle::thir::*;
|
||||
use rustc_middle::ty::{self, RvalueScopes, TyCtxt};
|
||||
use rustc_span::Span;
|
||||
|
||||
pub(crate) fn thir_body<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub(crate) fn thir_body(
|
||||
tcx: TyCtxt<'_>,
|
||||
owner_def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> Result<(&'tcx Steal<Thir<'tcx>>, ExprId), ErrorGuaranteed> {
|
||||
) -> Result<(&Steal<Thir<'_>>, ExprId), ErrorGuaranteed> {
|
||||
let hir = tcx.hir();
|
||||
let body = hir.body(hir.body_owned_by(owner_def.did));
|
||||
let mut cx = Cx::new(tcx, owner_def);
|
||||
@ -52,10 +52,7 @@ pub(crate) fn thir_body<'tcx>(
|
||||
Ok((tcx.alloc_steal_thir(cx.thir), expr))
|
||||
}
|
||||
|
||||
pub(crate) fn thir_tree<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
owner_def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> String {
|
||||
pub(crate) fn thir_tree(tcx: TyCtxt<'_>, owner_def: ty::WithOptConstParam<LocalDefId>) -> String {
|
||||
match thir_body(tcx, owner_def) {
|
||||
Ok((thir, _)) => format!("{:#?}", thir.steal()),
|
||||
Err(_) => "error".into(),
|
||||
|
@ -70,7 +70,7 @@ mod fallback_to_const_ref {
|
||||
/// hoops to get a reference to the value.
|
||||
pub(super) struct FallbackToConstRef(());
|
||||
|
||||
pub(super) fn fallback_to_const_ref<'tcx>(c2p: &super::ConstToPat<'tcx>) -> FallbackToConstRef {
|
||||
pub(super) fn fallback_to_const_ref(c2p: &super::ConstToPat<'_>) -> FallbackToConstRef {
|
||||
assert!(c2p.behind_reference.get());
|
||||
FallbackToConstRef(())
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ impl SplitIntRange {
|
||||
}
|
||||
|
||||
/// Iterate over the contained ranges.
|
||||
fn iter<'a>(&'a self) -> impl Iterator<Item = IntRange> + Captures<'a> {
|
||||
fn iter(&self) -> impl Iterator<Item = IntRange> + Captures<'_> {
|
||||
use IntBorder::*;
|
||||
|
||||
let self_range = Self::to_borders(self.range.clone());
|
||||
@ -612,7 +612,7 @@ impl SplitVarLenSlice {
|
||||
}
|
||||
|
||||
/// Iterate over the partition of this slice.
|
||||
fn iter<'a>(&'a self) -> impl Iterator<Item = Slice> + Captures<'a> {
|
||||
fn iter(&self) -> impl Iterator<Item = Slice> + Captures<'_> {
|
||||
let smaller_lengths = match self.array_len {
|
||||
// The only admissible fixed-length slice is one of the array size. Whether `max_slice`
|
||||
// is fixed-length or variable-length, it will be the only relevant slice to output
|
||||
|
@ -149,7 +149,7 @@ enum DefUse {
|
||||
}
|
||||
|
||||
impl DefUse {
|
||||
fn apply<'tcx>(trans: &mut impl GenKill<Local>, place: Place<'tcx>, context: PlaceContext) {
|
||||
fn apply(trans: &mut impl GenKill<Local>, place: Place<'_>, context: PlaceContext) {
|
||||
match DefUse::for_place(place, context) {
|
||||
Some(DefUse::Def) => trans.kill(place.local),
|
||||
Some(DefUse::Use) => trans.gen(place.local),
|
||||
@ -157,7 +157,7 @@ impl DefUse {
|
||||
}
|
||||
}
|
||||
|
||||
fn for_place<'tcx>(place: Place<'tcx>, context: PlaceContext) -> Option<DefUse> {
|
||||
fn for_place(place: Place<'_>, context: PlaceContext) -> Option<DefUse> {
|
||||
match context {
|
||||
PlaceContext::NonUse(_) => None,
|
||||
|
||||
|
@ -823,7 +823,7 @@ fn iter_fields<'tcx>(
|
||||
}
|
||||
|
||||
/// Returns all locals with projections that have their reference or address taken.
|
||||
fn excluded_locals<'tcx>(body: &Body<'tcx>) -> IndexVec<Local, bool> {
|
||||
fn excluded_locals(body: &Body<'_>) -> IndexVec<Local, bool> {
|
||||
struct Collector {
|
||||
result: IndexVec<Local, bool>,
|
||||
}
|
||||
|
@ -490,10 +490,10 @@ fn check_unused_unsafe(
|
||||
unused_unsafes
|
||||
}
|
||||
|
||||
fn unsafety_check_result<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn unsafety_check_result(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx UnsafetyCheckResult {
|
||||
) -> &UnsafetyCheckResult {
|
||||
debug!("unsafety_violations({:?})", def);
|
||||
|
||||
// N.B., this borrow is valid because all the consumers of
|
||||
|
@ -533,10 +533,10 @@ fn make_code_region(
|
||||
}
|
||||
}
|
||||
|
||||
fn fn_sig_and_body<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn fn_sig_and_body(
|
||||
tcx: TyCtxt<'_>,
|
||||
def_id: DefId,
|
||||
) -> (Option<&'tcx rustc_hir::FnSig<'tcx>>, &'tcx rustc_hir::Body<'tcx>) {
|
||||
) -> (Option<&rustc_hir::FnSig<'_>>, &rustc_hir::Body<'_>) {
|
||||
// FIXME(#79625): Consider improving MIR to provide the information needed, to avoid going back
|
||||
// to HIR for it.
|
||||
let hir_node = tcx.hir().get_if_local(def_id).expect("expected DefId is local");
|
||||
|
@ -136,7 +136,7 @@ fn coverageinfo<'tcx>(tcx: TyCtxt<'tcx>, instance_def: ty::InstanceDef<'tcx>) ->
|
||||
coverage_visitor.info
|
||||
}
|
||||
|
||||
fn covered_code_regions<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Vec<&'tcx CodeRegion> {
|
||||
fn covered_code_regions(tcx: TyCtxt<'_>, def_id: DefId) -> Vec<&CodeRegion> {
|
||||
let body = mir_body(tcx, def_id);
|
||||
body.basic_blocks
|
||||
.iter()
|
||||
@ -163,7 +163,7 @@ fn is_inlined(body: &Body<'_>, statement: &Statement<'_>) -> bool {
|
||||
/// This function ensures we obtain the correct MIR for the given item irrespective of
|
||||
/// whether that means const mir or runtime mir. For `const fn` this opts for runtime
|
||||
/// mir.
|
||||
fn mir_body<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx mir::Body<'tcx> {
|
||||
fn mir_body(tcx: TyCtxt<'_>, def_id: DefId) -> &mir::Body<'_> {
|
||||
let id = ty::WithOptConstParam::unknown(def_id);
|
||||
let def = ty::InstanceDef::Item(id);
|
||||
tcx.instance_mir(def)
|
||||
|
@ -169,7 +169,7 @@ impl<'tcx> MockBlocks<'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
fn debug_basic_blocks<'tcx>(mir_body: &Body<'tcx>) -> String {
|
||||
fn debug_basic_blocks(mir_body: &Body<'_>) -> String {
|
||||
format!(
|
||||
"{:?}",
|
||||
mir_body
|
||||
|
@ -129,7 +129,7 @@ impl<'tcx> Visitor<'tcx> for DeduceReadOnly {
|
||||
}
|
||||
|
||||
/// Returns true if values of a given type will never be passed indirectly, regardless of ABI.
|
||||
fn type_will_always_be_passed_directly<'tcx>(ty: Ty<'tcx>) -> bool {
|
||||
fn type_will_always_be_passed_directly(ty: Ty<'_>) -> bool {
|
||||
matches!(
|
||||
ty.kind(),
|
||||
ty::Bool
|
||||
|
@ -658,7 +658,7 @@ impl WriteInfo {
|
||||
}
|
||||
}
|
||||
|
||||
fn add_place<'tcx>(&mut self, place: Place<'tcx>) {
|
||||
fn add_place(&mut self, place: Place<'_>) {
|
||||
self.writes.push(place.local);
|
||||
}
|
||||
|
||||
|
@ -266,10 +266,7 @@ fn mir_const_qualif(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) ->
|
||||
/// Make MIR ready for const evaluation. This is run on all MIR, not just on consts!
|
||||
/// FIXME(oli-obk): it's unclear whether we still need this phase (and its corresponding query).
|
||||
/// We used to have this for pre-miri MIR based const eval.
|
||||
fn mir_const<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx Steal<Body<'tcx>> {
|
||||
fn mir_const(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -> &Steal<Body<'_>> {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_const(def);
|
||||
}
|
||||
@ -308,10 +305,10 @@ fn mir_const<'tcx>(
|
||||
}
|
||||
|
||||
/// Compute the main MIR body and the list of MIR bodies of the promoteds.
|
||||
fn mir_promoted<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn mir_promoted(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> (&'tcx Steal<Body<'tcx>>, &'tcx Steal<IndexVec<Promoted, Body<'tcx>>>) {
|
||||
) -> (&Steal<Body<'_>>, &Steal<IndexVec<Promoted, Body<'_>>>) {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_promoted(def);
|
||||
}
|
||||
@ -350,7 +347,7 @@ fn mir_promoted<'tcx>(
|
||||
}
|
||||
|
||||
/// Compute the MIR that is used during CTFE (and thus has no optimizations run on it)
|
||||
fn mir_for_ctfe<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Body<'tcx> {
|
||||
fn mir_for_ctfe(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
|
||||
let did = def_id.expect_local();
|
||||
if let Some(def) = ty::WithOptConstParam::try_lookup(did, tcx) {
|
||||
tcx.mir_for_ctfe_of_const_arg(def)
|
||||
@ -364,10 +361,7 @@ fn mir_for_ctfe<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Body<'tcx> {
|
||||
/// we'd get cycle errors with `mir_for_ctfe`, because typeck would need to typeck
|
||||
/// the const parameter while type checking the main body, which in turn would try
|
||||
/// to type check the main body again.
|
||||
fn mir_for_ctfe_of_const_arg<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
(did, param_did): (LocalDefId, DefId),
|
||||
) -> &'tcx Body<'tcx> {
|
||||
fn mir_for_ctfe_of_const_arg(tcx: TyCtxt<'_>, (did, param_did): (LocalDefId, DefId)) -> &Body<'_> {
|
||||
tcx.arena.alloc(inner_mir_for_ctfe(
|
||||
tcx,
|
||||
ty::WithOptConstParam { did, const_param_did: Some(param_did) },
|
||||
@ -424,10 +418,10 @@ fn inner_mir_for_ctfe(tcx: TyCtxt<'_>, def: ty::WithOptConstParam<LocalDefId>) -
|
||||
/// Obtain just the main MIR (no promoteds) and run some cleanups on it. This also runs
|
||||
/// mir borrowck *before* doing so in order to ensure that borrowck can be run and doesn't
|
||||
/// end up missing the source MIR due to stealing happening.
|
||||
fn mir_drops_elaborated_and_const_checked<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn mir_drops_elaborated_and_const_checked(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx Steal<Body<'tcx>> {
|
||||
) -> &Steal<Body<'_>> {
|
||||
if let Some(def) = def.try_upgrade(tcx) {
|
||||
return tcx.mir_drops_elaborated_and_const_checked(def);
|
||||
}
|
||||
@ -597,7 +591,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
|
||||
}
|
||||
|
||||
/// Optimize the MIR and prepare it for codegen.
|
||||
fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx>, did: DefId) -> &'tcx Body<'tcx> {
|
||||
fn optimized_mir(tcx: TyCtxt<'_>, did: DefId) -> &Body<'_> {
|
||||
let did = did.expect_local();
|
||||
assert_eq!(ty::WithOptConstParam::try_lookup(did, tcx), None);
|
||||
tcx.arena.alloc(inner_optimized_mir(tcx, did))
|
||||
@ -634,10 +628,10 @@ fn inner_optimized_mir(tcx: TyCtxt<'_>, did: LocalDefId) -> Body<'_> {
|
||||
|
||||
/// Fetch all the promoteds of an item and prepare their MIR bodies to be ready for
|
||||
/// constant evaluation once all substitutions become known.
|
||||
fn promoted_mir<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn promoted_mir(
|
||||
tcx: TyCtxt<'_>,
|
||||
def: ty::WithOptConstParam<LocalDefId>,
|
||||
) -> &'tcx IndexVec<Promoted, Body<'tcx>> {
|
||||
) -> &IndexVec<Promoted, Body<'_>> {
|
||||
if tcx.is_constructor(def.did.to_def_id()) {
|
||||
return tcx.arena.alloc(IndexVec::new());
|
||||
}
|
||||
|
@ -532,7 +532,7 @@ struct VarField<'tcx> {
|
||||
}
|
||||
|
||||
/// Match on `((_LOCAL as Variant).FIELD: TY)`.
|
||||
fn match_variant_field_place<'tcx>(place: Place<'tcx>) -> Option<(Local, VarField<'tcx>)> {
|
||||
fn match_variant_field_place(place: Place<'_>) -> Option<(Local, VarField<'_>)> {
|
||||
match place.as_ref() {
|
||||
PlaceRef {
|
||||
local,
|
||||
|
@ -345,10 +345,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn collect_and_partition_mono_items<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
(): (),
|
||||
) -> (&'tcx DefIdSet, &'tcx [CodegenUnit<'tcx>]) {
|
||||
fn collect_and_partition_mono_items(tcx: TyCtxt<'_>, (): ()) -> (&DefIdSet, &[CodegenUnit<'_>]) {
|
||||
let collection_mode = match tcx.sess.opts.unstable_opts.print_mono_items {
|
||||
Some(ref s) => {
|
||||
let mode_string = s.to_lowercase();
|
||||
@ -541,7 +538,7 @@ fn dump_mono_items_stats<'tcx>(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn codegened_and_inlined_items<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> &'tcx DefIdSet {
|
||||
fn codegened_and_inlined_items(tcx: TyCtxt<'_>, (): ()) -> &DefIdSet {
|
||||
let (items, cgus) = tcx.collect_and_partition_mono_items(());
|
||||
let mut visited = DefIdSet::default();
|
||||
let mut result = items.clone();
|
||||
|
@ -571,7 +571,7 @@ fn check_item<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, worklist: &mut Vec<LocalDefId>, id: hir::TraitItemId) {
|
||||
fn check_trait_item(tcx: TyCtxt<'_>, worklist: &mut Vec<LocalDefId>, id: hir::TraitItemId) {
|
||||
use hir::TraitItemKind::{Const, Fn};
|
||||
if matches!(tcx.def_kind(id.owner_id), DefKind::AssocConst | DefKind::AssocFn) {
|
||||
let trait_item = tcx.hir().trait_item(id);
|
||||
@ -583,11 +583,7 @@ fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, worklist: &mut Vec<LocalDefId>, id:
|
||||
}
|
||||
}
|
||||
|
||||
fn check_foreign_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
worklist: &mut Vec<LocalDefId>,
|
||||
id: hir::ForeignItemId,
|
||||
) {
|
||||
fn check_foreign_item(tcx: TyCtxt<'_>, worklist: &mut Vec<LocalDefId>, id: hir::ForeignItemId) {
|
||||
if matches!(tcx.def_kind(id.owner_id), DefKind::Static(_) | DefKind::Fn)
|
||||
&& has_allow_dead_code_or_lang_attr(tcx, id.hir_id())
|
||||
{
|
||||
@ -595,8 +591,8 @@ fn check_foreign_item<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn create_and_seed_worklist<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn create_and_seed_worklist(
|
||||
tcx: TyCtxt<'_>,
|
||||
) -> (Vec<LocalDefId>, FxHashMap<LocalDefId, LocalDefId>) {
|
||||
let effective_visibilities = &tcx.effective_visibilities(());
|
||||
// see `MarkSymbolVisitor::struct_constructors`
|
||||
@ -626,8 +622,8 @@ fn create_and_seed_worklist<'tcx>(
|
||||
(worklist, struct_constructors)
|
||||
}
|
||||
|
||||
fn live_symbols_and_ignored_derived_traits<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn live_symbols_and_ignored_derived_traits(
|
||||
tcx: TyCtxt<'_>,
|
||||
(): (),
|
||||
) -> (FxHashSet<LocalDefId>, FxHashMap<LocalDefId, Vec<(DefId, DefId)>>) {
|
||||
let (worklist, struct_constructors) = create_and_seed_worklist(tcx);
|
||||
|
@ -15,8 +15,8 @@ use std::sync::Arc;
|
||||
|
||||
use crate::errors::DebugVisualizerUnreadable;
|
||||
|
||||
fn check_for_debugger_visualizer<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
fn check_for_debugger_visualizer(
|
||||
tcx: TyCtxt<'_>,
|
||||
hir_id: HirId,
|
||||
debugger_visualizers: &mut FxHashSet<DebuggerVisualizerFile>,
|
||||
) {
|
||||
@ -69,7 +69,7 @@ fn check_for_debugger_visualizer<'tcx>(
|
||||
}
|
||||
|
||||
/// Traverses and collects the debugger visualizers for a specific crate.
|
||||
fn debugger_visualizers<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> Vec<DebuggerVisualizerFile> {
|
||||
fn debugger_visualizers(tcx: TyCtxt<'_>, cnum: CrateNum) -> Vec<DebuggerVisualizerFile> {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
// Initialize the collector.
|
||||
|
@ -18,11 +18,7 @@ use rustc_span::symbol::{kw::Empty, sym, Symbol};
|
||||
|
||||
use crate::errors::{DuplicateDiagnosticItem, DuplicateDiagnosticItemInCrate};
|
||||
|
||||
fn observe_item<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
diagnostic_items: &mut DiagnosticItems,
|
||||
def_id: LocalDefId,
|
||||
) {
|
||||
fn observe_item(tcx: TyCtxt<'_>, diagnostic_items: &mut DiagnosticItems, def_id: LocalDefId) {
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(def_id);
|
||||
let attrs = tcx.hir().attrs(hir_id);
|
||||
if let Some(name) = extract(attrs) {
|
||||
@ -63,7 +59,7 @@ fn extract(attrs: &[ast::Attribute]) -> Option<Symbol> {
|
||||
}
|
||||
|
||||
/// Traverse and collect the diagnostic items in the current
|
||||
fn diagnostic_items<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> DiagnosticItems {
|
||||
fn diagnostic_items(tcx: TyCtxt<'_>, cnum: CrateNum) -> DiagnosticItems {
|
||||
assert_eq!(cnum, LOCAL_CRATE);
|
||||
|
||||
// Initialize the collector.
|
||||
@ -92,7 +88,7 @@ fn diagnostic_items<'tcx>(tcx: TyCtxt<'tcx>, cnum: CrateNum) -> DiagnosticItems
|
||||
}
|
||||
|
||||
/// Traverse and collect all the diagnostic items in all crates.
|
||||
fn all_diagnostic_items<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> DiagnosticItems {
|
||||
fn all_diagnostic_items(tcx: TyCtxt<'_>, (): ()) -> DiagnosticItems {
|
||||
// Initialize the collector.
|
||||
let mut items = DiagnosticItems::default();
|
||||
|
||||
|
@ -26,7 +26,7 @@ pub fn test_layout(tcx: TyCtxt<'_>) {
|
||||
}
|
||||
}
|
||||
|
||||
fn dump_layout_of<'tcx>(tcx: TyCtxt<'tcx>, item_def_id: LocalDefId, attr: &Attribute) {
|
||||
fn dump_layout_of(tcx: TyCtxt<'_>, item_def_id: LocalDefId, attr: &Attribute) {
|
||||
let tcx = tcx;
|
||||
let param_env = tcx.param_env(item_def_id);
|
||||
let ty = tcx.type_of(item_def_id);
|
||||
|
@ -347,7 +347,7 @@ fn check_item<'tcx>(
|
||||
}
|
||||
}
|
||||
|
||||
fn has_custom_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool {
|
||||
fn has_custom_linkage(tcx: TyCtxt<'_>, def_id: LocalDefId) -> bool {
|
||||
// Anything which has custom linkage gets thrown on the worklist no
|
||||
// matter where it is in the crate, along with "special std symbols"
|
||||
// which are currently akin to allocator symbols.
|
||||
@ -364,7 +364,7 @@ fn has_custom_linkage<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> bool {
|
||||
|| codegen_attrs.flags.contains(CodegenFnAttrFlags::USED_LINKER)
|
||||
}
|
||||
|
||||
fn reachable_set<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> FxHashSet<LocalDefId> {
|
||||
fn reachable_set(tcx: TyCtxt<'_>, (): ()) -> FxHashSet<LocalDefId> {
|
||||
let effective_visibilities = &tcx.effective_visibilities(());
|
||||
|
||||
let any_library =
|
||||
|
@ -853,7 +853,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
|
||||
/// Check whether a path is a `use` item that has been marked as unstable.
|
||||
///
|
||||
/// See issue #94972 for details on why this is a special case
|
||||
fn is_unstable_reexport<'tcx>(tcx: TyCtxt<'tcx>, id: hir::HirId) -> bool {
|
||||
fn is_unstable_reexport(tcx: TyCtxt<'_>, id: hir::HirId) -> bool {
|
||||
// Get the LocalDefId so we can lookup the item to check the kind.
|
||||
let Some(def_id) = tcx.hir().opt_local_def_id(id) else { return false; };
|
||||
|
||||
|
@ -11,7 +11,7 @@ use crate::errors::{MissingLangItem, MissingPanicHandler, UnknownExternLangItem}
|
||||
|
||||
/// Checks the crate for usage of weak lang items, returning a vector of all the
|
||||
/// language items required by this crate, but not defined yet.
|
||||
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItems) {
|
||||
pub fn check_crate(tcx: TyCtxt<'_>, items: &mut lang_items::LanguageItems) {
|
||||
// These are never called by user code, they're generated by the compiler.
|
||||
// They will never implicitly be added to the `missing` array unless we do
|
||||
// so here.
|
||||
@ -40,7 +40,7 @@ pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>, items: &mut lang_items::LanguageItem
|
||||
verify(tcx, items);
|
||||
}
|
||||
|
||||
fn verify<'tcx>(tcx: TyCtxt<'tcx>, items: &lang_items::LanguageItems) {
|
||||
fn verify(tcx: TyCtxt<'_>, items: &lang_items::LanguageItems) {
|
||||
// We only need to check for the presence of weak lang items if we're
|
||||
// emitting something that's not an rlib.
|
||||
let needs_check = tcx.sess.crate_types().iter().any(|kind| match *kind {
|
||||
|
@ -227,7 +227,7 @@ impl<'sess> rustc_middle::ty::OnDiskCache<'sess> for OnDiskCache<'sess> {
|
||||
*self.serialized_data.write() = None;
|
||||
}
|
||||
|
||||
fn serialize<'tcx>(&self, tcx: TyCtxt<'tcx>, encoder: FileEncoder) -> FileEncodeResult {
|
||||
fn serialize(&self, tcx: TyCtxt<'_>, encoder: FileEncoder) -> FileEncodeResult {
|
||||
// Serializing the `DepGraph` should not modify it.
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
// Allocate `SourceFileIndex`es.
|
||||
|
@ -278,7 +278,7 @@ pub(crate) fn alloc_self_profile_query_strings_for_query_cache<'tcx, C>(
|
||||
/// If we are recording only summary data, the ids will point to
|
||||
/// just the query names. If we are recording query keys too, we
|
||||
/// allocate the corresponding strings here.
|
||||
pub fn alloc_self_profile_query_strings<'tcx>(tcx: TyCtxt<'tcx>) {
|
||||
pub fn alloc_self_profile_query_strings(tcx: TyCtxt<'_>) {
|
||||
if !tcx.prof.enabled() {
|
||||
return;
|
||||
}
|
||||
|
@ -340,9 +340,9 @@ where
|
||||
/// which will be used if the query is not in the cache and we need
|
||||
/// to compute it.
|
||||
#[inline]
|
||||
pub fn try_get_cached<'a, Tcx, C, R, OnHit>(
|
||||
pub fn try_get_cached<Tcx, C, R, OnHit>(
|
||||
tcx: Tcx,
|
||||
cache: &'a C,
|
||||
cache: &C,
|
||||
key: &C::Key,
|
||||
// `on_hit` can be called while holding a lock to the query cache
|
||||
on_hit: OnHit,
|
||||
|
@ -957,10 +957,10 @@ impl SaveHandler for CallbackHandler<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn process_crate<'l, 'tcx, H: SaveHandler>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub fn process_crate<H: SaveHandler>(
|
||||
tcx: TyCtxt<'_>,
|
||||
cratename: Symbol,
|
||||
input: &'l Input,
|
||||
input: &Input,
|
||||
config: Option<Config>,
|
||||
mut handler: H,
|
||||
) {
|
||||
|
@ -122,7 +122,7 @@ pub fn feature_err_issue<'a>(
|
||||
/// Construct a future incompatibility diagnostic for a feature gate.
|
||||
///
|
||||
/// This diagnostic is only a warning and *does not cause compilation to fail*.
|
||||
pub fn feature_warn<'a>(sess: &'a ParseSess, feature: Symbol, span: Span, explain: &str) {
|
||||
pub fn feature_warn(sess: &ParseSess, feature: Symbol, span: Span, explain: &str) {
|
||||
feature_warn_issue(sess, feature, span, GateIssue::Language, explain);
|
||||
}
|
||||
|
||||
@ -134,8 +134,8 @@ pub fn feature_warn<'a>(sess: &'a ParseSess, feature: Symbol, span: Span, explai
|
||||
/// Almost always, you want to use this for a language feature. If so, prefer `feature_warn`.
|
||||
#[allow(rustc::diagnostic_outside_of_impl)]
|
||||
#[allow(rustc::untranslatable_diagnostic)]
|
||||
pub fn feature_warn_issue<'a>(
|
||||
sess: &'a ParseSess,
|
||||
pub fn feature_warn_issue(
|
||||
sess: &ParseSess,
|
||||
feature: Symbol,
|
||||
span: Span,
|
||||
issue: GateIssue,
|
||||
@ -160,7 +160,7 @@ pub fn feature_warn_issue<'a>(
|
||||
}
|
||||
|
||||
/// Adds the diagnostics for a feature to an existing error.
|
||||
pub fn add_feature_diagnostics<'a>(err: &mut Diagnostic, sess: &'a ParseSess, feature: Symbol) {
|
||||
pub fn add_feature_diagnostics(err: &mut Diagnostic, sess: &ParseSess, feature: Symbol) {
|
||||
add_feature_diagnostics_for_issue(err, sess, feature, GateIssue::Language);
|
||||
}
|
||||
|
||||
@ -169,9 +169,9 @@ pub fn add_feature_diagnostics<'a>(err: &mut Diagnostic, sess: &'a ParseSess, fe
|
||||
/// This variant allows you to control whether it is a library or language feature.
|
||||
/// Almost always, you want to use this for a language feature. If so, prefer
|
||||
/// `add_feature_diagnostics`.
|
||||
pub fn add_feature_diagnostics_for_issue<'a>(
|
||||
pub fn add_feature_diagnostics_for_issue(
|
||||
err: &mut Diagnostic,
|
||||
sess: &'a ParseSess,
|
||||
sess: &ParseSess,
|
||||
feature: Symbol,
|
||||
issue: GateIssue,
|
||||
) {
|
||||
|
@ -3,7 +3,7 @@ use rustc_data_structures::profiling::VerboseTimingGuard;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
impl Session {
|
||||
pub fn timer<'a>(&'a self, what: &'static str) -> VerboseTimingGuard<'a> {
|
||||
pub fn timer(&self, what: &'static str) -> VerboseTimingGuard<'_> {
|
||||
self.prof.verbose_generic_activity(what)
|
||||
}
|
||||
pub fn time<R>(&self, what: &'static str, f: impl FnOnce() -> R) -> R {
|
||||
|
@ -338,7 +338,7 @@ fn encode_substs<'tcx>(
|
||||
}
|
||||
|
||||
/// Encodes a ty:Ty name, including its crate and path disambiguators and names.
|
||||
fn encode_ty_name<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> String {
|
||||
fn encode_ty_name(tcx: TyCtxt<'_>, def_id: DefId) -> String {
|
||||
// Encode <name> for use in u<length><name>[I<element-type1..element-typeN>E], where
|
||||
// <element-type> is <subst>, using v0's <path> without v0's extended form of paths:
|
||||
//
|
||||
|
@ -19,7 +19,7 @@ enum FloatConv {
|
||||
#[derive(Copy, Clone)]
|
||||
struct CannotUseFpConv;
|
||||
|
||||
fn is_loongarch_aggregate<'a, Ty>(arg: &ArgAbi<'a, Ty>) -> bool {
|
||||
fn is_loongarch_aggregate<Ty>(arg: &ArgAbi<'_, Ty>) -> bool {
|
||||
match arg.layout.abi {
|
||||
Abi::Vector { .. } => true,
|
||||
_ => arg.layout.is_aggregate(),
|
||||
@ -290,7 +290,7 @@ fn classify_arg<'a, Ty, C>(
|
||||
}
|
||||
}
|
||||
|
||||
fn extend_integer_width<'a, Ty>(arg: &mut ArgAbi<'a, Ty>, xlen: u64) {
|
||||
fn extend_integer_width<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64) {
|
||||
if let Abi::Scalar(scalar) = arg.layout.abi {
|
||||
if let abi::Int(i, _) = scalar.primitive() {
|
||||
// 32-bit integers are always sign-extended
|
||||
|
@ -25,7 +25,7 @@ enum FloatConv {
|
||||
#[derive(Copy, Clone)]
|
||||
struct CannotUseFpConv;
|
||||
|
||||
fn is_riscv_aggregate<'a, Ty>(arg: &ArgAbi<'a, Ty>) -> bool {
|
||||
fn is_riscv_aggregate<Ty>(arg: &ArgAbi<'_, Ty>) -> bool {
|
||||
match arg.layout.abi {
|
||||
Abi::Vector { .. } => true,
|
||||
_ => arg.layout.is_aggregate(),
|
||||
@ -296,7 +296,7 @@ fn classify_arg<'a, Ty, C>(
|
||||
}
|
||||
}
|
||||
|
||||
fn extend_integer_width<'a, Ty>(arg: &mut ArgAbi<'a, Ty>, xlen: u64) {
|
||||
fn extend_integer_width<Ty>(arg: &mut ArgAbi<'_, Ty>, xlen: u64) {
|
||||
if let Abi::Scalar(scalar) = arg.layout.abi {
|
||||
if let abi::Int(i, _) = scalar.primitive() {
|
||||
// 32-bit integers are always sign-extended
|
||||
|
@ -1319,7 +1319,7 @@ pub struct Target {
|
||||
}
|
||||
|
||||
impl Target {
|
||||
pub fn parse_data_layout<'a>(&'a self) -> Result<TargetDataLayout, TargetDataLayoutErrors<'a>> {
|
||||
pub fn parse_data_layout(&self) -> Result<TargetDataLayout, TargetDataLayoutErrors<'_>> {
|
||||
let mut dl = TargetDataLayout::parse_from_llvm_datalayout_string(&self.data_layout)?;
|
||||
|
||||
// Perform consistency checks against the Target information.
|
||||
|
@ -66,13 +66,13 @@ pub fn add_placeholder_note(err: &mut Diagnostic) {
|
||||
/// with a suitably-freshened `ImplHeader` with those types
|
||||
/// substituted. Otherwise, returns `None`.
|
||||
#[instrument(skip(tcx, skip_leak_check), level = "debug")]
|
||||
pub fn overlapping_impls<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
pub fn overlapping_impls(
|
||||
tcx: TyCtxt<'_>,
|
||||
impl1_def_id: DefId,
|
||||
impl2_def_id: DefId,
|
||||
skip_leak_check: SkipLeakCheck,
|
||||
overlap_mode: OverlapMode,
|
||||
) -> Option<OverlapResult<'tcx>> {
|
||||
) -> Option<OverlapResult<'_>> {
|
||||
// Before doing expensive operations like entering an inference context, do
|
||||
// a quick check via fast_reject to tell if the impl headers could possibly
|
||||
// unify.
|
||||
@ -283,7 +283,7 @@ fn implicit_negative<'cx, 'tcx>(
|
||||
|
||||
/// Given impl1 and impl2 check if both impls are never satisfied by a common type (including
|
||||
/// where-clauses) If so, return true, they are disjoint and false otherwise.
|
||||
fn negative_impl<'tcx>(tcx: TyCtxt<'tcx>, impl1_def_id: DefId, impl2_def_id: DefId) -> bool {
|
||||
fn negative_impl(tcx: TyCtxt<'_>, impl1_def_id: DefId, impl2_def_id: DefId) -> bool {
|
||||
debug!("negative_impl(impl1_def_id={:?}, impl2_def_id={:?})", impl1_def_id, impl2_def_id);
|
||||
|
||||
// Create an infcx, taking the predicates of impl1 as assumptions:
|
||||
|
@ -3472,7 +3472,7 @@ fn hint_missing_borrow<'tcx>(
|
||||
|
||||
let arg_spans = fn_decl.inputs.iter().map(|ty| ty.span);
|
||||
|
||||
fn get_deref_type_and_refs<'tcx>(mut ty: Ty<'tcx>) -> (Ty<'tcx>, usize) {
|
||||
fn get_deref_type_and_refs(mut ty: Ty<'_>) -> (Ty<'_>, usize) {
|
||||
let mut refs = 0;
|
||||
|
||||
while let ty::Ref(_, new_ty, _) = ty.kind() {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user