You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
panic::LocationDebug implementation now prints a byte array #142279
FYI, I was continuing to work on #142216 and wanted to make proposals based on after this change, so I merged it in, and, this might be a small issue but I noticed that backslashes in the path are printed twice on Windows (this has debug_refcell enabled in library/core):
PS C:\Users\neals\refcell-test> cargo +stage1 clean ; cargo +stage1 run
Removed 28 files, 4.4MiB total
Compiling refcell-test v0.1.0 (C:\Users\neals\refcell-test)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.39s
Running `target\debug\refcell-test.exe`
Hello, world! RefCell { value: 5 }
thread 'main' panicked at src\main.rs:10:15:
already borrowed: BorrowMutError { location: Location { file: "src\\main.rs", line: 7, column: 15 } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\refcell-test.exe` (exit code: 101)
PS C:\Users\neals\refcell-test> cargo +stage1 clean ; cargo +stage1 run
Without this change at HEAD, if you look at the bytes printed there is one backslash (92) in the byte array:
PS C:\Users\neals\refcell-test> cargo +stage1 clean ; cargo +stage1 run
Removed 28 files, 4.4MiB total
Compiling refcell-test v0.1.0 (C:\Users\neals\refcell-test)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.61s
Running `target\debug\refcell-test.exe`
Hello, world! RefCell { value: 5 }
thread 'main' panicked at src\main.rs:10:15:
already borrowed: BorrowMutError { location: Location { file_bytes_with_nul: [115, 114, 99, 92, 109, 97, 105, 110, 46, 114, 115, 0], line: 7, col: 15 } }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: process didn't exit successfully: `target\debug\refcell-test.exe` (exit code: 101)
@nealsid isn't that the same way it printed before the regression to printing bytes?
Usually the Debug implementations are intended so you could copy+paste them to source, which means strings are escaped. The Display implementation shouldn't have this.
@tgross35 you're right, building at 61413ae (the parent of the commit that caused the regression) shows that it was escaped previously as well. Thanks.
Activity
tgross35 commentedon Jun 10, 2025
@cramertj is there a reason
file_bytes_with_nulwasn't made aCStrin #135054? Other than.file()becomingO(n)once it becomes a thin pointer.Might just need a handwritten debug implementation otherwise.
tgross35 commentedon Jun 10, 2025
Cc @m-ou-se from the review ^
nealsid commentedon Jun 12, 2025
FYI, I was continuing to work on #142216 and wanted to make proposals based on after this change, so I merged it in, and, this might be a small issue but I noticed that backslashes in the path are printed twice on Windows (this has
debug_refcellenabled inlibrary/core):Without this change at HEAD, if you look at the bytes printed there is one backslash (92) in the byte array:
tgross35 commentedon Jun 13, 2025
@nealsid isn't that the same way it printed before the regression to printing bytes?
Usually the
Debugimplementations are intended so you could copy+paste them to source, which means strings are escaped. TheDisplayimplementation shouldn't have this.nealsid commentedon Jun 13, 2025
@tgross35 you're right, building at 61413ae (the parent of the commit that caused the regression) shows that it was escaped previously as well. Thanks.
Rollup merge of rust-lang#142373 - m-ou-se:debug-for-location, r=tgro…
Rollup merge of rust-lang#142373 - m-ou-se:debug-for-location, r=tgro…
Unrolled build for #142373
Rollup merge of #142373 - m-ou-se:debug-for-location, r=tgross35
Rollup merge of rust-lang#142373 - m-ou-se:debug-for-location, r=tgro…