about summary refs log tree commit diff
path: root/library/std/src
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume1.gomez@gmail.com>2024-11-26 15:32:17 +0100
committerGitHub <noreply@github.com>2024-11-26 15:32:17 +0100
commita06532e6391fea733790e4f8c8ce20f89775fb61 (patch)
treee6e2b69c582eb3e5aa66769b1e20fbdb91d758c7 /library/std/src
parent7e3422fab2498d912df127ba0a6fd1e3c29f614d (diff)
parent8bc8adb8dcaa268e2b2bd9093f8f4f4bcb0b1a45 (diff)
downloadrust-a06532e6391fea733790e4f8c8ce20f89775fb61.tar.gz
rust-a06532e6391fea733790e4f8c8ce20f89775fb61.zip
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``
Diffstat (limited to 'library/std/src')
-rw-r--r--library/std/src/thread/current.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/library/std/src/thread/current.rs b/library/std/src/thread/current.rs
index b9b959f9894..1048ef97356 100644
--- a/library/std/src/thread/current.rs
+++ b/library/std/src/thread/current.rs
@@ -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"
         )
     }
 }