Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove in_band_lifetimes for rustc_passes #91896

Merged
merged 1 commit into from
Dec 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions compiler/rustc_passes/src/check_attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct CheckAttrVisitor<'tcx> {
tcx: TyCtxt<'tcx>,
}

impl CheckAttrVisitor<'tcx> {
impl CheckAttrVisitor<'_> {
/// Checks any attribute.
fn check_attributes(
&self,
Expand Down Expand Up @@ -382,7 +382,7 @@ impl CheckAttrVisitor<'tcx> {
&self,
hir_id: HirId,
attr_span: &Span,
attrs: &'hir [Attribute],
attrs: &[Attribute],
span: &Span,
target: Target,
) -> bool {
Expand Down Expand Up @@ -1481,7 +1481,7 @@ impl CheckAttrVisitor<'tcx> {
/// 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<'_>>,
Expand Down Expand Up @@ -1663,7 +1663,7 @@ impl CheckAttrVisitor<'tcx> {
}
}

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
Expand Down Expand Up @@ -1842,7 +1842,7 @@ impl CheckAttrVisitor<'tcx> {
}
}

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> {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_passes/src/check_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl<'tcx> CheckConstTraitVisitor<'tcx> {
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 {
Expand Down Expand Up @@ -134,11 +134,11 @@ impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for CheckConstTraitVisitor<
};
}

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)]
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_passes/src/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl<'tcx> MarkSymbolVisitor<'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>,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -672,7 +672,7 @@ impl DeadVisitor<'tcx> {
}
}

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
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_passes/src/intrinsicck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -487,7 +487,7 @@ impl ExprVisitor<'tcx> {
}
}

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> {
Expand All @@ -504,7 +504,7 @@ impl Visitor<'tcx> for ItemVisitor<'tcx> {
}
}

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> {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/lang_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand All @@ -50,7 +50,7 @@ impl ItemLikeVisitor<'v> for LanguageItemCollector<'tcx> {
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() }
}
Expand Down
12 changes: 6 additions & 6 deletions compiler/rustc_passes/src/layout_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(..)
Expand All @@ -42,7 +42,7 @@ impl ItemLikeVisitor<'tcx> for LayoutTest<'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);
Expand Down Expand Up @@ -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>) -> ! {
Expand All @@ -127,19 +127,19 @@ impl LayoutOfHelpers<'tcx> for UnwrapLayoutCx<'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()
}
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_passes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/lib_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() }
}
Expand Down Expand Up @@ -110,7 +110,7 @@ impl LibFeatureCollector<'tcx> {
}
}

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> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/naked_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl<'tcx> Visitor<'tcx> for CheckNakedFunctions<'tcx> {

fn visit_fn(
&mut self,
fk: FnKind<'v>,
fk: FnKind<'_>,
_fd: &'tcx hir::FnDecl<'tcx>,
body_id: hir::BodyId,
span: Span,
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_passes/src/reachable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use rustc_target::spec::abi::Abi;
// 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;
}
Expand Down
6 changes: 3 additions & 3 deletions compiler/rustc_passes/src/stability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ impl<'tcx> Visitor<'tcx> for MissingStabilityAnnotations<'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();
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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> {
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_passes/src/upvars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down Expand Up @@ -71,7 +71,7 @@ impl CaptureCollector<'_, '_> {
}
}

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> {
Expand Down