Skip to content

Commit

Permalink
Unrolled build for rust-lang#133464
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#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``
  • Loading branch information
rust-timer authored Nov 26, 2024
2 parents f2abf82 + 8bc8adb commit 4f63499
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions library/std/src/thread/current.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,17 @@ fn init_current(current: *mut ()) -> Thread {
// a particular API should be entirely allocation-free, feel free to open
// an issue on the Rust repository, we'll see what we can do.
rtabort!(
"\n
Attempted to access thread-local data while allocating said data.\n
Do not access functions that allocate in the global allocator!\n
This is a bug in the global allocator.\n
"
"\n\
Attempted to access thread-local data while allocating said data.\n\
Do not access functions that allocate in the global allocator!\n\
This is a bug in the global allocator.\n\
"
)
} else {
debug_assert_eq!(current, DESTROYED);
panic!(
"use of std::thread::current() is not possible after the thread's
local data has been destroyed"
"use of std::thread::current() is not possible after the thread's \
local data has been destroyed"
)
}
}
Expand Down

0 comments on commit 4f63499

Please sign in to comment.