1
Fork 0
Commit graph

284702 commits

Author SHA1 Message Date
bors
0ce1369bde Auto merge of #136974 - m-ou-se:fmt-options-64-bit, r=scottmcm
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,
}
```
2025-03-22 10:56:14 +00:00
bors
db687889a5 Auto merge of #138719 - lcnr:concrete_opaque_types-closures, r=oli-obk
merge opaque types defined in nested bodies

A small step towards https://github.com/rust-lang/types-team/issues/129

r? `@oli-obk`
2025-03-22 06:55:52 +00:00
bors
2a1c8beabf Auto merge of #138808 - weihanglo:update-cargo, r=weihanglo
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 &lt;TAB&gt; 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 '&lt;target&gt;.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 +&lt;TAB&gt; 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
2025-03-22 02:12:35 +00:00
Weihang Lo
14062b299c
Update cargo 2025-03-21 19:25:30 -04:00
bors
48b36c9d59 Auto merge of #128320 - saethlin:link-me-maybe, r=compiler-errors
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
2025-03-21 21:03:49 +00:00
bors
be73c1f461 Auto merge of #138791 - matthiaskrgr:rollup-ev46cqr, r=matthiaskrgr
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
2025-03-21 17:55:41 +00:00
Mara Bos
d7685f0d0b Add test for Formatter flags. 2025-03-21 17:05:56 +01:00
Mara Bos
9b7060ad31 Add todo comment on using a niche type for fmt flags. 2025-03-21 17:05:56 +01:00
Matthias Krüger
bc46c98dd8
Rollup merge of #138721 - jchecahi:tests-explicit-cpus, r=tgross35
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.
2025-03-21 15:48:58 +01:00
Matthias Krüger
7c2475e9aa
Rollup merge of #138717 - jdonszelmann:pin-macro, r=WaffleLapkin
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
2025-03-21 15:48:57 +01:00
Matthias Krüger
a27b21e53a
Rollup merge of #138709 - Kobzol:update-gcc, r=GuillaumeGomez
Update GCC submodule

Includes https://github.com/rust-lang/gcc/pull/66 to use our mirrors for downloading GCC dependencies.

r? ```@GuillaumeGomez```
2025-03-21 15:48:57 +01:00
Matthias Krüger
ed3a39da7f
Rollup merge of #138706 - Kobzol:bootstrap-git-refactor-1, r=onur-ozkan
Improve bootstrap git modified path handling

Drive-by improvements extracted out of https://github.com/rust-lang/rust/pull/138591.

r? ``@onur-ozkan``
2025-03-21 15:48:56 +01:00
Matthias Krüger
015df66ee2
Rollup merge of #138669 - durin42:llvm-21-anon-func-unmangled, r=bjorn3
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
2025-03-21 15:48:55 +01:00
Matthias Krüger
0c594da55f
Rollup merge of #138627 - EnzymeAD:autodiff-cleanups, r=oli-obk
Autodiff cleanups

Splitting out some cleanups to reduce the size of my batching PR and simplify ``@haenoe`` 's [PR](https://github.com/rust-lang/rust/pull/138314).

r? ``@oli-obk``

Tracking:

- https://github.com/rust-lang/rust/issues/124509
2025-03-21 15:48:55 +01:00
Matthias Krüger
a8f0c6bbcb
Rollup merge of #138623 - daltenty:daltenty/fix-compiler-rt, r=Kobzol
[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
2025-03-21 15:48:53 +01:00
Matthias Krüger
c354a97bd9
Rollup merge of #138570 - folkertdev:naked-function-target-feature-gate, r=Amanieu
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/134213 https://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``
2025-03-21 15:48:52 +01:00
Matthias Krüger
f7f287077b
Rollup merge of #138364 - BLANKatGITHUB:compiler, r=RalfJung
ports the compiler test cases to new rust_intrinsic format

pr is part of #132735
2025-03-21 15:48:51 +01:00
bors
a4a11aca5e Auto merge of #138704 - Kobzol:ci-llvm-checks, r=onur-ozkan
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`
2025-03-21 14:47:25 +00:00
Jakub Beránek
f5c59a444f Fix test using download-ci-llvm=true on CI 2025-03-21 12:23:44 +01:00
Jakub Beránek
e288faa4b0 Disable CI mode when checking default bootstrap profiles 2025-03-21 12:18:51 +01:00
Jakub Beránek
f53acd17cb Set if-unchanged as the default value for download-ci-llvm when we're on CI. 2025-03-21 12:18:50 +01:00
Jakub Beránek
68aaa8d103 Allow unused code in tests
To avoid working around some code being unused in tests due to it being stubbed out with `#[cfg(test)]`.
2025-03-21 12:18:50 +01:00
Jakub Beránek
9c05758ed4 Remove duplicated check for LLVM modifications and disable download-ci-llvm=true on CI 2025-03-21 12:18:50 +01:00
Jakub Beránek
80a5adf871 Unify LLVM invalidation path handling
Before it was using a different set of paths in different call-sites.
2025-03-21 12:18:50 +01:00
bors
4ac032f857 Auto merge of #138768 - matthiaskrgr:rollup-nfu3cm3, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #137357 (Document results of non-positive logarithms)
 - #138650 (Optimize `io::Write::write_fmt` for constant strings)
 - #138694 (Fix: add ohos target notes)
 - #138713 (interpret memory access hooks: also pass through the Pointer used for the access)
 - #138724 (Check attrs: Don't try to retrieve the name of list stems)
 - #138743 (bootstrap: add `--ci` flag)
 - #138751 (Fix the "used_with_archive" test on Fuchsia)
 - #138754 (Handle spans of `~const`, `const`  and `async` trait bounds in macro expansion)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-21 08:06:38 +00:00
