Rollup merge of #91896 - pitaj:91867-passes, r=michaelwoerister

Remove `in_band_lifetimes` for `rustc_passes`

#91867
This commit is contained in:
Matthias Krüger 2021-12-18 10:26:36 +01:00 committed by GitHub
commit eb3cc132d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 33 additions and 34 deletions

View File

@ -58,7 +58,7 @@ struct CheckAttrVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl CheckAttrVisitor<'tcx> {
impl CheckAttrVisitor<'_> {
/// Checks any attribute.
fn check_attributes(
&self,
@ -382,7 +382,7 @@ fn check_track_caller(
&self,
hir_id: HirId,
attr_span: &Span,
attrs: &'hir [Attribute],
attrs: &[Attribute],
span: &Span,
target: Target,
) -> bool {
@ -1481,7 +1481,7 @@ fn check_no_mangle(&self, hir_id: HirId, attr: &Attribute, span: &Span, target:
/// Checks if the `#[repr]` attributes on `item` are valid.
fn check_repr(
&self,
attrs: &'hir [Attribute],
attrs: &[Attribute],
span: &Span,
target: Target,
item: Option<ItemLike<'_>>,
@ -1663,7 +1663,7 @@ fn check_repr(
}
}
fn check_used(&self, attrs: &'hir [Attribute], target: Target) {
fn check_used(&self, attrs: &[Attribute], target: Target) {
for attr in attrs {
if attr.has_name(sym::used) && target != Target::Static {
self.tcx
@ -1842,7 +1842,7 @@ fn check_plugin_registrar(&self, hir_id: HirId, attr: &Attribute, target: Target
}
}
impl Visitor<'tcx> for CheckAttrVisitor<'tcx> {
impl<'tcx> Visitor<'tcx> for CheckAttrVisitor<'tcx> {
type Map = Map<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -78,7 +78,7 @@ fn new(tcx: TyCtxt<'tcx>) -> Self {
impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor<'tcx> {
/// check for const trait impls, and errors if the impl uses provided/default functions
/// of the trait being implemented; as those provided functions can be non-const.
fn visit_item(&mut self, item: &'hir hir::Item<'hir>) {
fn visit_item<'hir>(&mut self, item: &'hir hir::Item<'hir>) {
let _: Option<_> = try {
if let hir::ItemKind::Impl(ref imp) = item.kind {
if let hir::Constness::Const = imp.constness {
@ -134,11 +134,11 @@ fn visit_item(&mut self, item: &'hir hir::Item<'hir>) {
};
}
fn visit_trait_item(&mut self, _: &'hir hir::TraitItem<'hir>) {}
fn visit_trait_item<'hir>(&mut self, _: &'hir hir::TraitItem<'hir>) {}
fn visit_impl_item(&mut self, _: &'hir hir::ImplItem<'hir>) {}
fn visit_impl_item<'hir>(&mut self, _: &'hir hir::ImplItem<'hir>) {}
fn visit_foreign_item(&mut self, _: &'hir hir::ForeignItem<'hir>) {}
fn visit_foreign_item<'hir>(&mut self, _: &'hir hir::ForeignItem<'hir>) {}
}
#[derive(Copy, Clone)]

View File

@ -150,7 +150,7 @@ fn handle_assign(&mut self, expr: &'tcx hir::Expr<'tcx>) {
#[allow(dead_code)] // FIXME(81658): should be used + lint reinstated after #83171 relands.
fn check_for_self_assign(&mut self, assign: &'tcx hir::Expr<'tcx>) {
fn check_for_self_assign_helper(
fn check_for_self_assign_helper<'tcx>(
tcx: TyCtxt<'tcx>,
typeck_results: &'tcx ty::TypeckResults<'tcx>,
lhs: &'tcx hir::Expr<'tcx>,
@ -600,7 +600,7 @@ struct DeadVisitor<'tcx> {
live_symbols: FxHashSet<LocalDefId>,
}
impl DeadVisitor<'tcx> {
impl<'tcx> DeadVisitor<'tcx> {
fn should_warn_about_item(&mut self, item: &hir::Item<'_>) -> bool {
let should_warn = matches!(
item.kind,
@ -672,7 +672,7 @@ fn warn_dead_code(
}
}
impl Visitor<'tcx> for DeadVisitor<'tcx> {
impl<'tcx> Visitor<'tcx> for DeadVisitor<'tcx> {
type Map = Map<'tcx>;
/// Walk nested items in place so that we don't report dead-code

View File

@ -62,7 +62,7 @@ fn unpack_option_like<'tcx>(tcx: TyCtxt<'tcx>, ty: Ty<'tcx>) -> Ty<'tcx> {
ty
}
impl ExprVisitor<'tcx> {
impl<'tcx> ExprVisitor<'tcx> {
fn def_id_is_transmute(&self, def_id: DefId) -> bool {
self.tcx.fn_sig(def_id).abi() == RustIntrinsic
&& self.tcx.item_name(def_id) == sym::transmute
@ -487,7 +487,7 @@ fn check_asm(&self, asm: &hir::InlineAsm<'tcx>, hir_id: hir::HirId) {
}
}
impl Visitor<'tcx> for ItemVisitor<'tcx> {
impl<'tcx> Visitor<'tcx> for ItemVisitor<'tcx> {
type Map = intravisit::ErasedMap<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
@ -504,7 +504,7 @@ fn visit_nested_body(&mut self, body_id: hir::BodyId) {
}
}
impl Visitor<'tcx> for ExprVisitor<'tcx> {
impl<'tcx> Visitor<'tcx> for ExprVisitor<'tcx> {
type Map = intravisit::ErasedMap<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -28,7 +28,7 @@ struct LanguageItemCollector<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> {
impl<'v, 'tcx> ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> {
fn visit_item(&mut self, item: &hir::Item<'_>) {
self.check_for_lang(Target::from_item(item), item.hir_id());
@ -50,7 +50,7 @@ fn visit_impl_item(&mut self, impl_item: &hir::ImplItem<'_>) {
fn visit_foreign_item(&mut self, _: &hir::ForeignItem<'_>) {}
}
impl LanguageItemCollector<'tcx> {
impl<'tcx> LanguageItemCollector<'tcx> {
fn new(tcx: TyCtxt<'tcx>) -> LanguageItemCollector<'tcx> {
LanguageItemCollector { tcx, items: LanguageItems::new() }
}

View File

@ -20,7 +20,7 @@ struct LayoutTest<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl ItemLikeVisitor<'tcx> for LayoutTest<'tcx> {
impl<'tcx> ItemLikeVisitor<'tcx> for LayoutTest<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
match item.kind {
ItemKind::TyAlias(..)
@ -42,7 +42,7 @@ fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem<'tcx>) {}
fn visit_foreign_item(&mut self, _: &'tcx hir::ForeignItem<'tcx>) {}
}
impl LayoutTest<'tcx> {
impl<'tcx> LayoutTest<'tcx> {
fn dump_layout_of(&self, item_def_id: LocalDefId, item: &hir::Item<'tcx>, attr: &Attribute) {
let tcx = self.tcx;
let param_env = self.tcx.param_env(item_def_id);
@ -114,7 +114,7 @@ struct UnwrapLayoutCx<'tcx> {
param_env: ParamEnv<'tcx>,
}
impl LayoutOfHelpers<'tcx> for UnwrapLayoutCx<'tcx> {
impl<'tcx> LayoutOfHelpers<'tcx> for UnwrapLayoutCx<'tcx> {
type LayoutOfResult = TyAndLayout<'tcx>;
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
@ -127,19 +127,19 @@ fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) ->
}
}
impl HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> {
impl<'tcx> HasTyCtxt<'tcx> for UnwrapLayoutCx<'tcx> {
fn tcx(&self) -> TyCtxt<'tcx> {
self.tcx
}
}
impl HasParamEnv<'tcx> for UnwrapLayoutCx<'tcx> {
impl<'tcx> HasParamEnv<'tcx> for UnwrapLayoutCx<'tcx> {
fn param_env(&self) -> ParamEnv<'tcx> {
self.param_env
}
}
impl HasDataLayout for UnwrapLayoutCx<'tcx> {
impl<'tcx> HasDataLayout for UnwrapLayoutCx<'tcx> {
fn data_layout(&self) -> &TargetDataLayout {
self.tcx.data_layout()
}

View File

@ -6,7 +6,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(crate_visibility_modifier)]
#![feature(in_band_lifetimes)]
#![feature(map_try_insert)]
#![feature(min_specialization)]
#![feature(nll)]

View File

@ -23,7 +23,7 @@ pub struct LibFeatureCollector<'tcx> {
lib_features: LibFeatures,
}
impl LibFeatureCollector<'tcx> {
impl<'tcx> LibFeatureCollector<'tcx> {
fn new(tcx: TyCtxt<'tcx>) -> LibFeatureCollector<'tcx> {
LibFeatureCollector { tcx, lib_features: new_lib_features() }
}
@ -110,7 +110,7 @@ fn span_feature_error(&self, span: Span, msg: &str) {
}
}
impl Visitor<'tcx> for LibFeatureCollector<'tcx> {
impl<'tcx> Visitor<'tcx> for LibFeatureCollector<'tcx> {
type Map = Map<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -198,7 +198,7 @@ struct IrMaps<'tcx> {
lnks: IndexVec<LiveNode, LiveNodeKind>,
}
impl IrMaps<'tcx> {
impl<'tcx> IrMaps<'tcx> {
fn new(tcx: TyCtxt<'tcx>) -> IrMaps<'tcx> {
IrMaps {
tcx,

View File

@ -37,7 +37,7 @@ fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
fn visit_fn(
&mut self,
fk: FnKind<'v>,
fk: FnKind<'_>,
_fd: &'tcx hir::FnDecl<'tcx>,
body_id: hir::BodyId,
span: Span,

View File

@ -22,7 +22,7 @@
// Returns true if the given item must be inlined because it may be
// monomorphized or it was marked with `#[inline]`. This will only return
// true for functions.
fn item_might_be_inlined(tcx: TyCtxt<'tcx>, item: &hir::Item<'_>, attrs: &CodegenFnAttrs) -> bool {
fn item_might_be_inlined(tcx: TyCtxt<'_>, item: &hir::Item<'_>, attrs: &CodegenFnAttrs) -> bool {
if attrs.requests_inline() {
return true;
}

View File

@ -655,7 +655,7 @@ fn visit_foreign_item(&mut self, i: &'tcx hir::ForeignItem<'tcx>) {
// stable (assuming they have not inherited instability from their parent).
}
fn stability_index(tcx: TyCtxt<'tcx>, (): ()) -> Index<'tcx> {
fn stability_index<'tcx>(tcx: TyCtxt<'tcx>, (): ()) -> Index<'tcx> {
let is_staged_api =
tcx.sess.opts.debugging_opts.force_unstable_if_unmarked || tcx.features().staged_api;
let mut staged_api = FxHashMap::default();
@ -737,7 +737,7 @@ struct Checker<'tcx> {
tcx: TyCtxt<'tcx>,
}
impl Visitor<'tcx> for Checker<'tcx> {
impl<'tcx> Visitor<'tcx> for Checker<'tcx> {
type Map = Map<'tcx>;
/// Because stability levels are scoped lexically, we want to walk
@ -866,7 +866,7 @@ struct CheckTraitImplStable<'tcx> {
fully_stable: bool,
}
impl Visitor<'tcx> for CheckTraitImplStable<'tcx> {
impl<'tcx> Visitor<'tcx> for CheckTraitImplStable<'tcx> {
type Map = Map<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {

View File

@ -42,7 +42,7 @@ struct LocalCollector {
locals: FxHashSet<HirId>,
}
impl Visitor<'tcx> for LocalCollector {
impl<'tcx> Visitor<'tcx> for LocalCollector {
type Map = intravisit::ErasedMap<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {
@ -71,7 +71,7 @@ fn visit_local_use(&mut self, var_id: HirId, span: Span) {
}
}
impl Visitor<'tcx> for CaptureCollector<'a, 'tcx> {
impl<'tcx> Visitor<'tcx> for CaptureCollector<'_, 'tcx> {
type Map = intravisit::ErasedMap<'tcx>;
fn nested_visit_map(&mut self) -> NestedVisitorMap<Self::Map> {