Use the interpreted program's TZ variable in localtime_r
This requires a bit of wiring and a new dependency, but the tests should correctly pass now regardless of what the host's time zone is.
Fixes https://github.com/rust-lang/miri/issues/3522
env: split up Windows and Unix environment variable handling
On Windows, manage them entirely outside the AM state; this also means we no longer report any data races for environment variable memory.
Fixes https://github.com/rust-lang/rust/issues/124411
Rollup of 4 pull requests
Successful merges:
- #124076 (Stablise io_error_downcast)
- #124378 (Keep the LIB env var in the compiler-builtins test)
- #124379 (Remove special-casing for `SimplifiedType` for next solver)
- #124381 (Renamed `DerivedObligation` to `WellFormedDeriveObligation`)
r? `@ghost`
`@rustbot` modify labels: rollup
Remove special-casing for `SimplifiedType` for next solver
It's unnecessary due to the way that we fully normalize the self type before assembly begins.
r? lcnr
Keep the LIB env var in the compiler-builtins test
The `tests/run-make/compiler-builtins` test was failing for me with Visual Studio 2022, complaining that it couldn't find `kernel32.lib`.
For whatever reason, with VS 2022 we need to keep the `LIB` environment variable when invoking Cargo so that the linker can find the Windows SDK libs.
`-Z debug-macros` is "stabilized" by enabling it by default and removing.
`-Z collapse-macro-debuginfo` is stabilized as `-C collapse-macro-debuginfo`.
It now supports all typical boolean values (`parse_opt_bool`) in addition to just yes/no.
Default value of `collapse_debuginfo` was changed from `false` to `external` (i.e. collapsed if external, not collapsed if local).
`#[collapse_debuginfo]` attribute without a value is no longer supported to avoid guessing the default.
`Range` iteration specialization: remove trivial bounds
These bounds on impl items are trivially true and never checked by a caller. They end up shadowing the actual impls, currently preventing normalization in the new solver. While we may have to fix the underlying issue in the new solver at some point, for now this is an easy way to get us closer to compiling core with `-Znext-solver`.
r? `@Nilstrieb`
Don't ICE when `codegen_select_candidate` returns ambiguity in new solver
Because we merge identical candidates, we may have >1 impl candidate to in `codegen_select_error` but *not* have a trait error.
r? lcnr
Detect borrow error involving sub-slices and suggest `split_at_mut`
```
error[E0499]: cannot borrow `foo` as mutable more than once at a time
--> $DIR/suggest-split-at-mut.rs:13:18
|
LL | let a = &mut foo[..2];
| --- first mutable borrow occurs here
LL | let b = &mut foo[2..];
| ^^^ second mutable borrow occurs here
LL | a[0] = 5;
| ---- first borrow later used here
|
= help: use `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices
```
Address most of #58792.
For follow up work, we should emit a structured suggestion for cases where we can identify the exact `let (a, b) = foo.split_at_mut(2);` call that is needed.
Improved code with clippy
I haven't used the bootstrapped compiler, but I think I have made some improvements using clippy. I have already made the following changes to the compiler:
Replaced `self.first().is_digit(10)` with `self.first().is_ascii_digit()` on lines 633, 664, and 680 of compiler/rust_lexer/src/lib.rs.
Removed unnecessary cast on line 262 of compiler/rustc_lexer/src/unescape.rs
Replaced ok_or_else with ok_or on line 303 of compiler/rustc_lexer/src/unescape.rs
Replaced `!std::env::var("RUSTC_BOOTSTRAP").is_ok()` with `std::env::var("RUSTC_BOOTSTRAP").is_err()` on line 4 of compiler/rustc_macros/build.rs
Removed needless borrow for generic argument `env`on line 53 of compiler/rust_llvm/build.rs
```
error[E0499]: cannot borrow `foo` as mutable more than once at a time
--> $DIR/suggest-split-at-mut.rs:13:18
|
LL | let a = &mut foo[..2];
| --- first mutable borrow occurs here
LL | let b = &mut foo[2..];
| ^^^ second mutable borrow occurs here
LL | a[0] = 5;
| ---- first borrow later used here
|
= help: use `.split_at_mut(position)` or similar method to obtain two mutable non-overlapping sub-slices
```
Address most of #58792.
For follow up work, we should emit a structured suggestion for cases where we can identify the exact `let (a, b) = foo.split_at_mut(2);` call that is needed.
Enforce closure args + return type are WF
I found this out when investigating https://github.com/rust-lang/rust/issues/123461#issuecomment-2040894359. Turns out we don't register WF obligations for closure args and return types, leading to the ICE.
~~I think this is a useful thing to check for, but I'd like to check what the fallout is.~~ crater is complete.
~~Worst case, I think we should enforce this across an edition boundary (and possibly eventually migrate this for all editions) -- this should be super easy to do, since this is a check in HIR wfcheck, so it can be made edition dependent.~~ I believe the regressions are manageable enough to not necessitate edition-specific behavior.
Fixes#123461