File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
tests/ui/rfcs/rfc-2091-track-caller Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,7 @@ use crate::ptr::NonNull;
39
39
pub struct Location < ' a > {
40
40
// A raw pointer is used rather than a reference because the pointer is valid for one more byte
41
41
// 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 `.
43
43
filename : NonNull < str > ,
44
44
line : u32 ,
45
45
col : u32 ,
@@ -195,7 +195,7 @@ impl<'a> Location<'a> {
195
195
#[ must_use]
196
196
#[ unstable( feature = "file_with_nul" , issue = "141727" ) ]
197
197
#[ inline]
198
- pub const fn file_with_nul ( & self ) -> & ' a CStr {
198
+ pub const fn file_as_c_str ( & self ) -> & ' a CStr {
199
199
let filename = self . filename . as_ptr ( ) ;
200
200
201
201
// SAFETY: The filename is valid for `filename_len+1` bytes, so this addition can't
Original file line number Diff line number Diff line change 5
5
const fn assert_file_has_trailing_zero ( ) {
6
6
let caller = core:: panic:: Location :: caller ( ) ;
7
7
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 ( ) {
10
10
panic ! ( "mismatched lengths" ) ;
11
11
}
12
12
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 _ )
14
14
} ;
15
15
if trailing_byte != 0 {
16
16
panic ! ( "trailing byte was nonzero" )
You can’t perform that action at this time.
0 commit comments