Condvar: implement wait_timeout for targets without threads
This always falls back to sleeping since there is no way to notify a condvar on a target without threads.
Even on a target that has no threads the following code is a legitimate use case:
```rust
use std::sync::{Condvar, Mutex};
use std::time::Duration;
fn main() {
let cv = Condvar::new();
let mutex = Mutex::new(());
let mut guard = mutex.lock().unwrap();
cv.notify_one();
let res;
(guard, res) = cv.wait_timeout(guard, Duration::from_secs(3)).unwrap();
assert!(res.timed_out());
}
```
Impl String::into_chars
Tracking issue - https://github.com/rust-lang/rust/issues/133125
r? `@programmerjake` `@kennytm` `@Amanieu`
This refers to https://github.com/rust-lang/libs-team/issues/268
Before adding tests and creating a tracking issue, I'd like to reach a consensus on the implementation direction and two questions:
1. Whether we'd add a `String::into_char_indices` method also?
2. See inline comment.
Rollup of 6 pull requests
Successful merges:
- #133810 (remove unnecessary `eval_verify_bound`)
- #134745 (Normalize each signature input/output in `typeck_with_fallback` with its own span)
- #134989 (Lower Guard Patterns to HIR.)
- #135149 (Use a post-monomorphization typing env when mangling components that come from impls)
- #135171 (rustdoc: use stable paths as preferred canonical paths)
- #135200 (rustfmt: drop nightly-gating of the `--style-edition` flag registration)
r? `@ghost`
`@rustbot` modify labels: rollup
rustfmt: drop nightly-gating of the `--style-edition` flag registration
Follow-up to [Stabilize `style_edition = "2024"` in-tree #134929](https://github.com/rust-lang/rust/pull/134929).
#134929 un-nightly-gated the *read* of `--style-edition`, but didn't also un-nightly-gate the *registration*/*declaration* of the `--style-edition` flag itself. Reading `--style-edition` on a non-nightly channel (e.g. beta) will thus panic because `--style-edition` is never declared.
This PR also un-nightly-gates the registration. Not sure how to write a regression test for this, because this *requires* the non-nightly / beta channel. Though existing tests do fail (albeit indirectly).
Checking if this fixes the panic against beta in https://github.com/rust-lang/rust/pull/135197.
r? rustfmt
rustdoc: use stable paths as preferred canonical paths
This accomplishes something like 16a4ad7d7b, but with the `rustc_allowed_through_unstable_modules` attribute instead of the path length.
Fixes#131676
Use a post-monomorphization typing env when mangling components that come from impls
When mangling associated methods of impls, we were previously using the wrong param-env. Instead of using a fully monomorphized param-env like we usually do in codegen, we were taking the post-analysis param-env, and treating it as an early binder to *re-substitute* the impl args. I've pointed out the problematic old code in an inline comment.
This would give us param-envs with possibly trivial predicates that would prevent normalization via param-env shadowing.
In the example test linked below, `tests/ui/symbol-names/normalize-in-param-env.rs`, this happens when we mangle the impl `impl<P: Point2> MyFrom<P::S> for P` with the substitution `P = Vec2`. Because the where clause of the impl is `P: Point2`, which elaborates to `[P: Point2, P: Point, <P as Point>::S projects-to <P as Point2>::S2]` and the fact that `impl Point2 for Vec2` normalizes `Vec2::S2` to `Vec2::S`, this causes a cycle.
The proper fix here is to use a fully monomorphized param-env for the case where the impl is properly substituted.
Fixes#135143
While #134081 uncovered this bug for legacy symbol mangling, it was preexisting for v0 symbol mangling. This PR fixes both. The test requires a "hack" because we strip the args of the instance we're printing for legacy symbol mangling except for drop glue, so we box a closure to ensure we generate drop glue.
r? oli-obk
Normalize each signature input/output in `typeck_with_fallback` with its own span
Applies the same hack as #106582 but to the args in typeck. Greatly improves normalization error spans from a signature.
remove unnecessary `eval_verify_bound`
This does not impact any tests. I feel like any cases where this could useful should instead be fixed by a general improvement to `eval_verify_bound` to avoid having to promote this `TypeTest` in the first place 🤔
r? types cc ``@nikomatsakis``
Rollup of 9 pull requests
Successful merges:
- #135081 (bootstrap: Build jemalloc with support for 64K pages)
- #135174 ([AIX] Port test case run-make/reproducible-build )
- #135177 (llvm: Ignore error value that is always false)
- #135182 (Transmute from NonNull to pointer when elaborating a box deref (MCP807))
- #135187 (apply a workaround fix for the release roadblock)
- #135189 (Remove workaround from pull request template)
- #135193 (don't bless `proc_macro_deps.rs` unless it's necessary)
- #135198 (Avoid naming variables `str`)
- #135199 (Eliminate an unnecessary `Symbol::to_string`; use `as_str`)
r? `@ghost`
`@rustbot` modify labels: rollup
Avoid naming variables `str`
This renames variables named `str` to other names, to make sure `str`
always refers to a type.
It's confusing to read code where `str` (or another standard type name)
is used as an identifier. It also produces misleading syntax
highlighting.
don't bless `proc_macro_deps.rs` unless it's necessary
Running tidy with `--bless` flag is breaking the build cache as tidy updates mtime of `proc_macro_deps.rs` (https://github.com/rust-lang/rust/pull/134865) unconditionally and that leads cargo to recompile tidy.
This patch fixes that.
Remove workaround from pull request template
This PR removes the workaround (`\`) from our pull request template as triagebot/rustbot now ignores HTML blocks.
cf. https://github.com/rust-lang/triagebot/pull/1869
cc `@jieyouxu`
r? `@ehuss`
llvm: Ignore error value that is always false
See llvm/llvm-project#121851
For LLVM 20+, this function (`renameModuleForThinLTO`) has no return value. For prior versions of LLVM, this never failed, but had a signature which allowed an error value people were handling.
`@rustbot` label: +llvm-main
r? `@nikic`
Wait a moment before approving while the llvm-main infrastructure picks it up.
[AIX] Port test case run-make/reproducible-build
The test case `run-make/reproducible-build` verifies that two identical invocations of the compiler produce the same output by comparing the linker arguments, resulting binaries, and other artifacts. However, the AIX linker command includes an argument that specifies the file containing exported symbols, with a file path that contains a randomly generated substring to prevent collisions between different linking processes. Additionally, the AIX XCOFF file header includes a 4-byte timestamp. This PR replaces the random substring with a placeholder and nullifies the timestamp field in the XCOFF files for the comparisons.
This renames variables named `str` to other names, to make sure `str`
always refers to a type.
It's confusing to read code where `str` (or another standard type name)
is used as an identifier. It also produces misleading syntax
highlighting.