Skip to content

Commit

Permalink
Remove in_band_lifetimes from rustc_symbol_mangling
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvan Bowdler authored and SylvanB committed Dec 15, 2021
1 parent c5ecc15 commit 6c4fd61
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_symbol_mangling/src/legacy.rs
Expand Up @@ -13,7 +13,7 @@ use tracing::debug;
use std::fmt::{self, Write};
use std::mem::{self, discriminant};

pub(super) fn mangle(
pub(super) fn mangle<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
instantiating_crate: Option<CrateNum>,
Expand Down Expand Up @@ -199,7 +199,7 @@ struct SymbolPrinter<'tcx> {
// `PrettyPrinter` aka pretty printing of e.g. types in paths,
// symbol names should have their own printing machinery.

impl Printer<'tcx> for &mut SymbolPrinter<'tcx> {
impl<'tcx> Printer<'tcx> for &mut SymbolPrinter<'tcx> {
type Error = fmt::Error;

type Path = Self;
Expand Down Expand Up @@ -345,7 +345,7 @@ impl Printer<'tcx> for &mut SymbolPrinter<'tcx> {
}
}

impl PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx> {
impl<'tcx> PrettyPrinter<'tcx> for &mut SymbolPrinter<'tcx> {
fn region_should_not_be_omitted(&self, _region: ty::Region<'_>) -> bool {
false
}
Expand Down
9 changes: 4 additions & 5 deletions compiler/rustc_symbol_mangling/src/lib.rs
Expand Up @@ -90,7 +90,6 @@
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(never_type)]
#![feature(nll)]
#![feature(in_band_lifetimes)]
#![recursion_limit = "256"]

#[macro_use]
Expand All @@ -116,7 +115,7 @@ pub mod test;
/// This function computes the symbol name for the given `instance` and the
/// given instantiating crate. That is, if you know that instance X is
/// instantiated in crate Y, this is the symbol name this instance would have.
pub fn symbol_name_for_instance_in_crate(
pub fn symbol_name_for_instance_in_crate<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
instantiating_crate: CrateNum,
Expand All @@ -131,7 +130,7 @@ pub fn provide(providers: &mut Providers) {
// The `symbol_name` query provides the symbol name for calling a given
// instance from the local crate. In particular, it will also look up the
// correct symbol name of instances from upstream crates.
fn symbol_name_provider(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> ty::SymbolName<'tcx> {
fn symbol_name_provider<'tcx>(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> ty::SymbolName<'tcx> {
let symbol_name = compute_symbol_name(tcx, instance, || {
// This closure determines the instantiating crate for instances that
// need an instantiating-crate-suffix for their symbol name, in order
Expand All @@ -151,14 +150,14 @@ fn symbol_name_provider(tcx: TyCtxt<'tcx>, instance: Instance<'tcx>) -> ty::Symb
}

/// This function computes the typeid for the given function ABI.
pub fn typeid_for_fnabi(tcx: TyCtxt<'tcx>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> String {
pub fn typeid_for_fnabi<'tcx>(tcx: TyCtxt<'tcx>, fn_abi: &FnAbi<'tcx, Ty<'tcx>>) -> String {
v0::mangle_typeid_for_fnabi(tcx, fn_abi)
}

/// Computes the symbol name for the given instance. This function will call
/// `compute_instantiating_crate` if it needs to factor the instantiating crate
/// into the symbol name.
fn compute_symbol_name(
fn compute_symbol_name<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
compute_instantiating_crate: impl FnOnce() -> CrateNum,
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_symbol_mangling/src/test.rs
Expand Up @@ -31,7 +31,7 @@ struct SymbolNamesTest<'tcx> {
tcx: TyCtxt<'tcx>,
}

impl SymbolNamesTest<'tcx> {
impl SymbolNamesTest<'_> {
fn process_attrs(&mut self, def_id: LocalDefId) {
let tcx = self.tcx;
for attr in tcx.get_attrs(def_id.to_def_id()).iter() {
Expand Down Expand Up @@ -59,7 +59,7 @@ impl SymbolNamesTest<'tcx> {
}
}

impl hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'tcx> {
impl<'tcx> hir::itemlikevisit::ItemLikeVisitor<'tcx> for SymbolNamesTest<'tcx> {
fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) {
self.process_attrs(item.def_id);
}
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_symbol_mangling/src/v0.rs
Expand Up @@ -17,7 +17,7 @@ use std::fmt::Write;
use std::iter;
use std::ops::Range;

pub(super) fn mangle(
pub(super) fn mangle<'tcx>(
tcx: TyCtxt<'tcx>,
instance: Instance<'tcx>,
instantiating_crate: Option<CrateNum>,
Expand Down Expand Up @@ -56,7 +56,7 @@ pub(super) fn mangle(
std::mem::take(&mut cx.out)
}

pub(super) fn mangle_typeid_for_fnabi(
pub(super) fn mangle_typeid_for_fnabi<'tcx>(
_tcx: TyCtxt<'tcx>,
fn_abi: &FnAbi<'tcx, Ty<'tcx>>,
) -> String {
Expand Down Expand Up @@ -118,7 +118,7 @@ struct SymbolMangler<'tcx> {
consts: FxHashMap<&'tcx ty::Const<'tcx>, usize>,
}

impl SymbolMangler<'tcx> {
impl<'tcx> SymbolMangler<'tcx> {
fn push(&mut self, s: &str) {
self.out.push_str(s);
}
Expand Down Expand Up @@ -250,7 +250,7 @@ impl SymbolMangler<'tcx> {
}
}

impl Printer<'tcx> for &mut SymbolMangler<'tcx> {
impl<'tcx> Printer<'tcx> for &mut SymbolMangler<'tcx> {
type Error = !;

type Path = Self;
Expand Down

0 comments on commit 6c4fd61

Please sign in to comment.