Clean UI tests 2 of n
Modified 4 tests in tests/ui. Cleaned 3 and deleted one.
I have a final commit changing the values in `src/tools/tidy/src/ui_tests.rs`.
I wasn't sure if it was best practice to change this value as you go along or
once at the end. I can rebase to something that incrementally changes the value
in the "cleaned" commits if that is preferred.
Related Issues:
#73494#133895
r? jieyouxu
Add stack overflow handler for cygwin
The cygwin runtime handles stack overflow exception and converts it to `SIGSEGV`, but the passed `si_addr` is obtained from `ExceptionInformation[1]` which is actually an undocumented value when stack overflows. Thus I choose to use Windows API directly to register handler, just like how std does on native Windows. The code is basically copied from the Windows one.
Ref:
* 5ec497dc80/winsup/cygwin/exceptions.cc (L822-L823)
* https://learn.microsoft.com/zh-cn/windows/win32/api/winnt/ns-winnt-exception_record
jsondocck: Replace `jsonpath_lib` with `jsonpath-rust`
The current jsonpath implementation we use isn't spec-compliant, and is buggy. See https://github.com/freestrings/jsonpath/issues/91
To solve it, it's replaced with https://github.com/besok/jsonpath-rust. This is spec-compiant, and doesn't have a really awkward bug we need to always dance around.
Unfortunately, this requires rewriting almost every test, as the behaviour of `[?(```@`,``` which is *extremely* common was changed. (But the new behaviour makes way more sense, and isn't buggy with tripply nested selectors)
Unblocks #110406. Makes #100515 much easier as we don't need to explain the broken JSONPath implementation
Best reviewed commit-by-commit. The first does the replacement. The next two rewrite the test-suite mechanically. The last rewrites the test-suite by hand.
r? ```@GuillaumeGomez```
Cleanup `LangString::parse`
Flatten some `if`s into match patterns
Use `str::strip_prefix` instead of `starts_with`+indexing
Avoid redundant tests for `extra.is_some()`
Reduce FormattingOptions to 64 bits
This is part of https://github.com/rust-lang/rust/issues/99012
This reduces FormattingOptions from 6-7 machine words (384 bits on 64-bit platforms, 224 bits on 32-bit platforms) to just 64 bits (a single register on 64-bit platforms).
Before:
```rust
pub struct FormattingOptions {
flags: u32, // only 6 bits used
fill: char,
align: Option<Alignment>,
width: Option<usize>,
precision: Option<usize>,
}
```
After:
```rust
pub struct FormattingOptions {
/// Bits:
/// - 0-20: fill character (21 bits, a full `char`)
/// - 21: `+` flag
/// - 22: `-` flag
/// - 23: `#` flag
/// - 24: `0` flag
/// - 25: `x?` flag
/// - 26: `X?` flag
/// - 27: Width flag (if set, the width field below is used)
/// - 28: Precision flag (if set, the precision field below is used)
/// - 29-30: Alignment (0: Left, 1: Right, 2: Center, 3: Unknown)
/// - 31: Always set to 1
flags: u32,
/// Width if width flag above is set. Otherwise, always 0.
width: u16,
/// Precision if precision flag above is set. Otherwise, always 0.
precision: u16,
}
```
Match what `std::io::Empty` does, since it is very similar. However,
still evaluate the `fmt::Arguments` in `write_fmt` to be consistent with
other platforms.
Since array and slice constants are now lowered to array and slice
patterns, `non_scalar_compare` was only called for string comparisons.
This specializes it to strings, renames it, and removes the unused
array-unsizing logic.
This also updates some outdated doc comments.
Update cargo
14 commits in 6cf8267012570f63d6b86e85a2ae5627de52df9e..307cbfda3119f06600e43cd38283f4a746fe1f8b
2025-03-14 15:25:36 +0000 to 2025-03-20 20:00:39 +0000
- feat: Add custom completer for cargo <TAB> to complete aliases defined in config.toml (rust-lang/cargo#15319)
- fix(build-dir): Renamed workspace-manifest-path-hash to workspace-path-hash (rust-lang/cargo#15334)
- feat: vcs, color, and message format native completion (rust-lang/cargo#15322)
- Fix `[env]` `relative` description in reference (rust-lang/cargo#15332)
- chore: fix some typos (rust-lang/cargo#15329)
- Cleanup for rustc-link-arg-cdylib (rust-lang/cargo#15326)
- fix(toml): Report '<target>.edition' deprecation to users (rust-lang/cargo#15321)
- test(build-std): address overly-matched snapshot (rust-lang/cargo#15325)
- Added `build.build_dir` templating support (rust-lang/cargo#15236)
- docs: make it clearer that `rust_version` is enforced during compile (rust-lang/cargo#15303)
- feat: Add custom completer for cargo +<TAB> to complete toolchain name (rust-lang/cargo#15301)
- chore: fix some typos (rust-lang/cargo#15316)
- fix: deduplicate crate types in cargo rustc command (rust-lang/cargo#15314)
- docs: mention wrong URLs as a cause of git authentication errors (rust-lang/cargo#15304)
r? ghost
An assignment such as
(a, b) = (b, c);
desugars to the HIR
{ let (lhs, lhs) = (b, c); a = lhs; b = lhs; };
The repeated `lhs` leads to multiple Locals assigned to the same DILocalVariable. Rather than
attempting to fix that, get rid of the debug info for these bindings that don't even exist
in the program to begin with.
Fixes#138198
Avoid no-op unlink+link dances in incr comp
Incremental compilation scales quite poorly with the number of CGUs. This PR improves one reason for that.
The incr comp process hard-links all the files from an old session into a new one, then it runs the backend, which may just hard-link the new session files into the output directory. Then codegen hard-links all the output files back to the new session directory.
This PR (perhaps unimaginatively) fixes the silliness that ensues in the last step. The old `link_or_copy` implementation would be passed pairs of paths which are already the same inode, then it would blindly delete the destination and re-create the hard-link that it just deleted. This PR lets us skip both those operations. We don't skip the other two hard-links.
`cargo +stage1 b && touch crates/core/main.rs && strace -cfw -elink,linkat,unlink,unlinkat cargo +stage1 b` before and then after on `ripgrep-13.0.0`:
```
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
52.56 0.024950 25 978 485 unlink
34.38 0.016318 22 727 linkat
13.06 0.006200 24 249 unlinkat
------ ----------- ----------- --------- --------- ----------------
100.00 0.047467 24 1954 485 total
```
```
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
42.83 0.014521 57 252 unlink
38.41 0.013021 26 486 linkat
18.77 0.006362 25 249 unlinkat
------ ----------- ----------- --------- --------- ----------------
100.00 0.033904 34 987 total
```
This reduces the number of hard-links that are causing perf troubles, noted in https://github.com/rust-lang/rust/issues/64291 and https://github.com/rust-lang/rust/issues/137560
Rollup of 9 pull requests
Successful merges:
- #138364 (ports the compiler test cases to new rust_intrinsic format)
- #138570 (add `naked_functions_target_feature` unstable feature)
- #138623 ([bootstrap] Use llvm_runtimes for compiler-rt)
- #138627 (Autodiff cleanups)
- #138669 (tests: accept some noise from LLVM 21 in symbols-all-mangled)
- #138706 (Improve bootstrap git modified path handling)
- #138709 (Update GCC submodule)
- #138717 (Add an attribute that makes the spans from a macro edition 2021, and fix pin on edition 2024 with it)
- #138721 (Use explicit cpu in some asm and codegen tests.)
r? `@ghost`
`@rustbot` modify labels: rollup
Use explicit cpu in some asm and codegen tests.
Some tests expect to be compiled for a specific CPU or require certain target features to be present (or absent). These tests work fine with default CPUs but fail in downstream builds for RHEL and Fedora, where we use non-default CPUs such as z13 on s390x, pwr9 on ppc64le, or x86-64-v2/x86-64-v3 on x86_64.
This is similar to #124597.
Add an attribute that makes the spans from a macro edition 2021, and fix pin on edition 2024 with it
Fixes a regression, see issue below. This is a temporary fix, super let is the real solution.
Closes#138596
tests: accept some noise from LLVM 21 in symbols-all-mangled
I'm not entirely sure this is correct, but it doesn't feel obviously-wrong so I figured I'd just start by sending a PR rather than filing a bug and letting it linger.
``@rustbot`` label llvm-main
[bootstrap] Use llvm_runtimes for compiler-rt
Trying to enable `compiler-rt` via `LLVM_ENABLE_PROJECTS` is no longer a supported option in LLVM, and gives you nasty warnings:
```
Using LLVM_ENABLE_PROJECTS=compiler-rt is deprecated now, and will become a
fatal error in the LLVM 21 release. Please use
-DLLVM_ENABLE_RUNTIMES=compiler-rt or see the instructions at
https://compiler-rt.llvm.org/ for building the runtimes.
```
try-job: aarch64-gnu-debug
try-job: x86_64-gnu-debug
add `naked_functions_target_feature` unstable feature
tracking issue: https://github.com/rust-lang/rust/issues/138568
tagging https://github.com/rust-lang/rust/pull/134213https://github.com/rust-lang/rust/issues/90957
This PR puts `#[target_feature(/* ... */)]` on `#[naked]` functions behind its own feature gate, so that naked functions can be stabilized. It turns out that supporting `target_feature` on naked functions is tricky on some targets, so we're splitting it out to not block stabilization of naked functions themselves. See the tracking issue for more information and workarounds.
Note that at the time of writing, the `target_features` attribute is ignored when generating code for naked functions.
r? ``@Amanieu``
Simplify CI LLVM checks in bootstrap
Extracted out of https://github.com/rust-lang/rust/pull/138591. Apart from simplifying the checks, it will make it easier to run E2E tests of bootstrap on a mostly empty directory without checking out LLVM on CI :)
The commits should be mostly self-explanatory.
r? `@onur-ozkan`
They are marked with hidden visibility to prevent them from getting
exported, so we shouldn't ask the linker to export them anyway. The only
thing that does it cause a warning on macOS.
Computing the current dll path is somewhat expensive relative to other
work when compiling `fn main() {}` as `dladdr` needs to iterate over the
symbol table of librustc_driver.so until it finds a match.