Skip to content

Commit fe24a61

Browse files
David Tolnayfacebook-github-bot
David Tolnay
authored andcommitted
Fix identifier Debug regex
Summary: [rust#135080](rust-lang/rust#135080) changed the Debug format of fat pointers. https://www.internalfb.com/code/fbsource/[26fa1e076c09b41911751f19072ddacd36439375]/third-party/rust/vendor/tracing-core-0.1.33/src/callsite.rs?lines=179%2C188-189%2C387-391 Reviewed By: muirdm Differential Revision: D75533524 fbshipit-source-id: 1cb25c8ed8405f271a9d6164760310a22a67a32f
1 parent d8a1418 commit fe24a61

File tree

1 file changed

+11
-1
lines changed
  • eden/scm/lib/tracing-runtime-callsite/src

1 file changed

+11
-1
lines changed

eden/scm/lib/tracing-runtime-callsite/src/tests.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,14 @@ fn normalize(s: &str) -> String {
166166
}
167167

168168
static THREAD_LOCK: Lazy<Mutex<()>> = Lazy::new(Default::default);
169-
static IDENTIFIER_RE: Lazy<Regex> = Lazy::new(|| Regex::new("Identifier\\([^)]*\\)").unwrap());
169+
static IDENTIFIER_RE: Lazy<Regex> = Lazy::new(|| {
170+
// tracing_core::callsite::Identifier is Debug-printed using "Identifier({:p})"
171+
// on a dyn Callsite.
172+
//
173+
// On Rust older than 1.87, it prints as:
174+
// Identifier(0x503000001960)
175+
//
176+
// and on 1.87+ as:
177+
// Identifier(Pointer { addr: 0x503000001960, metadata: DynMetadata(0x55aa5a3b14c8) })
178+
Regex::new(r#"Identifier\((0x[0-9a-f]+|Pointer \{ addr: 0x[0-9a-f]+, metadata: DynMetadata\(0x[0-9a-f]+\) \})\)"#).unwrap()
179+
});

0 commit comments

Comments
 (0)