Commit Graph

171078 Commits

Author SHA1 Message Date
Jonathan Brouwer 1d21fd39ae Rollup merge of #152768 - ZuseZ4:autodiff-in-ci-for-all-os, r=Kobzol
Enable autodiff in ci for all major os

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152768)*

Follow-up attempt to https://github.com/rust-lang/rust/pull/140064 after moving autodiff to dlopen.
It covers Linux (x86_64+aarch64), MacOS (aarch64), Windows (mingw-llvm aarch64+x86_64)
The extra build time for Enzyme are 180.27s on our slowest runner (aarch64-apple).

The follow-up distribution via rustup probably still needs a small fix, see https://github.com/rust-lang/rust/pull/151063#issuecomment-3778937008

Placing the downloaded libEnzyme artifact on my local linux under `~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib` enables my nightly compiler to run autodiff.

r? @Kobzol

closes: https://github.com/rust-lang/rust/pull/140064
closes: https://github.com/rust-lang/rust/pull/151243
closes: https://github.com/rust-lang/rust/pull/151063
2026-02-23 20:46:10 +01:00
Jonathan Brouwer e208d670d2 Rollup merge of #153007 - lnicola:sync-from-ra, r=lnicola
`rust-analyzer` subtree update

Subtree update of `rust-analyzer` to https://github.com/rust-lang/rust-analyzer/commit/05da4cf3c4dfb8aa3430343f41e73c4cfad46bd5.

Created using https://github.com/rust-lang/josh-sync.

r? @ghost
2026-02-23 20:46:09 +01:00
The rustc-josh-sync Cronjob Bot 419ee1051d Merge ref 'c78a29473a68' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: rust-lang/rust@c78a29473a
Filtered ref: rust-lang/rust-analyzer@d21f4bf288
Upstream diff: https://github.com/rust-lang/rust/compare/139651428df86cf88443295542c12ea617cbb587...c78a29473a68f07012904af11c92ecffa68fcc75

This merge was created using https://github.com/rust-lang/josh-sync.
2026-02-23 04:45:13 +00:00
The rustc-josh-sync Cronjob Bot 1b5a80cf4b Prepare for merging from rust-lang/rust
This updates the rust-version file to c78a29473a.
2026-02-23 04:45:04 +00:00
Stuart Cook 6bcb461903 Rollup merge of #149783 - folkertdev:stabilize-cfg-select, r=JonathanBrouwer
stabilize `cfg_select!`

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/149783)*

tracking issue: https://github.com/rust-lang/rust/issues/115585
closes https://github.com/rust-lang/rust/issues/115585
reference PR:

- https://github.com/rust-lang/reference/pull/2103

# Request for Stabilization

## Summary

The `cfg_select!` macro picks the expansion corresponding to the first `cfg` condition that evaluates to `true`. It simplifies complex conditional expressions.

```rust
cfg_select! {
    unix => {
        fn foo() { /* unix specific functionality */ }
    }
    target_pointer_width = "32" => {
        fn foo() { /* non-unix, 32-bit functionality */ }
    }
    _ => {
        fn foo() { /* fallback implementation */ }
    }
}

let is_unix_str = cfg_select! {
    unix => "unix",
    _ => "not unix",
};
println!("{is_unix_str}");
```
## Semantics

The expansion of a `cfg_select!` call is the right-hand side of the first `cfg` rule that evaluates to true.

This can be roughly expressed using this macro:
```rust
macro_rules! cfg_select {
    ({ $($tt:tt)* }) => {{
        $crate::cfg_select! { $($tt)* }
    }};
    (_ => { $($output:tt)* }) => {
        $($output)*
    };
    (
        $cfg:meta => $output:tt
        $($( $rest:tt )+)?
    ) => {
        #[cfg($cfg)]
        $crate::cfg_select! { _ => $output }
        $(
            #[cfg(not($cfg))]
            $crate::cfg_select! { $($rest)+ }
        )?
    }
}
```

The actual implementation uses a builtin macro so that `cfg_select!` can be used both in item and expression position.

## Documentation

reference PR:

- https://github.com/rust-lang/reference/pull/2103

## Tests

The `cfg_select!` macro is already used extensively in the rust compiler codebase. It has several dedicated tests:

