Skip to content

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion library/core/src/panic/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ impl<'a> Location<'a> {
/// This is useful for interop with APIs that expect C/C++ `__FILE__` or
/// `std::source_location::file_name`, both of which return a nul-terminated `const char*`.
#[must_use]
#[unstable(feature = "file_with_nul", issue = "141727")]
#[inline]
#[stable(feature = "file_with_nul", since = "CURRENT_RUSTC_VERSION")]
#[rustc_const_stable(feature = "file_with_nul", since = "CURRENT_RUSTC_VERSION")]
pub const fn file_with_nul(&self) -> &CStr {
let filename = self.filename.as_ptr();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//@ run-pass
#![feature(file_with_nul)]

#[track_caller]
const fn assert_file_has_trailing_zero() {
Expand Down
Loading