Skip to content

Commit 7ec49b0

Browse files
Auto merge of #145928 - Darksonn:file_as_c_str, r=<try>
Rename `Location::file_with_nul` to `file_as_c_str` try-job: x86_64-rust-for-linux
2 parents b2dd217 + 2d36a83 commit 7ec49b0

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

library/core/src/panic/location.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use crate::ptr::NonNull;
3939
pub struct Location<'a> {
4040
// A raw pointer is used rather than a reference because the pointer is valid for one more byte
4141
// than the length stored in this pointer; the additional byte is the NUL-terminator used by
42-
// `Location::file_with_nul`.
42+
// `Location::file_as_c_str`.
4343
filename: NonNull<str>,
4444
line: u32,
4545
col: u32,
@@ -195,7 +195,7 @@ impl<'a> Location<'a> {
195195
#[must_use]
196196
#[unstable(feature = "file_with_nul", issue = "141727")]
197197
#[inline]
198-
pub const fn file_with_nul(&self) -> &'a CStr {
198+
pub const fn file_as_c_str(&self) -> &'a CStr {
199199
let filename = self.filename.as_ptr();
200200

201201
// SAFETY: The filename is valid for `filename_len+1` bytes, so this addition can't

src/ci/docker/scripts/rfl-build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -euo pipefail
44

5-
LINUX_VERSION=v6.16-rc1
5+
LINUX_VERSION=7a0a1152bc8dd86a6f12782595688fcc23e990cd
66

77
# Build rustc, rustdoc, cargo, clippy-driver and rustfmt
88
../x.py build --stage 2 library rustdoc clippy rustfmt
@@ -22,7 +22,7 @@ rm -rf linux || true
2222
# Download Linux at a specific commit
2323
mkdir -p linux
2424
git -C linux init
25-
git -C linux remote add origin https://github.com/Rust-for-Linux/linux.git
25+
git -C linux remote add origin https://github.com/Darksonn/linux.git
2626
git -C linux fetch --depth 1 origin ${LINUX_VERSION}
2727
git -C linux checkout FETCH_HEAD
2828

tests/ui/rfcs/rfc-2091-track-caller/file-is-nul-terminated.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
const fn assert_file_has_trailing_zero() {
66
let caller = core::panic::Location::caller();
77
let file_str = caller.file();
8-
let file_with_nul = caller.file_with_nul();
9-
if file_str.len() != file_with_nul.count_bytes() {
8+
let file_cstr = caller.file_as_c_str();
9+
if file_str.len() != file_cstr.count_bytes() {
1010
panic!("mismatched lengths");
1111
}
1212
let trailing_byte: core::ffi::c_char = unsafe {
13-
*file_with_nul.as_ptr().offset(file_with_nul.count_bytes() as _)
13+
*file_cstr.as_ptr().offset(file_cstr.count_bytes() as _)
1414
};
1515
if trailing_byte != 0 {
1616
panic!("trailing byte was nonzero")

0 commit comments

Comments
 (0)