Matthias Krüger
5ba395a98b
Rollup merge of #138754 - oli-obk:push-vtqtnwluyxop, r=compiler-errors
Handle spans of `~const`, `const`  and `async` trait bounds in macro expansion

r? `@compiler-errors`

`visit_span` is actually only used in one place (the `transcribe::Marker`), and all of this syntax is unstable, so while it would still be nice to write a test for it, I wager there's lots more interesting things in `transcribe::Marker` to write tests for. And the worst is some diagnostics being weird or incremental being not as incremental as it could be
2025-03-21 06:56:49 +01:00
Matthias Krüger
4447953fdd
Rollup merge of #138751 - Jeff-A-Martin:used-with-archive-test-fuchsia, r=jieyouxu
Fix the "used_with_archive" test on Fuchsia

This change adds Fuchsia OS as a target to the cfg_attr in the pre_main_constructor external declaration. This allows the "tests/ui/attributes/used_with_archive.rs" to pass against Fuchsia.
2025-03-21 06:56:49 +01:00
Matthias Krüger
828f33ce96
Rollup merge of #138743 - onur-ozkan:override-is-ci-behaviour, r=Kobzol
bootstrap: add `--ci` flag

To make bootstrap act like it's running on CI, we had to override the `GITHUB_ACTIONS` environment variable which is a hidden detail of `CiEnv::is_ci`. Now, we can use the `--ci` flag directly on bootstrap which will be documented automatically from `x --help`. This also helps us to avoid race conditions on bootstrap (overriding `GITHUB_ACTIONS` env in each test can cause that if we run the tests in parallel) tests.
2025-03-21 06:56:48 +01:00
Matthias Krüger
1135a63286
Rollup merge of #138724 - fmease:list-stems-bear-no-name, r=nnethercote
Check attrs: Don't try to retrieve the name of list stems

Fixes #138723.

r? nnethercote or compiler
2025-03-21 06:56:47 +01:00
Matthias Krüger
7c1b128383
Rollup merge of #138713 - RalfJung:memory-hook-pointers, r=oli-obk
interpret memory access hooks: also pass through the Pointer used for the access

In some ongoing work on the Miri side, we need the absolute address that the memory access occurred at. That is non-trivial to obtain since we don't have an `ecx`. So pass through the `Pointer` used for the access, which contains the address, and which is available everywhere we are calling these hooks.

r? `@oli-obk`
2025-03-21 06:56:47 +01:00
Matthias Krüger
ff8738a0f7
Rollup merge of #138694 - LuuuXXX:fix-platform-support-book, r=jieyouxu
Fix: add ohos target notes
2025-03-21 06:56:46 +01:00
Matthias Krüger
809378bd2e
Rollup merge of #138650 - thaliaarchi:io-write-fmt-known, r=ibraheemdev
Optimize `io::Write::write_fmt` for constant strings

