}
impl<'tcx> MonoItem<'tcx> {
- pub fn size_estimate<'a>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> usize {
+ pub fn size_estimate(&self, tcx: TyCtxt<'tcx, 'tcx>) -> usize {
match *self {
MonoItem::Fn(instance) => {
// Estimate the size of a function based on how many statements
}
}
- pub fn symbol_name(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> SymbolName {
+ pub fn symbol_name(&self, tcx: TyCtxt<'tcx, 'tcx>) -> SymbolName {
match *self {
MonoItem::Fn(instance) => tcx.symbol_name(instance),
MonoItem::Static(def_id) => {
}
}
- pub fn instantiation_mode(&self,
- tcx: TyCtxt<'a, 'tcx, 'tcx>)
- -> InstantiationMode {
+ pub fn instantiation_mode(&self, tcx: TyCtxt<'tcx, 'tcx>) -> InstantiationMode {
let inline_in_all_cgus =
tcx.sess.opts.debugging_opts.inline_in_all_cgus.unwrap_or_else(|| {
tcx.sess.opts.optimize != OptLevel::No
}
}
- pub fn explicit_linkage(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Linkage> {
+ pub fn explicit_linkage(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Linkage> {
let def_id = match *self {
MonoItem::Fn(ref instance) => instance.def_id(),
MonoItem::Static(def_id) => def_id,
/// Similarly, if a vtable method has such a signature, and therefore can't
/// be used, we can just not emit it and have a placeholder (a null pointer,
/// which will never be accessed) in its place.
- pub fn is_instantiable(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> bool {
+ pub fn is_instantiable(&self, tcx: TyCtxt<'tcx, 'tcx>) -> bool {
debug!("is_instantiable({:?})", self);
let (def_id, substs) = match *self {
MonoItem::Fn(ref instance) => (instance.def_id(), instance.substs),
tcx.substitute_normalize_and_test_predicates((def_id, &substs))
}
- pub fn to_string(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>, debug: bool) -> String {
+ pub fn to_string(&self, tcx: TyCtxt<'tcx, 'tcx>, debug: bool) -> String {
return match *self {
MonoItem::Fn(instance) => {
to_string_internal(tcx, "fn ", instance, debug)
}
};
- fn to_string_internal<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- prefix: &str,
- instance: Instance<'tcx>,
- debug: bool)
- -> String {
+ fn to_string_internal<'tcx>(
+ tcx: TyCtxt<'tcx, 'tcx>,
+ prefix: &str,
+ instance: Instance<'tcx>,
+ debug: bool,
+ ) -> String {
let mut result = String::with_capacity(32);
result.push_str(prefix);
let printer = DefPathBasedNames::new(tcx, false, false);
}
}
- pub fn local_span(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Option<Span> {
+ pub fn local_span(&self, tcx: TyCtxt<'tcx, 'tcx>) -> Option<Span> {
match *self {
MonoItem::Fn(Instance { def, .. }) => {
tcx.hir().as_local_hir_id(def.def_id())
base_n::encode(hash, base_n::CASE_INSENSITIVE)
}
- pub fn estimate_size<'a>(&mut self, tcx: TyCtxt<'a, 'tcx, 'tcx>) {
+ pub fn estimate_size(&mut self, tcx: TyCtxt<'tcx, 'tcx>) {
// Estimate the size of a codegen unit as (approximately) the number of MIR
// statements it corresponds to.
self.size_estimate = Some(self.items.keys().map(|mi| mi.size_estimate(tcx)).sum());
WorkProductId::from_cgu_name(&self.name().as_str())
}
- pub fn work_product(&self, tcx: TyCtxt<'_, '_, '_>) -> WorkProduct {
+ pub fn work_product(&self, tcx: TyCtxt<'_, '_>) -> WorkProduct {
let work_product_id = self.work_product_id();
tcx.dep_graph
.previous_work_product(&work_product_id)
})
}
- pub fn items_in_deterministic_order<'a>(&self,
- tcx: TyCtxt<'a, 'tcx, 'tcx>)
- -> Vec<(MonoItem<'tcx>,
- (Linkage, Visibility))> {
+ pub fn items_in_deterministic_order(
+ &self,
+ tcx: TyCtxt<'tcx, 'tcx>,
+ ) -> Vec<(MonoItem<'tcx>, (Linkage, Visibility))> {
// The codegen tests rely on items being process in the same order as
// they appear in the file, so for local items, we sort by node_id first
#[derive(PartialEq, Eq, PartialOrd, Ord)]
pub struct ItemSortKey(Option<HirId>, SymbolName);
- fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- item: MonoItem<'tcx>) -> ItemSortKey {
+ fn item_sort_key<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, item: MonoItem<'tcx>) -> ItemSortKey {
ItemSortKey(match item {
MonoItem::Fn(ref instance) => {
match instance.def {
items
}
- pub fn codegen_dep_node(&self, tcx: TyCtxt<'_, 'tcx, 'tcx>) -> DepNode {
+ pub fn codegen_dep_node(&self, tcx: TyCtxt<'tcx, 'tcx>) -> DepNode {
DepNode::new(tcx, DepConstructor::CompileCodegenUnit(self.name().clone()))
}
}
}
}
-pub struct CodegenUnitNameBuilder<'a, 'gcx: 'tcx, 'tcx: 'a> {
- tcx: TyCtxt<'a, 'gcx, 'tcx>,
+pub struct CodegenUnitNameBuilder<'gcx, 'tcx> {
+ tcx: TyCtxt<'gcx, 'tcx>,
cache: FxHashMap<CrateNum, String>,
}
-impl<'a, 'gcx: 'tcx, 'tcx: 'a> CodegenUnitNameBuilder<'a, 'gcx, 'tcx> {
-
- pub fn new(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> Self {
+impl CodegenUnitNameBuilder<'gcx, 'tcx> {
+ pub fn new(tcx: TyCtxt<'gcx, 'tcx>) -> Self {
CodegenUnitNameBuilder {
tcx,
cache: Default::default(),