Unify id-based thread parking implementations
Multiple platforms currently use thread-id-based parking implementations (NetBSD and SGX[^1]). Even though the strategy does not differ, these are duplicated for each platform, as the id is encoded into an atomic thread variable in different ways for each platform.
Since `park` is only called by one thread, it is possible to move the thread id into a separate field. By ensuring that the field is only written to once, before any other threads access it, these accesses can be unsynchronized, removing any restrictions on the size and niches of the thread id.
This PR also renames the internal `thread_parker` modules to `thread_parking`, as that name now better reflects their contents. I hope this does not add too much reviewing noise.
r? `@m-ou-se`
`@rustbot` label +T-libs
[^1]: SOLID supports this as well, I will switch it over in a follow-up PR.
Add tidy check to deny merge commits
This will prevent users with the pre-push hook from pushing a merge commit.
Exceptions are added for subtree updates. These exceptions are a little hacky and may be non-exhaustive but can be extended in the future.
I added a link to `@jyn514's` blog post for the error case because that's the best resource to solve merge commits. But it would probably be better if it was integrated into https://rustc-dev-guide.rust-lang.org/git.html#no-merge-policy, then we could link that instead.
r? `@jyn514`
Add #[inline] markers to once_cell methods
Added inline markers to all simple methods under the `once_cell` feature. Relates to #74465 and #105587
This should not block #105587
rustdoc: remove redundant CSS `.source .content { overflow: visible }`
When added in 7669f04fb0 / #16066, the page itself was set to scroll. Now it's set so that the `example-wrap` is scrolling inside the page, so the overflow setting for the content is irrelevant.
`IN6ADDR_ANY_INIT` and `IN6ADDR_LOOPBACK_INIT` documentation.
Added documentation for IPv6 Addresses `IN6ADDR_ANY_INIT` also known as `in6addr_any` and `IN6ADDR_LOOPBACK_INIT` also known as `in6addr_loopback` similar to `INADDR_ANY` for IPv4 Addresses.
Replace libstd, libcore, liballoc terminology in docs
Fixes#103551. I changed line comments containing the outdated terms as well.
It would be great if someone with more experience could weigh in on whether these changes introduce ambiguity as suggested in https://github.com/rust-lang/rust/issues/103551#issuecomment-1291225315.
doc: clearer and more correct Iterator::scan
The `Iterator::scan` documentation seemed a little misleading to my newcomer
eyes, and this tries to address that.
* I found “similar to `fold`” unhelpful because (a) the similarity is only that
they maintain state between iterations, and (b) the _dissimilarity_ is no less
important: one returns a final value and the other an iterator. So this
replaces that with “which, like `fold`, holds internal state, but unlike
`fold`, produces a new iterator.
* I found “the return value from the closure, an `Option`, is yielded by the
iterator” to be downright incorrect, because “yielded by the iterator” means
“returned by the `next` method wrapped in `Some`”, so this implied that `scan`
would convert an input iterator of `T` to an output iterator of `Option<T>`.
So this replaces “yielded by the iterator” with “returned by the `next`
method” and elaborates: “Thus the closure can return `Some(value)` to yield
`value`, or `None` to end the iteration.”
* This also changes the example to illustrate the latter point by returning
`None` to terminate the iteration early based on `state`.
Catch panics/unwinding in destruction of TLS values
`destroy_value` is/can be called from C code (libc). Unwinding from Rust to C code is undefined behavior, which is why unwinding is caught here.
This problem caused an infinite loop inside the unwinding code when running `src/test/ui/threads-sendsync/issue-24313.rs` on a tier 3 target (QNX/Neutrino) on aarch64.
See also https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Infinite.20unwinding.20bug.
This will prevent users with the pre-push hook from pushing a merge
commit.
Exceptions are added for subtree updates. These exceptions are a little
hacky and may be non-exhaustive but can be extended in the future.
Add regression test for #105501
The test was minified from the published crate `msf-ice:0.2.1` which failed in a crater run.
A faulty compiler was triggering a `higher-ranked lifetime error`:
> could not prove `[async block@...]: Send`
The testcase has some complexity, as it has a simplified subset of `futures::StreamExt` in it, but the error is only being triggered by a few layers of nesting. For example removing the noop `then` call would have been enough to make the error go away.
The test was minified from the published `msf-ice:0.2.1` crate which failed in a crater run.
A faulty compiler was triggering a `higher-ranked lifetime error`:
> could not prove `[async block@...]: Send`
Migrate more scraped examples CSS rules to CSS variables
It's based on https://github.com/rust-lang/rust/pull/106218 so it will need to wait for it to be merged first.
r? `@notriddle`
Respect --set=target.platform when building rustbuild itself
`--set=target.platform.cc` and `--set=target.platform.cxx` are ignored if target is quoted.
`--set=target.platform.linker` is ignored if RUSTFLAGS is not set.
Undo parts of
d1291dc8b4 and
1532fd8cd0
When added in 7669f04fb0 / #16066, the page
itself was set to scroll. Now it's set so that the `example-wrap` is
scrolling inside the page, so the overflow setting for the content is
irrelevant.
Rollup of 9 pull requests
Successful merges:
- #104531 (Provide a better error and a suggestion for `Fn` traits with lifetime params)
- #105899 (`./x doc library --open` opens `std`)
- #106190 (Account for multiple multiline spans with empty padding)
- #106202 (Trim more paths in obligation types)
- #106234 (rustdoc: simplify settings, help, and copy button CSS by not reusing)
- #106236 (docs/test: add docs and a UI test for `E0514` and `E0519`)
- #106259 (Update Clippy)
- #106260 (Fix index out of bounds issues in rustdoc)
- #106263 (Formatter should not try to format non-Rust files)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
Avoid quoting targets that do not contain a period.
See 1532fd8cd0
`--set=target.platform.linker` is ignored if RUSTFLAGS is not set.
Undo parts of d1291dc8b4
docs/test: add docs and a UI test for `E0514` and `E0519`
No UI test on `E0514`, it would need to compile with a different `rustc` version.
r? `@GuillaumeGomez`
rustdoc: simplify settings, help, and copy button CSS by not reusing
Since there remains only one common CSS rule shared between them, there's no point to it: the block and selector costs more than the single `width` rule saves.
Provide a better error and a suggestion for `Fn` traits with lifetime params
Given `Fn`-family traits with lifetime params in trait bounds like `fn f(_: impl Fn<'a>(&'a str) -> bool)`, we currently produce many unhelpful errors.
This PR allows these situations to suggest simply using Higher-Rank Trait Bounds like `for<'a> Fn(&'a str) -> bool`.
Fixes https://github.com/rust-lang/rust/issues/103490.
Bump rust-installer
`--without=component-a,component-b` now requires full component names. This fixesrust-lang/rust#105755 (rust-lang/rust-installer#119).
dev-static build succeeded, and installer script seems to work (see comment in thread).