summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_query_impl/src/profiling_support.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:32 +0000
commit4547b622d8d29df964fa2914213088b148c498fc (patch)
tree9fc6b25f3c3add6b745be9a2400a6e96140046e9 /compiler/rustc_query_impl/src/profiling_support.rs
parentReleasing progress-linux version 1.66.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-4547b622d8d29df964fa2914213088b148c498fc.tar.xz
rustc-4547b622d8d29df964fa2914213088b148c498fc.zip
Merging upstream version 1.67.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_query_impl/src/profiling_support.rs')
-rw-r--r--compiler/rustc_query_impl/src/profiling_support.rs51
1 files changed, 15 insertions, 36 deletions
diff --git a/compiler/rustc_query_impl/src/profiling_support.rs b/compiler/rustc_query_impl/src/profiling_support.rs
index 2cc311d48..81114f2cd 100644
--- a/compiler/rustc_query_impl/src/profiling_support.rs
+++ b/compiler/rustc_query_impl/src/profiling_support.rs
@@ -19,18 +19,18 @@ impl QueryKeyStringCache {
}
}
-struct QueryKeyStringBuilder<'p, 'c, 'tcx> {
+struct QueryKeyStringBuilder<'p, 'tcx> {
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
- string_cache: &'c mut QueryKeyStringCache,
+ string_cache: &'p mut QueryKeyStringCache,
}
-impl<'p, 'c, 'tcx> QueryKeyStringBuilder<'p, 'c, 'tcx> {
+impl<'p, 'tcx> QueryKeyStringBuilder<'p, 'tcx> {
fn new(
profiler: &'p SelfProfiler,
tcx: TyCtxt<'tcx>,
- string_cache: &'c mut QueryKeyStringCache,
- ) -> QueryKeyStringBuilder<'p, 'c, 'tcx> {
+ string_cache: &'p mut QueryKeyStringCache,
+ ) -> QueryKeyStringBuilder<'p, 'tcx> {
QueryKeyStringBuilder { profiler, tcx, string_cache }
}
@@ -99,7 +99,7 @@ impl<'p, 'c, 'tcx> QueryKeyStringBuilder<'p, 'c, 'tcx> {
}
trait IntoSelfProfilingString {
- fn to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_, '_>) -> StringId;
+ fn to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId;
}
// The default implementation of `IntoSelfProfilingString` just uses `Debug`
@@ -109,7 +109,7 @@ trait IntoSelfProfilingString {
impl<T: Debug> IntoSelfProfilingString for T {
default fn to_self_profile_string(
&self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
+ builder: &mut QueryKeyStringBuilder<'_, '_>,
) -> StringId {
let s = format!("{:?}", self);
builder.profiler.alloc_string(&s[..])
@@ -117,60 +117,42 @@ impl<T: Debug> IntoSelfProfilingString for T {
}
impl<T: SpecIntoSelfProfilingString> IntoSelfProfilingString for T {
- fn to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_, '_>) -> StringId {
+ fn to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId {
self.spec_to_self_profile_string(builder)
}
}
#[rustc_specialization_trait]
trait SpecIntoSelfProfilingString: Debug {
- fn spec_to_self_profile_string(
- &self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
- ) -> StringId;
+ fn spec_to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId;
}
impl SpecIntoSelfProfilingString for DefId {
- fn spec_to_self_profile_string(
- &self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
- ) -> StringId {
+ fn spec_to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId {
builder.def_id_to_string_id(*self)
}
}
impl SpecIntoSelfProfilingString for CrateNum {
- fn spec_to_self_profile_string(
- &self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
- ) -> StringId {
+ fn spec_to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId {
builder.def_id_to_string_id(self.as_def_id())
}
}
impl SpecIntoSelfProfilingString for DefIndex {
- fn spec_to_self_profile_string(
- &self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
- ) -> StringId {
+ fn spec_to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId {
builder.def_id_to_string_id(DefId { krate: LOCAL_CRATE, index: *self })
}
}
impl SpecIntoSelfProfilingString for LocalDefId {
- fn spec_to_self_profile_string(
- &self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
- ) -> StringId {
+ fn spec_to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId {
builder.def_id_to_string_id(DefId { krate: LOCAL_CRATE, index: self.local_def_index })
}
}
impl<T: SpecIntoSelfProfilingString> SpecIntoSelfProfilingString for WithOptConstParam<T> {
- fn spec_to_self_profile_string(
- &self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
- ) -> StringId {
+ fn spec_to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId {
// We print `WithOptConstParam` values as tuples to make them shorter
// and more readable, without losing information:
//
@@ -205,10 +187,7 @@ where
T0: SpecIntoSelfProfilingString,
T1: SpecIntoSelfProfilingString,
{
- fn spec_to_self_profile_string(
- &self,
- builder: &mut QueryKeyStringBuilder<'_, '_, '_>,
- ) -> StringId {
+ fn spec_to_self_profile_string(&self, builder: &mut QueryKeyStringBuilder<'_, '_>) -> StringId {
let val0 = self.0.to_self_profile_string(builder);
let val1 = self.1.to_self_profile_string(builder);