-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Stabilize std::panic::Location::file_with_nul
#145664
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
base: master
Are you sure you want to change the base?
Conversation
rustbot has assigned @Mark-Simulacrum. Use |
For context, we're making a language guarantee here about how the Rust compiler must work. After we accept this, it must null-terminate the file names it stores for source location information in the binary. This guarantee is being relied upon and exposed for the first time with the stabilization of Given the benefits of this to interoperability, and the negligible cost of it, I propose that we do this. @rfcbot fcp merge We should find a place to document this guarantee in the Reference. @Darksonn, open to ideas and a PR here. cc @rust-lang/lang-docs |
Team member @traviscross has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns. |
std::panic::Location::file_with_nul
As a user report: I have a use for this API where I define tracepoints (USDT) for use with BPF tracing, dtrace etc: In particular I want to trace tokio task spawns, polls etc, and tokio exposes a As the trace point consumers (bpftrace, perf etc) expect C style strings, this would let me pass the file directly without a temporary allocation and copying. For tracepoints (that generally are expected to be minimal overhead) this is important. |
That's actually a really great use case. Unlike the RfL use case we had considered, where they could in theory solve it for themselves by adjusting some kernel code, for the use case you mention there are fewer good options. Thanks for mentioning that. |
Closes: #141727
Nominating this for T-lang as per @traviscross #141727 (comment)