- [`tests/ui/check-cfg/cfg-select.rs`](https://github.com/rust-lang/rust/blob/main/tests/ui/check-cfg/cfg-select.rs)tests that warnings are emitted when an unexpected `cfg` condition is used.
- [`tests/ui/macros/cfg_select.rs`](https://github.com/rust-lang/rust/blob/main/tests/ui/macros/cfg_select.rs) tests that `cfg_select!` has the expected expansion, and tests that the expected syntax is accepted.
## History

- rust-lang/rust#115416
- rust-lang/rust#117162
- rust-lang/rust#133720
- rust-lang/rust#135625
- rust-lang/rust#137198
- rust-lang/rust#138993
- rust-lang/rust#138996
- rust-lang/rust#143461
- rust-lang/rust#143941
- rust-lang/rust#145233
- rust-lang/rust#148712
- rust-lang/rust#149380
- https://github.com/rust-lang/rust/pull/149925

# Resolved questions

# Unresolved questions

The style team has decided on how to format `cfg_select!`, but this formatting has not yet been implemented. See https://github.com/rust-lang/rust/pull/144323.

r? @traviscross

<!-- TRIAGEBOT_START -->

<!-- TRIAGEBOT_CONCERN-ISSUE_START -->

> [!NOTE]
> # Concerns (0 active)
>
> - ~~[allowing-comma-after-closing-brace](https://github.com/rust-lang/rust/pull/149783#issuecomment-3808533494)~~ resolved in [this comment](https://github.com/rust-lang/rust/pull/149783#issuecomment-3882251672)
>
> *Managed by `@rustbot`—see [help](https://forge.rust-lang.org/triagebot/concern.html) for details.*

<!-- TRIAGEBOT_CONCERN-ISSUE_END -->
<!-- TRIAGEBOT_END -->
2026-02-23 13:31:59 +11:00
Jonathan Brouwer 4f2673f1a1 Rollup merge of #152921 - blkerby:bootstrap-rustdoc-config, r=Kobzol
Add build.rustdoc option to bootstrap config

This adds a bootstrap config option `build.rustdoc` to be able to override the stage0 `rustdoc` binary. When unspecified, this defaults to the existing behavior of using the `rustdoc` binary in the same directory as `rustc`, making this a backward-compatible change.

### Motivation

The existing behavior does not seem to be documented and can be surprising. By adding the new option, the behavior gets documented in `bootstrap.example.toml`.

I ran into this because I was experimenting with a build with a configuration like this:
```
build.rustc = "/usr/bin/rustc-1.92"
build.cargo = "/usr/bin/cargo-1.92"
```
This was on Ubuntu where the packages `rustc-1.92` and `cargo-1.92` place symlinks at these locations. This resulted in failure as the bootstrap process tried to run doc tests on `tidy` using a binary `/usr/bin/rustdoc` which did not exist. It took some digging to understand where that path `/usr/bin/rustdoc` was coming from.

@rustbot label +A-bootstrap-config
2026-02-22 20:14:24 +01:00
Jonathan Brouwer ae8fa15f74 Rollup merge of #152708 - PaulDance:patches/nix-stdenv.cc.cc.lib, r=clubby789
Build: Add `stdenv.cc.cc.lib` to Nix dependencies

Otherwise, it systematically fails on:

```
error: process didn't exit successfully: `[...]/rust/build/bootstrap/debug/rustc [...]/rust/build/bootstrap/debug/rustc -vV` (exit status: 127)
--- stderr
[...]/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
```

for us at least. Closes rust-lang/rust#127620.

@rustbot label T-bootstrap A-reproducibility
2026-02-22 20:14:23 +01:00
Folkert de Vries 14d29f9ae2 Stabilize cfg_select 2026-02-22 19:59:25 +01:00
Chayim Refael Friedman dbf337f502 Fix another case where we forgot to put the type param for PartialOrd and PartialEq in builtin derives 2026-02-22 16:58:09 +02:00
Jonathan Brouwer 91010cf7c8 Rollup merge of #152953 - willschlitzer:patch-1, r=petrochenkov
Fix typo in armv7a-vex-v5.md

Remove duplicate "to" in armv7-vex-v5.md
2026-02-22 11:31:18 +01:00
Jonathan Brouwer 0afd9c3fc1 Rollup merge of #152879 - nnethercote:rm-impl-IntoQueryParam-ref-P, r=oli-obk
Remove `impl IntoQueryParam<P> for &'a P`.

`IntoQueryParam` is a trait that lets query callers be a bit sloppy with the passed-in key.
- Types similar to `DefId` will be auto-converted to `DefId`. Likewise for `LocalDefId`.
- Reference types will be auto-derefed.

The auto-conversion is genuinely useful; the auto-derefing much less so. In practice it's only used for passing `&DefId` to queries that accept `DefId`, which is an anti-pattern because `DefId` is marked with `#[rustc_pass_by_value]`.

This commit removes the auto-deref impl and makes the necessary sigil adjustments. (I generally avoid using `*` to deref manually at call sites, preferring to deref via `&` in patterns or via `*` in match expressions. Mostly because that way a single deref often covers multiple call sites.)

r? @cjgillot
2026-02-22 11:31:16 +01:00
Jonathan Brouwer 66cccfde99 Rollup merge of #147859 - cyrgani:nonfatal-tokenstream-parse, r=petrochenkov,JonathanBrouwer
reduce the amount of panics in `{TokenStream, Literal}::from_str` calls

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/147859)*

Before this PR, calling `TokenStream::from_str` or `Literal::from_str` with an invalid argument would always cause a compile error, even if the `TokenStream` is not used afterwards at all.
This PR changes this so it returns a `LexError` instead in some cases.

This is very theoretically a breaking change, but the doc comment on the impl already says
```
/// NOTE: some errors may cause panics instead of returning `LexError`. We reserve the right to
/// change these errors into `LexError`s later.
```

Fixes some cases of rust-lang/rust#58736.
2026-02-22 11:31:14 +01:00
Nicholas Nethercote a3d590888b Remove impl IntoQueryParam<P> for &'a P.
`IntoQueryParam` is a trait that lets query callers be a bit sloppy with
the passed-in key.
- Types similar to `DefId` will be auto-converted to `DefId`. Likewise
  for `LocalDefId`.
- Reference types will be auto-derefed.

The auto-conversion is genuinely useful; the auto-derefing much less so.
In practice it's only used for passing `&DefId` to queries that accept
`DefId`, which is an anti-pattern because `DefId` is marked with
`#[rustc_pass_by_value]`.

This commit removes the auto-deref impl and makes the necessary sigil
adjustments. (I generally avoid using `*` to deref manually at call
sites, preferring to deref via `&` in patterns or via `*` in match
expressions. Mostly because that way a single deref often covers
multiple call sites.)
2026-02-22 17:58:54 +11:00
Will Schlitzer 417e4f9c9d Fix typo in armv7a-vex-v5.md
Remove duplicate "to" in armv7-vex-v5.md
2026-02-21 22:38:31 -05:00
bors 5fb2ff8611 Auto merge of #152934 - matthiaskrgr:rollup-lcy7ROk, r=matthiaskrgr
Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152929 (Tighten the `!range` bounds on alignments in vtables)
 - rust-lang/rust#151603 (Stabilize `str_as_str`)
 - rust-lang/rust#152878 (Remove two more flaky assertions from `oneshot` tests)
 - rust-lang/rust#152915 (Error on attempt to construct scalable vector type)
 - rust-lang/rust#152925 (Improve runtest revision redundant cfg check)
 - rust-lang/rust#152928 (Update wasm-component-ld)
2026-02-21 20:19:28 +00:00
Matthias Krüger cc0b9d5c20 Rollup merge of #152928 - alexcrichton:update-wasm-component-ld, r=jieyouxu
Update wasm-component-ld

Same as rust-lang/rust#147495, just keeping it up-to-date.
2026-02-21 13:03:30 +01:00
Matthias Krüger 3faf2826d0 Rollup merge of #152925 - ferrocene:hoverbear/improve-revision-flag-check, r=clubby789,jieyouxu
Improve runtest revision redundant cfg check

While attempting to ingest https://github.com/rust-lang/rust/pull/148034 via https://github.com/ferrocene/ferrocene/pull/2172 we noticed a test failure, as we add some `compile_flags` to tests.

We saw a failure looking like this:

```
Testing stage1 with compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu)

running 2 tests
2026-02-20T20:21:28.846102Z ERROR compiletest::runtest: redundant cfg argument `copy` is already created by the revision

[mir-opt] tests/mir-opt/pre-codegen/copy_and_clone.rs#COPY ... F
.
```

While my Rust checkout passed:

```
Testing stage1 with compiletest suite=mir-opt mode=mir-opt (x86_64-unknown-linux-gnu)

running 2 tests
..

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 381 filtered out; finished in 107.10ms
```

This caused me to add some debugging statements.

Ferrocene:

```
2026-02-20T21:05:39.808427Z ERROR compiletest::runtest: "copy": does ["--edition=2015", "--cfg=copy"] contain `"--cfg=copy"` or `["--cfg", "copy"]`? true
2026-02-20T21:05:39.808427Z ERROR compiletest::runtest: "clone": does ["--edition=2015"] contain `"--cfg=clone"` or `["--cfg", "clone"]`? false
2026-02-20T21:05:39.808435Z ERROR compiletest::runtest: redundant cfg argument `copy` is already created by the revision
```

Rust:

```
2026-02-20T21:04:18.493158Z ERROR compiletest::runtest: "copy": does ["--cfg=copy"] contain `"--cfg=copy"` or `["--cfg", "copy"]`? false
2026-02-20T21:04:18.493158Z ERROR compiletest::runtest: "clone": does [] contain `"--cfg=clone"` or `["--cfg", "clone"]`? false
```

I noticed while reviewing the related functionality that there is a call to `.windows(2)` in the relevant check for redundant cfgs:

https://github.com/rust-lang/rust/blob/0376d43d443cba463a0b6a6ec9140ea17d7b7130/src/tools/compiletest/src/runtest.rs#L507-L511

Noting:

https://github.com/rust-lang/rust/blob/0376d43d443cba463a0b6a6ec9140ea17d7b7130/library/core/src/slice/mod.rs#L1064-L1066

Because of this, the revision check was getting an empty iterator when `self.props.compile_flags` was length 0 or 1.

This fix adjusts the check to handle such cases.

I went ahead and fixed the relevant test (4b3cd9b289ce0a36bda2756321f5fe455ea301e1) that was impacted by this. I do not suspect there are others, at least within the scope that Ferrocene tests, as we have not previously seen this failure.
2026-02-21 13:03:30 +01:00
bors 99246f4093 Auto merge of #152896 - weihanglo:update-cargo, r=weihanglo
Update cargo submodule

10 commits in ce69df6f72a3b6a2b5c722ba68ddef255344b31c..8cc0cb136772b8f54eafe0d163fcb7226a06af0c
2026-02-12 12:39:45 +0000 to 2026-02-17 12:16:26 +0000
- docs(layout): Updated layout module docs to document new layout (rust-lang/cargo#16502)
- fix(host-config): host.linker should not apply to non host unit (rust-lang/cargo#16641)
- init: improve error message and add tests (rust-lang/cargo#16643)
- Corrected doc comment for build script root_output path (rust-lang/cargo#16645)
- Changed build script run `output` dir to `stdout` in new build-dir layout (rust-lang/cargo#16644)
- test: add test case for verify-project with invalid TOML (rust-lang/cargo#16640)
- test(script): Show remaining workspace behavors (rust-lang/cargo#16633)
- fix(host-config): `host.runner` should not apply to `cargo run` (rust-lang/cargo#16638)
- refactor(help): simplify code structure (rust-lang/cargo#16627)
- test: Remove unused docker ip_address (rust-lang/cargo#16636)
2026-02-21 10:16:01 +00:00
bors 3fc37321c4 Auto merge of #152624 - camsteffen:symbols-audit, r=petrochenkov
Audit Symbols

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/152624)*

Remove unused symbols and hoist some symbols to Clippy.
2026-02-21 06:44:20 +00:00
protonblu fba1ca8b9f fix: correctly parenthesize inverted condition in convert_if_to_bool_then
The convert_if_to_bool_then assist was producing incorrect code when
the Some branch was in the else arm and the condition was a method call
expression (e.g. is_empty()).

Before:
    if test.is_empty() { None } else { Some(()) }
was incorrectly rewritten to:
    test.is_empty().then(|| ())

After (correct):
    (!test.is_empty()).then(|| ())

Root cause: the parenthesization check ran on the original condition
before inversion. When invert_boolean_expression produced a PrefixExpr
(e.g. !test.is_empty()), it was not being parenthesized because the
check had already passed on the original MethodCallExpr.

Fix: move the parenthesization check to after the inversion step so it
correctly detects PrefixExpr and wraps it in parentheses.

A regression test has been added to cover this case.
2026-02-21 11:45:24 +05:30
Alex Crichton 757b7c1bd7 Update wasm-component-ld
Same as 147495, just keeping it up-to-date.
2026-02-20 18:07:46 -08:00
protonblu ca3d3b7f71 fix: remove redundant comment 2026-02-21 07:24:22 +05:30
Ana Hobden 3c9ca9be9d Add reasoning for double iteration 2026-02-20 14:50:53 -08:00
Ana Hobden fd20f16ffc Always check compile_flags for revision
Previously, `self.props.compile_flags.windows(2)` would return an empty
iterator in the case where `self.props.compile_flags` was 1 or 0 length.

This created incorrectness where tests like
`tests/mir-opt/pre-codegen/copy_and_clone.rs` would pass when they should fail.
2026-02-20 13:25:06 -08:00
Manuel Drehwald c033de932e Move aarch64-apple dist builder to dynamic llvm linking and enable autodiff in CI for it
Co-authored-by: sgasho <SuganoShota1999@gmail.com>
2026-02-20 16:10:10 -05:00
Manuel Drehwald 4bf4ff1617 Enable autodiff in CI for mingw-llvm,linux 2026-02-20 16:10:10 -05:00
Manuel Drehwald 7daabfd04d adjust libdir for windows, use lld during enzyme build when needed 2026-02-20 16:10:07 -05:00
Jonathan Brouwer b0cdafbd4a Rollup merge of #152455 - JonathanBrouwer:remove_translation, r=jdonszelmann
Remove the translation `-Z` options and the `Translator` type.

This PR implements MCP https://github.com/rust-lang/compiler-team/issues/967

It is split up into individually reviewable commits, each commit passes tests:

* https://github.com/rust-lang/rust/commit/678211956793a2e772414a71700a21525af6e67b Removes the translation compiler options from the session
* https://github.com/rust-lang/rust/commit/8f300d02fe8d2f01a39425925afd4cf3e15a822b Removes the now empty `Translator` type
* https://github.com/rust-lang/rust/commit/ab715c536fbd4ac09409e9a44eea2e25ea8a4f48 Renames `translate_message` to `format_diag_message`, as the function no longer does any translation
* https://github.com/rust-lang/rust/commit/8bcbc3f766af6242dcb52afe1ef4f6b1a9685019 Removes a section describing the removed compiler options from the rustc dev guide
2026-02-20 22:00:57 +01:00
Jonathan Brouwer 1706756052 Rollup merge of #152241 - hoodmane:wasm-unwind-link-cpp-exception, r=alexcrichton
For panic=unwind on Wasm targets, define __cpp_exception tag

Since llvm/llvm-project#159143, llvm no longer weak links the __cpp_exception tag into each object that uses it. They are now defined in compiler-rt. Rust doesn't seem to get them from compiler-rt so llvm decides they need to be imported. This adds them to libunwind.

Same changes applied to compiler-builtins: https://github.com/rust-lang/compiler-builtins/pull/1077

See https://github.com/wasm-bindgen/wasm-bindgen/pull/4938 for a downstream workaround.

cc @sbc100
2026-02-20 22:00:55 +01:00
Jonathan Brouwer fb6d93917e Rollup merge of #146832 - Natural-selection1:not-in-chains, r=petrochenkov
Not linting irrefutable_let_patterns on let chains

*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust/pull/146832)*

# Description

this PR makes the lint `irrefutable_let_patterns` not check for `let chains`,
only check for single `if let`, `while let`, and `if let guard`.

# Motivation

Since `let chains` were stabilized, the following code has become common:

```rust
fn max() -> usize { 42 }

fn main() {
    if let mx = max() && mx < usize::MAX { /* */ }
}
```

This code naturally expresses "please call that function and then do something if the return value satisfies a condition".
Putting the let binding outside the if would be bad as then it remains in scope after the if, which is not the intent.

Current Output:

```bash
warning: leading irrefutable pattern in let chain
 --> src/main.rs:7:8
  |
7 |     if let mx = max() && mx < usize::MAX {
  |        ^^^^^^^^^^^^^^
  |
  = note: this pattern will always match
  = help: consider moving it outside of the construct
  = note: `#[warn(irrefutable_let_patterns)]` on by default
```

Another common case is progressively destructuring a struct with enum fields, or an enum with struct variants:

```rust
struct NameOfOuterStruct {
    middle: NameOfMiddleEnum,
    other: (),
}
enum NameOfMiddleEnum {
    Inner(NameOfInnerStruct),
    Other(()),
}
struct NameOfInnerStruct {
    id: u32,
}

fn test(outer: NameOfOuterStruct) {
    if let NameOfOuterStruct { middle, .. } = outer
        && let NameOfMiddleEnum::Inner(inner) = middle
        && let NameOfInnerStruct { id } = inner
    {
        /* */
    }
}
```

Current Output:

```bash
warning: leading irrefutable pattern in let chain
  --> src\main.rs:17:8
   |
17 |     if let NameOfOuterStruct { middle, .. } = outer
   |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this pattern will always match
   = help: consider moving it outside of the construct
   = note: `#[warn(irrefutable_let_patterns)]` on by default

warning: trailing irrefutable pattern in let chain
  --> src\main.rs:19:12
   |
19 |         && let NameOfInnerStruct { id } = inner
   |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: this pattern will always match
   = help: consider moving it into the body
```

To avoid the warning, the readability would be much worse:

```rust
fn test(outer: NameOfOuterStruct) {
    if let NameOfOuterStruct {
        middle: NameOfMiddleEnum::Inner(NameOfInnerStruct { id }),
        ..
    } = outer
    {
        /* */
    }
}
```

# related issue

* rust-lang/rust#139369

# possible questions

1. Moving the irrefutable pattern at the head of the chain out of it would cause a variable that was intended to be temporary to remain in scope, so we remove it.
   However, should we keep the check for moving the irrefutable pattern at the tail into the body?

2. Should we still lint `entire chain is made up of irrefutable let`?

---

This is my first time contributing non-documentation code to Rust. If there are any irregularities, please feel free to point them out.
: )
2026-02-20 22:00:54 +01:00
Brent Kerby 7df748542c Add build.rustdoc option to bootstrap config 2026-02-20 10:11:07 -07:00
protonblu aa2da37260 style: apply rustfmt 2026-02-20 19:21:24 +05:30
protonblu d778d122fa fix: generate method assist uses enclosing impl block instead of first found 2026-02-20 19:01:22 +05:30
Jonathan Brouwer 29871ea667 Rollup merge of #152840 - jieyouxu:bootstrap-install-src-no-docs, r=clubby789
Add bootstrap snapshot tests for {`install`, `install src`}

And `install src` with `build.docs = false`.

This is mostly to get coverage for the baseline to make it easier to review rust-lang/rust#150845.
2026-02-20 13:24:57 +01:00
Jonathan Brouwer 12c80d252d Rollup merge of #152057 - haampie:hs/fix/bootstrap-respect-jobserver-protocol, r=clubby789
bootstrap: respect POSIX jobserver

When bootstrapping Rust, the `-j N` flag was passed to CMake, which was
then forwarded to Ninja. This prevents the jobserver from being used,
and as a result leads to oversubscription when Rust is just one of the
many packages built as part of a larger software stack.

Since Cargo and the Rust compiler have long supported the jobserver, it
would be good if also bootstrapping Rust itself would participate in the
protocol, leading to composable parallelism.

This change allows bootstrapping to respect an existing FIFO based
jobserver. Old pipe based jobservers are not supported, because they are
brittle: currently the Python scripts in bootstrap do not inherit the
file descriptors, but do pass on `MAKEFLAGS`, which has lead to errors
like "invalid file descriptor" in the past. Because Ninja only supports
FIFO based jobservers, it's better to focus on new jobservers only,
which shouldn't suffer from the "invalid file descriptor" issue.

In summary:

* Bootstrap Cargo passes `MAKEFLAGS` verbatim to subprocesses if it
  advertises a FIFO style jobserver, otherwise it unsets it. This ensures
  subprocesses respect the jobserver during bootstrap.
* `llvm.rs` does not pass `-j` to `cmake` when a FIFO style jobserver is
  set in `MAKEFLAGS`. This ensures Ninja respects the jobserver.
* Bootstrap Cargo no longer unsets `MKFLAGS`: from git blame, GNU Make
  considered it a historical artifact back in 1992, and it is never read
  by GNU Make, it's only set for backwards compatibility in case sub-Makefiles
  read it.

---

I've tested this with the [Spack package manager](https://github.com/spack/spack) starting the POSIX jobserver,
building node.js and rust in parallel with `-j16`, which looks like this:

```console
$ pstree 382710
python3─┬─python3
        └─python3─┬─python3─┬─make───make───6*[ccache───g++───cc1plus]
                  │         └─{python3}
                  └─python3─┬─python3.11───bootstrap───cmake───ninja-build───10*[sh───ccache───g++───cc1plus]
                            └─{python3}
```

As you can see there are 10 `g++` processes running for rust, and `6` for node.js, and
with a mix of `make` and `ninja` as build tools :).

(The only violation I see now is `rust-lld`, but I think that'll be fixed with the LLVM 23
release)
2026-02-20 13:24:56 +01:00
Chayim Refael Friedman c8d56aa26a Merge pull request #21389 from A4-Tacks/assist-try-enum-ref
Fix some TryEnum reference assists
2026-02-20 11:05:31 +00:00
A4-Tacks b5eb4f6767 Do strip references for desugar_try_expr 2026-02-20 18:19:51 +08:00
Weihang Lo 821ed6ceba Update cargo submodule 2026-02-20 22:59:53 +13:00
Jana Dönszelmann 8e7bc3c7d1 fix src/tools 2026-02-20 10:35:52 +01:00
Shoyu Vanilla (Flint) c4158337eb Merge pull request #21635 from tascord/import-cfg-fixes
fix: Better import placement + merging
2026-02-20 02:08:33 +00:00
Cameron Steffen 0f9b166a6f Audit Symbols 2026-02-19 19:27:33 -06:00
Flora Hill 102f2ecc91 Perf + Test Case RE: ShoyuVanilla 2026-02-19 23:04:01 +00:00
Paul Mabileau 751b7d5bda Build: Add stdenv.cc.cc.lib to Nix dependencies
Otherwise, it systematically fails on:

```
error: process didn't exit successfully: `[...]/rust/build/bootstrap/debug/rustc [...]/rust/build/bootstrap/debug/rustc -vV` (exit status: 127)
--- stderr
[...]/rust/build/x86_64-unknown-linux-gnu/stage1/bin/rustc: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory
```

for us at least.

Signed-off-by: Paul Mabileau <paul.mabileau@harfanglab.fr>
2026-02-19 17:32:22 +01:00
Hegui Dai 4f31ff893d Not linting irrefutable_let_patterns on let chains
inline rest of the check
try fix ci errors
inline in check_let
2026-02-19 22:27:26 +08:00
Chayim Refael Friedman c3dc9386c5 Merge pull request #21675 from akashchakrabortymsc-cmd/fix/exclude-tests-macro-refs
fix: exclude macro refs in tests when excludeTests is enabled
2026-02-19 12:58:19 +00:00
protonblu 5a3f581b1f style: fix rustfmt formatting 2026-02-19 17:25:54 +05:30
protonblu 6d80670bb2 test: fix exclude_tests_macro_refs test to use custom macro 2026-02-19 17:22:01 +05:30
Hood Chatham 1cd345b22b For panic=unwind on Wasm targets, define __cpp_exception tag
Since llvm/llvm-project 159143, llvm no longer weak links the __cpp_exception tag into
each object that uses it. They are now defined in compiler-rt. Rust doesn't seem to
get them from compiler-rt so llvm decides they need to be imported. This adds them to
libunwind.
2026-02-19 11:36:56 +01:00
Jieyou Xu a9e6a89b06 bootstrap: add snapshot tests for {install, install src}
And `install src` with `build.docs = false`.
2026-02-19 18:34:04 +08:00
Shoyu Vanilla (Flint) 988494182a Merge pull request #21505 from rust-lang/dependabot/npm_and_yarn/editors/code/lodash-4.17.23
Bump lodash from 4.17.21 to 4.17.23 in /editors/code
2026-02-19 10:16:52 +00:00