about summary refs log tree commit diff
path: root/library/std/src/thread
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-10-31 00:33:23 +0200
committerGitHub <noreply@github.com>2021-10-31 00:33:23 +0200
commitd872d7fd00ead540d13bdf5d51d093e2c8e0b052 (patch)
treee66066cbf0b6dcbc6dcf77c3d99d213a677e4ecb /library/std/src/thread
parent2609fab8e46414333aa68412134df65c7fcd1a77 (diff)
parent6a8311cbfd19eccb57b1a1fa6974bc77db723f4a (diff)
downloadrust-d872d7fd00ead540d13bdf5d51d093e2c8e0b052.tar.gz
rust-d872d7fd00ead540d13bdf5d51d093e2c8e0b052.zip
Rollup merge of #89789 - jkugelman:must-use-thread-builder, r=joshtriplett
Add #[must_use] to thread::Builder

I copied the wording of the [`fmt::Debug` builders](https://doc.rust-lang.org/src/core/fmt/builders.rs.html#444).

Affects:

```rust
std/src/thread/mod.rs:289:5   std::thread::Builder   fn new() -> Builder;
std/src/thread/mod.rs:318:5   std::thread::Builder   fn name(mut self, name: String) -> Builder;
std/src/thread/mod.rs:341:5   std::thread::Builder   fn stack_size(mut self, size: usize) -> Builder;
```

Parent issue: #89692

r? `@joshtriplett`
Diffstat (limited to 'library/std/src/thread')
-rw-r--r--library/std/src/thread/mod.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs
index 1a5cf5ab822..0c1ffeb1a79 100644
--- a/library/std/src/thread/mod.rs
+++ b/library/std/src/thread/mod.rs
@@ -257,6 +257,7 @@ pub const fn require_unstable_const_init_thread_local() {}
 /// [`unwrap`]: crate::result::Result::unwrap
 /// [naming-threads]: ./index.html#naming-threads
 /// [stack-size]: ./index.html#stack-size
+#[must_use = "must eventually spawn the thread"]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[derive(Debug)]
 pub struct Builder {