Prefer `Option::map`/etc over `match` wherever it improves clarity
This isn't intended to change behavior anywhere. A lot of times statements like `match x { None => None, Some(y) => [...] }` can be rewritten using `Option::map` or `Option::and_then` in a way that preserves or improves clarity, so that's what I've done here.
I think it's particularly valuable to keep things in `libcore` and `libstd` pretty/idiomatic since it's not uncommon to follow the `[src]` links when browsing the rust-lang.org docs for std/core. If there's any concern about pushing style-based changes though, I'll happily back out the non-std/core commits here.
impl PartialEq+Eq for BuildHasherDefault
`BuildHasherDefault`is only one way of implementing `BuildHasher`. Clearly, every `BuildHasherDefault` for the same type `H` is identical, since it just uses `Default<H>` to construct `H`. In general, this is not true for every `BuildHasher`, so I think it is helpful to implement `PartialEq` and `Eq`.
Add unaligned volatile intrinsics
Surprisingly enough, it turns out that unaligned volatile loads are actually useful for certain (very niche) types of lock-free code. I included unaligned volatile stores for completeness, but I currently do not know of any use cases for them.
These are only exposed as intrinsics for now. If they turn out to be useful in practice, we can work towards stabilizing them.
r? @alexcrichton
Refactor rustdoc
This is based on https://github.com/rust-lang/rust/pull/52194 and so shouldn't be merged until it gets merged.
Now that plugin functionality has been removed, let's kill PluginManager. Additionally, rustdoc now follows the standard cargo layout instead of dumping everything at the top level.
r? @rust-lang/rustdoc
rustdoc: set panic output before starting compiler thread pool
When the compiler was updated to run on a thread pool, rustdoc's processing of compiler/doctest stderr/stdout was moved into each compiler thread. However, this caused output of the test to be lost if the test failed at *runtime* instead of compile time. This change sets up the `set_panic` call and output bomb before starting the compiler thread pool, so that the `Drop` call that writes back to the test's stdout happens after the test runs, not just after it compiles.
Fixes https://github.com/rust-lang/rust/issues/51162
doc: Clarify the lifetime returned by `Box::leak`
`Box::leak` mentions that it can return a `'static` reference, but it
wasn't immediately clear to me why it doesn't always do so. This is
because of the `T: 'a` constraint needed to form a valid reference, and
in general we want to be more flexible than requiring `T: 'static`.
This patch tries to clarify the relationship between `T` and `'a`.
Rollup of 10 pull requests
Successful merges:
- #52538 (Remove obsolete flags in the i586_musl Dockerfile)
- #52548 (Cursor: update docs to clarify Cursor only works with in-memory buffers)
- #52605 (Do not suggest using `to_owned()` on `&str += &str`)
- #52621 (Fix color detection for Windows msys terminals.)
- #52622 (Use MultiSpan in E0707 and E709)
- #52627 (Compile rustc before building tests for rustdoc)
- #52637 (Don't use NonNull::dangling as sentinel value in Rc, Arc)
- #52640 (Forget Waker when cloning LocalWaker)
- #52641 (Simplify 2 functions in rustc_mir/dataflow)
- #52642 (Replace a few expect+format combos with unwrap_or_else+panic)
Failed merges:
r? @ghost
Simplify 2 functions in rustc_mir/dataflow
- `graphviz::outgoing`: the `enumerate` only provides indices; use a range instead
- `DataflowState::interpret_set`: change a push loop to an iterator and remove the `each_bit` helper function
Forget Waker when cloning LocalWaker
Since NonNull is Copy the inner field of the cloned Waker was copied for
use in the new LocalWaker, however this left Waker to be dropped. Which
means that when cloning LocalWaker would also erroneously call drop_raw.
This change forgets the Waker, rather then dropping it, leaving the
inner field to be used by the returned LocalWaker.
Closes#52629.
Do not suggest using `to_owned()` on `&str += &str`
- Don't provide incorrect suggestion for `&str += &str` (fix#52410)
- On `&str + String` suggest `&str.to_owned() + &String` as a single suggestion
Cursor: update docs to clarify Cursor only works with in-memory buffers
Reduce misconceptions about Cursor being more general than it really is.
Fixes: #52470