Skip to content

Commit a06532e

Browse files
Rollup merge of #133464 - RalfJung:whitespace-panic, r=joboet
std::thread: avoid leading whitespace in some panic messages This: ``` panic!( "use of std::thread::current() is not possible after the thread's local data has been destroyed" ) ``` will print a newline followed by a bunch of spaces, since the entire string literal is interpreted literally. I think the intention was to print the message without the newline and the spaces, so let's add some `\` to make that happen. r? ``@joboet``
2 parents 7e3422f + 8bc8adb commit a06532e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Diff for: library/std/src/thread/current.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,17 @@ fn init_current(current: *mut ()) -> Thread {
243243
// a particular API should be entirely allocation-free, feel free to open
244244
// an issue on the Rust repository, we'll see what we can do.
245245
rtabort!(
246-
"\n
247-
Attempted to access thread-local data while allocating said data.\n
248-
Do not access functions that allocate in the global allocator!\n
249-
This is a bug in the global allocator.\n
250-
"
246+
"\n\
247+
Attempted to access thread-local data while allocating said data.\n\
248+
Do not access functions that allocate in the global allocator!\n\
249+
This is a bug in the global allocator.\n\
250+
"
251251
)
252252
} else {
253253
debug_assert_eq!(current, DESTROYED);
254254
panic!(
255-
"use of std::thread::current() is not possible after the thread's
256-
local data has been destroyed"
255+
"use of std::thread::current() is not possible after the thread's \
256+
local data has been destroyed"
257257
)
258258
}
259259
}

0 commit comments

Comments
 (0)