about summary refs log tree commit diff
path: root/library/std/src/thread
diff options
context:
space:
mode:
authorjoboet <jonasboettiger@icloud.com>2024-04-03 14:33:43 +0200
committerjoboet <jonasboettiger@icloud.com>2024-04-03 14:33:43 +0200
commit061d8731fb0ab1d57d7a289fd0ded173ceef8a64 (patch)
treeb8bd5dbc47a0504a3f14b652253d61aa0ab8b263 /library/std/src/thread
parente7b5730d36740035b9cf58b759be87d0d88515a7 (diff)
downloadrust-061d8731fb0ab1d57d7a289fd0ded173ceef8a64.tar.gz
rust-061d8731fb0ab1d57d7a289fd0ded173ceef8a64.zip
std: add comment about abort motivation
Diffstat (limited to 'library/std/src/thread')
-rw-r--r--library/std/src/thread/mod.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index a97122ca120..ae3dfef4870 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -686,6 +686,8 @@ thread_local! {
 ///
 /// Aborts if the handle has been set already to reduce code size.
 pub(crate) fn set_current(thread: Thread) {
+    // Using `unwrap` here can add ~3kB to the binary size. We have complete
+    // control over where this is called, so just abort if there is a bug.
     CURRENT.with(|current| match current.set(thread) {
         Ok(()) => {}
         Err(_) => rtabort!("should only be set once"),