-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Stabilize std::panic::Location::file_as_c_str
#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
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: Concerns:
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. |
@traviscross I can mention it in the docs for |
@rfcbot reviewed |
🔔 This is now entering its final comment period, as per the review above. 🔔 |
Naming bikeshedThe existing std usage of A method that returns a |
@rfcbot concern name @jdahlstrom raises a good point. Let's hold this with a concern and nominate for libs-api for consideration. Mentioned this on the tracking issue here: |
This comment was marked as resolved.
This comment was marked as resolved.
🔔 This is now entering its final comment period, as per the review above. 🔔 |
e309bb4
to
53134da
Compare
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
53134da
to
46727f4
Compare
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
Note that althought the T-lang FCP has passed, the T-libs-api FCP is still open and waiting for checkmarks. |
I think the libs-api FCP finished 2 days ago (#141727 (comment)) so this should be good to go now AFAICT. Worst case we will have ~12 weeks to revert or adjust if I missed something in the multiple threads on this... @bors r+ |
…k-Simulacrum Stabilize `std::panic::Location::file_as_c_str` Closes: rust-lang#141727 Nominating this for T-lang as per `@traviscross` rust-lang#141727 (comment)
…k-Simulacrum Stabilize `std::panic::Location::file_as_c_str` Closes: rust-lang#141727 Nominating this for T-lang as per ``@traviscross`` rust-lang#141727 (comment)
Rollup of 6 pull requests Successful merges: - #140983 (Improve doc of some methods that take ranges) - #144091 (Stabilize `new_zeroed_alloc`) - #145664 (Stabilize `std::panic::Location::file_as_c_str`) - #146744 (Deref related cleanups in ref_prop) - #146793 (naked_asm: emit a label starting with `func_end`) - #146822 (Fix old typo in lang_start_internal comment) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 6 pull requests Successful merges: - #140983 (Improve doc of some methods that take ranges) - #144091 (Stabilize `new_zeroed_alloc`) - #145664 (Stabilize `std::panic::Location::file_as_c_str`) - #146744 (Deref related cleanups in ref_prop) - #146793 (naked_asm: emit a label starting with `func_end`) - #146822 (Fix old typo in lang_start_internal comment) r? `@ghost` `@rustbot` modify labels: rollup
Rollup of 8 pull requests Successful merges: - #140983 (Improve doc of some methods that take ranges) - #144091 (Stabilize `new_zeroed_alloc`) - #145664 (Stabilize `std::panic::Location::file_as_c_str`) - #146551 (fix issue with `cmse-nonsecure-entry` ABI being both async and c-variadic) - #146744 (Deref related cleanups in ref_prop) - #146793 (naked_asm: emit a label starting with `func_end`) - #146820 (Add unstable attribute to BTreeMap-related allocator generics) - #146822 (Fix old typo in lang_start_internal comment) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #145664 - Darksonn:stab-file-with-nul, r=Mark-Simulacrum Stabilize `std::panic::Location::file_as_c_str` Closes: #141727 Nominating this for T-lang as per ```@traviscross``` #141727 (comment)
Closes: #141727
Nominating this for T-lang as per @traviscross #141727 (comment)