1
Fork 0

Rollup merge of #91885 - LegionMammal978:less-inband-codegen_ssa, r=workingjubilee

Remove `in_band_lifetimes` from `rustc_codegen_ssa`

See #91867 for more information.

In `compiler/rustc_codegen_ssa/src/coverageinfo/map.rs`, there are several functions with an explicit `'a` lifetime but only a single `&'a self` parameter. These lifetimes should be redundant given lifetime elision, unless the existential `impl Iterator` has weird issues regarding that. Should the redundant lifetimes be removed?
This commit is contained in:
Matthias Krüger 2021-12-15 10:56:59 +01:00 committed by GitHub
commit 700670f3a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 16 additions and 17 deletions

View file

@ -154,7 +154,7 @@ fn is_reachable_non_generic_provider_extern(tcx: TyCtxt<'_>, def_id: DefId) -> b
tcx.reachable_non_generics(def_id.krate).contains_key(&def_id) tcx.reachable_non_generics(def_id.krate).contains_key(&def_id)
} }
fn exported_symbols_provider_local( fn exported_symbols_provider_local<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
cnum: CrateNum, cnum: CrateNum,
) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)] { ) -> &'tcx [(ExportedSymbol<'tcx>, SymbolExportLevel)] {

View file

@ -486,7 +486,7 @@ fn get_argc_argv<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
pub fn codegen_crate<B: ExtraBackendMethods>( pub fn codegen_crate<B: ExtraBackendMethods>(
backend: B, backend: B,
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'_>,
target_cpu: String, target_cpu: String,
metadata: EncodedMetadata, metadata: EncodedMetadata,
need_metadata_module: bool, need_metadata_module: bool,

View file

@ -150,9 +150,9 @@ impl<'tcx> FunctionCoverage<'tcx> {
/// Generate an array of CounterExpressions, and an iterator over all `Counter`s and their /// Generate an array of CounterExpressions, and an iterator over all `Counter`s and their
/// associated `Regions` (from which the LLVM-specific `CoverageMapGenerator` will create /// associated `Regions` (from which the LLVM-specific `CoverageMapGenerator` will create
/// `CounterMappingRegion`s. /// `CounterMappingRegion`s.
pub fn get_expressions_and_counter_regions<'a>( pub fn get_expressions_and_counter_regions(
&'a self, &self,
) -> (Vec<CounterExpression>, impl Iterator<Item = (Counter, &'a CodeRegion)>) { ) -> (Vec<CounterExpression>, impl Iterator<Item = (Counter, &CodeRegion)>) {
assert!( assert!(
self.source_hash != 0 || !self.is_used, self.source_hash != 0 || !self.is_used,
"No counters provided the source_hash for used function: {:?}", "No counters provided the source_hash for used function: {:?}",
@ -168,7 +168,7 @@ impl<'tcx> FunctionCoverage<'tcx> {
(counter_expressions, counter_regions) (counter_expressions, counter_regions)
} }
fn counter_regions<'a>(&'a self) -> impl Iterator<Item = (Counter, &'a CodeRegion)> { fn counter_regions(&self) -> impl Iterator<Item = (Counter, &CodeRegion)> {
self.counters.iter_enumerated().filter_map(|(index, entry)| { self.counters.iter_enumerated().filter_map(|(index, entry)| {
// Option::map() will return None to filter out missing counters. This may happen // Option::map() will return None to filter out missing counters. This may happen
// if, for example, a MIR-instrumented counter is removed during an optimization. // if, for example, a MIR-instrumented counter is removed during an optimization.
@ -177,8 +177,8 @@ impl<'tcx> FunctionCoverage<'tcx> {
} }
fn expressions_with_regions( fn expressions_with_regions(
&'a self, &self,
) -> (Vec<CounterExpression>, impl Iterator<Item = (Counter, &'a CodeRegion)>) { ) -> (Vec<CounterExpression>, impl Iterator<Item = (Counter, &CodeRegion)>) {
let mut counter_expressions = Vec::with_capacity(self.expressions.len()); let mut counter_expressions = Vec::with_capacity(self.expressions.len());
let mut expression_regions = Vec::with_capacity(self.expressions.len()); let mut expression_regions = Vec::with_capacity(self.expressions.len());
let mut new_indexes = IndexVec::from_elem_n(None, self.expressions.len()); let mut new_indexes = IndexVec::from_elem_n(None, self.expressions.len());
@ -336,7 +336,7 @@ impl<'tcx> FunctionCoverage<'tcx> {
(counter_expressions, expression_regions.into_iter()) (counter_expressions, expression_regions.into_iter())
} }
fn unreachable_regions<'a>(&'a self) -> impl Iterator<Item = (Counter, &'a CodeRegion)> { fn unreachable_regions(&self) -> impl Iterator<Item = (Counter, &CodeRegion)> {
self.unreachable_regions.iter().map(|region| (Counter::zero(), region)) self.unreachable_regions.iter().map(|region| (Counter::zero(), region))
} }

View file

@ -376,7 +376,7 @@ fn push_debuginfo_type_name<'tcx>(
// format (natvis) is able to understand enums and render the active variant correctly in the // format (natvis) is able to understand enums and render the active variant correctly in the
// debugger. For more information, look in `src/etc/natvis/intrinsic.natvis` and // debugger. For more information, look in `src/etc/natvis/intrinsic.natvis` and
// `EnumMemberDescriptionFactor::create_member_descriptions`. // `EnumMemberDescriptionFactor::create_member_descriptions`.
fn msvc_enum_fallback( fn msvc_enum_fallback<'tcx>(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
ty: Ty<'tcx>, ty: Ty<'tcx>,
def: &AdtDef, def: &AdtDef,
@ -496,7 +496,7 @@ pub fn compute_debuginfo_vtable_name<'tcx>(
vtable_name vtable_name
} }
pub fn push_item_name(tcx: TyCtxt<'tcx>, def_id: DefId, qualified: bool, output: &mut String) { pub fn push_item_name(tcx: TyCtxt<'_>, def_id: DefId, qualified: bool, output: &mut String) {
let def_key = tcx.def_key(def_id); let def_key = tcx.def_key(def_id);
if qualified { if qualified {
if let Some(parent) = def_key.parent { if let Some(parent) = def_key.parent {
@ -509,7 +509,7 @@ pub fn push_item_name(tcx: TyCtxt<'tcx>, def_id: DefId, qualified: bool, output:
} }
fn push_unqualified_item_name( fn push_unqualified_item_name(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'_>,
def_id: DefId, def_id: DefId,
disambiguated_data: DisambiguatedDefPathData, disambiguated_data: DisambiguatedDefPathData,
output: &mut String, output: &mut String,

View file

@ -2,7 +2,6 @@
#![feature(bool_to_option)] #![feature(bool_to_option)]
#![feature(box_patterns)] #![feature(box_patterns)]
#![feature(try_blocks)] #![feature(try_blocks)]
#![feature(in_band_lifetimes)]
#![feature(let_else)] #![feature(let_else)]
#![feature(once_cell)] #![feature(once_cell)]
#![feature(nll)] #![feature(nll)]

View file

@ -73,7 +73,7 @@ struct LocalAnalyzer<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> {
locals: IndexVec<mir::Local, LocalKind>, locals: IndexVec<mir::Local, LocalKind>,
} }
impl<Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> { impl<'mir, 'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> LocalAnalyzer<'mir, 'a, 'tcx, Bx> {
fn assign(&mut self, local: mir::Local, location: Location) { fn assign(&mut self, local: mir::Local, location: Location) {
let kind = &mut self.locals[local]; let kind = &mut self.locals[local];
match *kind { match *kind {

View file

@ -47,7 +47,7 @@ pub struct OperandRef<'tcx, V> {
pub layout: TyAndLayout<'tcx>, pub layout: TyAndLayout<'tcx>,
} }
impl<V: CodegenObject> fmt::Debug for OperandRef<'tcx, V> { impl<V: CodegenObject> fmt::Debug for OperandRef<'_, V> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "OperandRef({:?} @ {:?})", self.val, self.layout) write!(f, "OperandRef({:?} @ {:?})", self.val, self.layout)
} }

View file

@ -97,7 +97,7 @@ pub trait DerivedTypeMethods<'tcx>: BaseTypeMethods<'tcx> + MiscMethods<'tcx> {
} }
} }
impl<T> DerivedTypeMethods<'tcx> for T where Self: BaseTypeMethods<'tcx> + MiscMethods<'tcx> {} impl<'tcx, T> DerivedTypeMethods<'tcx> for T where Self: BaseTypeMethods<'tcx> + MiscMethods<'tcx> {}
pub trait LayoutTypeMethods<'tcx>: Backend<'tcx> { pub trait LayoutTypeMethods<'tcx>: Backend<'tcx> {
fn backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type; fn backend_type(&self, layout: TyAndLayout<'tcx>) -> Self::Type;
@ -135,4 +135,4 @@ pub trait ArgAbiMethods<'tcx>: HasCodegen<'tcx> {
pub trait TypeMethods<'tcx>: DerivedTypeMethods<'tcx> + LayoutTypeMethods<'tcx> {} pub trait TypeMethods<'tcx>: DerivedTypeMethods<'tcx> + LayoutTypeMethods<'tcx> {}
impl<T> TypeMethods<'tcx> for T where Self: DerivedTypeMethods<'tcx> + LayoutTypeMethods<'tcx> {} impl<'tcx, T> TypeMethods<'tcx> for T where Self: DerivedTypeMethods<'tcx> + LayoutTypeMethods<'tcx> {}