When the formatting args to `fmt::Write::write_fmt` are a statically known string, it simplifies to only calling `write_str` without a runtime branch. Do the same in `io::Write::write_fmt` with `write_all`.

Also, match the convention of `fmt::Write` for the name of `args`.
2025-03-21 06:56:46 +01:00
Matthias Krüger
1530b03655
Rollup merge of #137357 - syvb:sv/log-docs, r=tgross35
Document results of non-positive logarithms

The integer versions of logarithm functions panic on non-positive numbers. The floating point versions have different, undocumented behaviour (-inf on 0, NaN on <0). This PR documents that.

try-job: aarch64-gnu
2025-03-21 06:56:45 +01:00
bors
5d85a714b1 Auto merge of #138761 - flip1995:clippy-subtree-update, r=Manishearth
Clippy subtree update

r? `@Manishearth`

Cargo.lock update is because of the `ui_test` dependency bump in Clippy.
2025-03-21 04:59:08 +00:00
bors
01dc45c10e Auto merge of #138760 - matthiaskrgr:rollup-2edtg2h, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #138435 (Add support for postfix yield expressions)
 - #138685 (Use `Option<Ident>` for lowered param names.)
 - #138700 (Suggest `-Whelp` when pass `--print lints` to rustc)
 - #138727 (Do not rely on `type_var_origin` in `OrphanCheckErr::NonLocalInputType`)
 - #138729 (Clean up `FnCtxt::resolve_coroutine_interiors`)
 - #138731 (coverage: Add LLVM plumbing for expansion regions)
 - #138732 (Use `def_path_str` for def id arg in `UnsupportedOpInfo`)
 - #138735 (Remove `llvm` and `llvms` triagebot ping aliases for `icebreakers-llvm` ping group)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-21 01:52:00 +00:00
bors
eda7820be5 Auto merge of #138747 - matthiaskrgr:rollup-68x44rw, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #138435 (Add support for postfix yield expressions)
 - #138685 (Use `Option<Ident>` for lowered param names.)
 - #138700 (Suggest `-Whelp` when pass `--print lints` to rustc)
 - #138727 (Do not rely on `type_var_origin` in `OrphanCheckErr::NonLocalInputType`)
 - #138729 (Clean up `FnCtxt::resolve_coroutine_interiors`)
 - #138731 (coverage: Add LLVM plumbing for expansion regions)
 - #138732 (Use `def_path_str` for def id arg in `UnsupportedOpInfo`)
 - #138735 (Remove `llvm` and `llvms` triagebot ping aliases for `icebreakers-llvm` ping group)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-03-20 22:35:15 +00:00
Philipp Krones
58142e99ae
Update Cargo.lock 2025-03-20 22:35:05 +01:00
Philipp Krones
ae31f7a024
Merge commit '1e5237f4a5' into clippy-subtree-update 2025-03-20 22:34:29 +01:00
Matthias Krüger
4a87516892
Rollup merge of #138735 - jieyouxu:drop-llvm-alias, r=nikic
Remove `llvm` and `llvms` triagebot ping aliases for `icebreakers-llvm` ping group

Because it's way too easy to confuse LLVM Icebreakers ping group versus trying to ping WG-llvm.
And AFAIK, icebreakers-llvm isn't really used in a good while.

I also fixed the rustc-dev-guide docs about ```@rustbot`` ping llvm` (and changed that to the raw ping group name ```@rustbot`` icebreakers-llvm`) because it's very confusing.

