Add relevant history.

This commit is contained in:
Mara Bos 2024-05-22 15:20:43 +02:00
parent 2acdaebc69
commit 71364c4c00
1 changed files with 7 additions and 0 deletions

View File

@ -236,3 +236,10 @@ to, for example, use a single allocation for multiple hook results.
- Using this in libtest for output capturing (instead of today's
implementation that has special hardcoded support in libstd).
# Relevant history
- The original reason I wrote [RFC 3184 "Thread local Cell methods"](https://github.com/rust-lang/rfcs/pull/3184)
was to simplify thread spawn hooks (which I was experimenting with at the time).
Without that RFC, thread spawn hooks would look something like `let v = X.with(|x| x.get()); || X.with(|x| x.set(v))`, instead of just `let v = X.get(); || X.set(v)`,
which is far less ergonomic (and behaves subtly differently). This is the reason I waited with this RFC until that RFC was merged and stabilized.