Previously discussed in [#t-compiler/wg-llvm > Ping group renaming](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fwg-llvm/topic/Ping.20group.20renaming/with/453005029).

FYI ``@rust-lang/wg-llvm``
FYI ``@RalfJung`` (since you asked in https://github.com/rust-lang/rust/pull/138120#issuecomment-2710466874)
r? ``@nikic`` (or wg-llvm)
2025-03-20 22:34:06 +01:00
Matthias Krüger
73ed8b3ace
Rollup merge of #138732 - compiler-errors:did, r=jieyouxu
Use `def_path_str` for def id arg in `UnsupportedOpInfo`

We could alternatively just omit the def path from the label, but I think it's fine to keep around

Fixes #138730
2025-03-20 22:34:06 +01:00
Matthias Krüger
7df0170fc4
Rollup merge of #138731 - Zalathar:llvm-expansion, r=jieyouxu
coverage: Add LLVM plumbing for expansion regions

This is currently unused, but paves the way for future work on expansion regions without having to worry about the FFI parts.

The span conversion refactoring is only loosely related, but I've included it here because it would conflict with the main changes in `fill_region_tables`, and is pretty straightforward on its own.
2025-03-20 22:34:05 +01:00
Matthias Krüger
84a2bb953e
Rollup merge of #138729 - compiler-errors:gen, r=lcnr
Clean up `FnCtxt::resolve_coroutine_interiors`

Random cleanups before I make a PR that stalls generator obligations.

r? lcnr
2025-03-20 22:34:04 +01:00
Matthias Krüger
46594939f4
Rollup merge of #138727 - compiler-errors:ty-var-origin, r=fmease
Do not rely on `type_var_origin` in `OrphanCheckErr::NonLocalInputType`

The ordering of ty var unification means that we may end up with a root variable whose ty var origin is from another item's params.

Let's not rely on this by just unifying the infer vars with the params of the impl + resolving. It's kinda goofy but it's clearer IMO.

Fixes #132826.

r? ``@fmease`` or ``@lcnr``
2025-03-20 22:34:03 +01:00
Matthias Krüger
d4218c2934
Rollup merge of #138700 - xizheyin:issue-138612, r=Nadrieril
Suggest `-Whelp` when pass `--print lints` to rustc

Closes #138612
2025-03-20 22:34:03 +01:00
Matthias Krüger
00f3ad0c88
Rollup merge of #138685 - nnethercote:use-Option-Ident-for-lowered-param-names, r=compiler-errors
Use `Option<Ident>` for lowered param names.

Parameter patterns are lowered to an `Ident` by `lower_fn_params_to_names`, which is used when lowering bare function types, trait methods, and foreign functions. Currently, there are two exceptional cases where the lowered param can become an empty `Ident`.

- If the incoming pattern is an empty `Ident`. This occurs if the parameter is anonymous, e.g. in a bare function type.

- If the incoming pattern is neither an ident nor an underscore. Any such parameter will have triggered a compile error (hence the `span_delayed_bug`), but lowering still occurs.

This commit replaces these empty `Ident` results with `None`, which eliminates a number of `kw::Empty` uses, and makes it impossible to fail to check for these exceptional cases.

Note: the `FIXME` comment in `is_unwrap_or_empty_symbol` is removed. It actually should have been removed in #138482, the precursor to this PR. That PR changed the lowering of wild patterns to `_` symbols instead of empty symbols, which made the mentioned underscore check load-bearing.

r? ```@compiler-errors```
2025-03-20 22:34:02 +01:00
Matthias Krüger
b3c5caf0f5
Rollup merge of #138435 - eholk:prefix-yield, r=oli-obk
Add support for postfix yield expressions

We've been having a discussion about whether we want postfix yield, or want to stick with prefix yield, or have both. I figured it's easy enough to support both for now and let us play around with them while the feature is still experimental.

This PR treats `yield x` and `x.yield` as semantically equivalent. There was a suggestion to make `yield x` have a `()` type (so it only works in coroutines with `Resume = ()`. I think that'd be worth trying, either in a later PR, or before this one merges, depending on people's opinions.

#43122
2025-03-20 22:34:01 +01:00
Timo
1e5237f4a5
fix: missing_const_for_fn FP on unstable const traits (#14294)
Closes #14020
Closes #14290
Closes #14091

Add checks for unstable const traits.

changelog: [`missing_const_for_fn`] fix FP on unstable const traits
2025-03-20 20:00:15 +00:00
Philipp Krones
d1d0fee887
Rustup (#14445)
r? @ghost

changelog: none
2025-03-20 19:52:14 +00:00
Philipp Krones
a086879e21
Bump nightly version -> 2025-03-20 2025-03-20 20:47:10 +01:00
Philipp Krones
dc4c77608e
Merge remote-tracking branch 'upstream/master' into rustup 2025-03-20 20:46:36 +01:00