Commit graph

306655 commits

Author SHA1 Message Date
Matthias Krüger
4eddf645bf
Rollup merge of #146745 - helldawg:master, r=workingjubilee
Clarified error note for usize range matching

Fixes rust-lang/rust#146476

This is kinda rough, but it gets the point across a little better and stays short.
2025-09-28 09:15:23 +02:00
Matthias Krüger
4e9cfc726c
Rollup merge of #142139 - erickt:include-hashes, r=Mark-Simulacrum
Include additional hashes in src/stage0

This patch changes `bump-stage0` to include:

* The sha256 hash of the channel manifest used to create `src/stage0`.
* The rust and rustfmt git commit in `src/stage0`.
* Hashes of all the artifacts, like the source tarball, in `src/stage0`.

Combined this will allow for:

* Projects that bootstrap their own compiler, such as Fuchsia, or users of [bootstrap], to build their compilers offline without needing to communicate with static.rust-lang.org.

* Auditors to detect if the channel manifest, and all the artifacts inside the manifest, were modified after it was used to generate `src/stage0`. Furthermore, if they did find modified artifacts, they could determine if the Rust Signing Key was compromised by checking if any modified file was signed properly.

finally, it allows regeneration of `src/stage0` when specifying both the day of the build for rust, and the day of the build for rustfmt, which can allow a maintainer to regenerate `src/stage0` to verify nothing changed.

[bootstrap]: https://github.com/dtolnay/bootstrap
[mrustc]: https://github.com/thepowersgang/mrustc
2025-09-28 09:15:22 +02:00
bors
c7f6aa2869 Auto merge of #147042 - Noratrieb:untrack-caller-vec, r=tgross35
Remove most `#[track_caller]` from allocating Vec methods

They cause significant binary size overhead while contributing little value.

closes rust-lang/rust#146963, see that issue for more details.
2025-09-28 03:23:45 +00:00
bors
848e6746fe Auto merge of #147104 - matthiaskrgr:rollup-gap1v0w, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - rust-lang/rust#146037 (Introduce CoerceShared lang item and trait, and basic Reborrow tests)
 - rust-lang/rust#146732 (tests: relax expectations after llvm change 902ddda120a5)
 - rust-lang/rust#147018 (re-order normalizations in run-make linker-warning test)
 - rust-lang/rust#147032 (Fix doctest compilation time display)
 - rust-lang/rust#147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`)
 - rust-lang/rust#147050 (PassWrapper: update for new PGOOptions args in LLVM 22)
 - rust-lang/rust#147075 (Make `def_path_hash_to_def_id` not panic when passed an invalid hash)
 - rust-lang/rust#147076 (update issue number for more_float_constants)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-27 22:30:56 +00:00
bors
4082d6a3f0 Auto merge of #146927 - Kobzol:install-clif, r=jieyouxu
Make it possible to `x install` Cranelift and LLVM bitcode linker

It was not possible to install these before, as they were not in the install step description list.

Fixes: https://github.com/rust-lang/rust/issues/140331

r? `@jieyouxu`
2025-09-27 19:26:29 +00:00
Matthias Krüger
bd2e18671d
Rollup merge of #147076 - joshuarayton:more-float-constants-issue, r=tgross35
update issue number for more_float_constants

Update issue number from https://github.com/rust-lang/rust/issues/103883 to https://github.com/rust-lang/rust/issues/146939

r? ``@tgross35``
2025-09-27 21:26:00 +02:00
Matthias Krüger
a2b77d09d7
Rollup merge of #147075 - Lysxia:no-panic-def-path-hash, r=petrochenkov
Make `def_path_hash_to_def_id` not panic when passed an invalid hash

I'm using this function in a third-party application (Creusot) to access private items (by reverse engineering their hash). This works in the happy path, but it panics when an item does not exist. There is no way to hack it downstream because the hook `def_path_hash_to_def_id_extern` must always return a `DefId` and its implementation uses `def_path_hash_to_def_index` which is internal and which is where the panic happens.
2025-09-27 21:26:00 +02:00
Matthias Krüger
848009f154
Rollup merge of #147050 - durin42:llvm-22-pgo-options-args, r=cuviper
PassWrapper: update for new PGOOptions args in LLVM 22

This changed in upstream change a5569b4bd7.

``@rustbot`` label llvm-main
2025-09-27 21:25:59 +02:00
Matthias Krüger
82dff12cdf
Rollup merge of #147046 - Kobzol:bootstrap-ll, r=jieyouxu
Rename `rust.use-lld` to `rust.bootstrap-override-lld`

First part of https://github.com/rust-lang/rust/issues/146640. The old option is kept for backwards compatibility, we can remove it in ~6 months, as usually.

I'm not sure if the bootstrap prefix is ideal, after all we have a bunch of other configs that only affect bootstrap's behavior and not the built artifacts. Maybe `build.override-lld`? But I don't think it matters that much, as long as it's clear that it is an override, and how does it differ from `rust.lld`.

r? ``@jieyouxu``
2025-09-27 21:25:58 +02:00
Matthias Krüger
a11a211d7c
Rollup merge of #147032 - GuillaumeGomez:fix-doctest-compilation-time-display, r=lolbinarycat
Fix doctest compilation time display

Fixes rust-lang/rust#146960.

Small corner case that happened in case everything went fine and there was only merged doctests.

r? lolbinarycat
2025-09-27 21:25:58 +02:00
Matthias Krüger
13ac606956
Rollup merge of #147018 - Fabian-Gruenbichler:mr/fix-linker-warning-test-normalization, r=jieyouxu
re-order normalizations in run-make linker-warning test

otherwise a buildroot containing `rustc[^/_-]*` or `libpanic_abort` would be mangled before being replaced by the build root placeholder value..

e.g., running `./x.py test --verbose tests/run-make/linker-warning` with rustc checked out in ~/ext/rustcfoobar will result in

```
running 1 tests
test [run-make] tests/run-make/linker-warning ... FAILED

failures:

---- [run-make] tests/run-make/linker-warning stdout ----

------rustc stdout------------------------------

------rustc stderr------------------------------

------------------------------------------

error: rmake recipe failed to complete
status: exit status: 101
command: cd "/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/test/run-make/linker-warning/rmake_out" && env -u RUSTFLAGS -u __RUSTC_DEBUG_ASSERTIONS_ENABLED -u __STD_DEBUG_ASSERTIONS_ENABLED AR="ar" BUILD_ROOT="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu" CC="cc" CC_DEFAULT_FLAGS="-ffunction-sections -fdata-sections -fPIC -m64" CXX="c++" CXX_DEFAULT_FLAGS="-ffunction-sections -fdata-sections -fPIC -m64" HOST_RUSTC_DYLIB_PATH="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/stage1/lib" LD_LIBRARY_PATH="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/bootstrap-tools/x86_64-unknown-linux-gnu/release/deps:/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/stage0/lib/rustlib/x86_64-unknown-linux-gnu/lib" LD_LIB_PATH_ENVVAR="LD_LIBRARY_PATH" LLVM_BIN_DIR="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/ci-llvm/bin" LLVM_COMPONENTS="<..>" LLVM_FILECHECK="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/ci-llvm/bin/FileCheck" NODE="/usr/bin/node" PYTHON="/usr/bin/python3" RUSTC="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/stage1/bin/rustc" RUSTDOC="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/stage1/bin/rustdoc" SOURCE_ROOT="/home/user/ext/rustcfoobar" TARGET="x86_64-unknown-linux-gnu" TARGET_EXE_DYLIB_PATH="/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/user/ext/rustcfoobar/build/x86_64-unknown-linux-gnu/test/run-make/linker-warning/rmake"
stdout: none
--- stderr -------------------------------

thread 'main' panicked at /home/user/ext/rustcfoobar/tests/run-make/linker-warning/rmake.rs:74:14:
test failed: `short-error.txt` is different from `(linker error)`

--- short-error.txt
+++ (linker error)
``@@`` -1,6 +1,6 ``@@``
 error: linking with `./fake-linker` failed: exit status: 1
   |
-  = note:  "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/build-root/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/build-root/test/run-make/linker-warning/rmake_out" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error"
+  = note:  "./fake-linker" "-m64" "/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/user/ext/rustc/build/x86_64-unknown-linux-gnu/test/run-make/linker-warning/rmake_out/{libfoo,libbar}.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/raw-dylibs" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/user/ext/rustc/build/x86_64-unknown-linux-gnu/test/run-make/linker-warning/rmake_out" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "main" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs" "run_make_error"
   = note: some arguments are omitted. use `--verbose` to show all linker arguments
   = note: error: baz

[..]
```

without this fix.

Note: this affected Debian's automated builds, since the buildroot contains the package name and version. while that particular issue got fixed in the meantime by accident by making the RE more strict in 77232fb935 , other buildroot paths are still affected without a full fix.
2025-09-27 21:25:57 +02:00
Matthias Krüger
c772af78e9
Rollup merge of #146732 - durin42:llvm-22-less-assumes, r=nikic
tests: relax expectations after llvm change 902ddda120a5

LLVM 22 is able to drop assumes that seem to not help further optimizations, which actually seems to dramatically _help_ further optimizations in some of our small test cases.

I'm a little unclear how to fix the last failure, in `tests/codegen-llvm/issues/issue-122600-ptr-discriminant-update.rs`:

```
-; Function Attrs: mustprogress nofree norecurse nosync nounwind willreturn memory(argmem: readwrite, inaccessiblemem: write) uwtable
+; Function Attrs: mustprogress nofree norecurse nosync nounwind nonlazybind willreturn memory(argmem: readwrite, inaccessiblemem: write) uwtable
 define void ``@update(ptr`` noundef captures(none) %s) unnamed_addr #0 {
 start:
-  %_3.sroa.0.0.copyload = load i8, ptr %s, align 1
-  %0 = trunc nuw i8 %_3.sroa.0.0.copyload to i1
-  %1 = xor i1 %0, true
-  tail call void ``@llvm.assume(i1`` %1)
   store i8 1, ptr %s, align 1
   ret void
 }
```

I'm just not conversant enough in LLVM IR to follow the changes here.

``@rustbot`` label llvm-main
r? nikic
2025-09-27 21:25:57 +02:00
Matthias Krüger
01c17f83cf
Rollup merge of #146037 - aapoalas:reborrow-lang-experiment, r=tmandry
Introduce CoerceShared lang item and trait, and basic Reborrow tests

Part of rust-lang/rust#145612: This introduces the `CoerceShared` trait which is the `Reborrow` equivalent of a `&mut T` -> `&T` coercion. The trait has a `Target` GAT which makes this (currently) unique in the `core/src/marker.rs`; I'm not sure if this can be considered problematic. Maybe this is not the way such things should be done at the marker trait level? Or maybe it is fine.

Improtantly, this PR introduces a battery of basic `Reborrow` and `CoerceShared` tests. These test the very basics of the feature; custom marker types intended to have exclusive semantics (`Custom<'a>(PhantomData<&'a mut ()>)`), custom exclusive reference wrappers, and standard library exclusive reference wrappers (`Pin<&mut T>` and `Option<&mut T>`). None of these of course work since the implementation for `Reborrow` and `CoerceShared` is entirely missing, but this is the first step towards making these work.

Future PRs will introduce more tests, such as "recursive" reborrowing (ie. reborrowing structs that contain multiple reborrowable fields) and checks around the lifetime semantics of reborrowing ie. that a reborrow produces a new type with the same lifetime as the original.
2025-09-27 21:25:56 +02:00
bors
c0ee51f07d Auto merge of #138907 - GuillaumeGomez:rfc-3631, r=fmease,camelid,Manishearth,lolbinarycat
Implement RFC 3631: add rustdoc doc_cfg features

Implementation of https://github.com/rust-lang/rfcs/pull/3631.

This implementation actually resulted in a lot of simplifications:
 * All `cfg` computation is now done in one place: `propagate_doc_cfg.rs`. Because (trait) `impl`s are not retrieved at the same time as the other items, we cannot perform this computation in the clean process, it needs to be after.
 * Because there is `cfg` inheritance, we can keep track of them in one place (in `propagate_doc_cfg.rs`), meaning we don't need to copy an item's attributes to its children anymore. Only exception: impl items. For them we clone only `cfg` attributes.
 * `propagate_doc_cfg.rs` is also now much simpler, much less need to keep track of parents, since everything we need is handled by the new `CfgInfo` type.
 * I also suspect that `Cfg::simplify_with` could either be removed or at least used directly into `propagate_doc_cfg.rs` when we compute `cfg`s. Considering how big the PR already is, I'll do it in a follow-up.

I didn't remove the `doc_cfg*` features in this PR because some dependencies used in `rustc` (like `stdarch`) are using it, so we need to have a nightly released with this PR before I can switch to the new feature.

r? ghost
2025-09-27 15:42:29 +00:00
Mark Rousskov
76bb0d1870 Update stage0 per previous commmit 2025-09-27 08:45:40 -04:00
Erick Tryzelaar
d42acf522f Include additional hashes in src/stage0
This patch changes `bump-stage0` to include:

* The sha256 hash of the channel manifest used to create `src/stage0`.
* The rust and rustfmt git commit in `src/stage0`.
* Hashes of all the artifacts, like the source tarball, in `src/stage0`.

Combined this will allow for:

* Projects that bootstrap their own compiler, such as Fuchsia, or users
  of [bootstrap], to build their compilers offline without needing to
  communicate with static.rust-lang.org.

* Auditors to detect if the channel manifest, and all the artifacts
  inside the manifest, were modified after it was used to generate
  `src/stage0`. Furthermore, if they did find modified artifacts, they
  could determine if the Rust Signing Key was compromised by checking if
  any modified file was signed properly.

Finally, it allows regeneration of `src/stage0` when specifying both the
day of the build for rust, and the day of the build for rustfmt, which
can allow a maintainer to regenerate `src/stage0` to verify nothing
changed.

[bootstrap]: https://github.com/dtolnay/bootstrap
[mrustc]: https://github.com/thepowersgang/mrustc
2025-09-27 08:43:22 -04:00
bors
ade84871f7 Auto merge of #146829 - cjgillot:jump-threading-loop-dominator, r=dianqk
JumpThreading: Avoid computing dominators to identify loop headers.

JumpThreading tries to avoid threading through loop headers to avoid creating irreducible CFGs.

However, computing dominators is expensive, and accounts up to 20 % of the runtime of the JumpThreading pass for some cases like serde.

This PR proposes to approximate according to the post-order traversal order. We define a "maybe" loop header as a block which is visited after its predecessor in post-order.
2025-09-27 09:32:40 +00:00
Guillaume Gomez
6cccea8731 Remove doc_auto_cfg feature as well 2025-09-27 11:30:57 +02:00
Guillaume Gomez
9362ab549f Improve code and fix typo 2025-09-27 11:29:50 +02:00
Guillaume Gomez
653e1036ed Apply first review round suggestions 2025-09-27 11:29:50 +02:00
Guillaume Gomez
77885fef2c Improve code comments and extend tests for doc_cfg feature 2025-09-27 11:29:50 +02:00
Guillaume Gomez
ef8b2a26ca Correctly handle target_feature in rustdoc cfg 2025-09-27 11:29:49 +02:00
Guillaume Gomez
6fecff45d9 Fix tests/rustdoc/target-feature.rs test by adding missing #![feature(doc_cfg)] 2025-09-27 11:29:49 +02:00
Guillaume Gomez
254a2139f6 Remove cfg(bootstrap) for doc_cfg feature following #141925 2025-09-27 11:29:49 +02:00
Guillaume Gomez
ec00723ba1 Fix autodiff feature activation 2025-09-27 11:29:49 +02:00
Guillaume Gomez
a7ed9bf6c7 fmt 2025-09-27 11:29:49 +02:00
Guillaume Gomez
fccba2c341 Remove doc_cfg_hide feature 2025-09-27 11:29:49 +02:00
Guillaume Gomez
553308b115 Improve code and better check doc(cfg(...)) attributes 2025-09-27 11:29:49 +02:00
Guillaume Gomez
1561efe41a Add code documentation, improve code and improve error message 2025-09-27 11:29:49 +02:00
Guillaume Gomez
c06a076634 Put back the doc_cfg code behind a nightly feature 2025-09-27 11:29:49 +02:00
Guillaume Gomez
ed05315867 Rename CfgInfo::doc_auto_cfg_active into auto_cfg_active 2025-09-27 11:29:49 +02:00
Guillaume Gomez
bb34332858 Update book for doc_cfg feature 2025-09-27 11:29:48 +02:00
Guillaume Gomez
d6ba93a3fe Remove doc_cfg related content from rustdoc book unstable features chapter 2025-09-27 11:29:48 +02:00
Guillaume Gomez
18df897221 Remove ui test for doc_cfg feature gate 2025-09-27 11:29:48 +02:00
Guillaume Gomez
4847eaf6d2 Remove useless code in propagate_doc_cfg.rs 2025-09-27 11:29:48 +02:00
Guillaume Gomez
63aefe0737 Strenghten checks for doc(auto_cfg(show/hide)) attributes 2025-09-27 11:29:48 +02:00
Guillaume Gomez
2d82c99f1e Add "global" rustdoc test for RFC 3631 2025-09-27 11:29:48 +02:00
Guillaume Gomez
6537278e11 Update rustdoc tests 2025-09-27 11:29:48 +02:00
Guillaume Gomez
7c00bccd3b Implement RFC 3631 2025-09-27 11:29:48 +02:00
bors
959b450747 Auto merge of #146636 - Mark-Simulacrum:bootstrap-bump, r=jieyouxu
Bump bootstrap compiler to 1.91 beta

https://forge.rust-lang.org/release/process.html#default-branch-bootstrap-update-tuesday
2025-09-27 03:50:03 +00:00
bors
e131842222 Auto merge of #147074 - matthiaskrgr:rollup-sm3owsd, r=matthiaskrgr
Rollup of 10 pull requests

Successful merges:

 - rust-lang/rust#145113 (resolve: Do not finalize shadowed bindings)
 - rust-lang/rust#146523 (Demote both armebv7r-none-* targets.)
 - rust-lang/rust#146704 (port `#[debugger_visualizer]` to the new attribute system)
 - rust-lang/rust#146758 (Stop linking rs{begin,end} objects on x86_64-*-windows-gnu)
 - rust-lang/rust#146778 (Use standard attribute logic for allocator shim)
 - rust-lang/rust#146849 (Reduce some uses of `LegacyBang`)
 - rust-lang/rust#147016 (fix doc comments to be more standard)
 - rust-lang/rust#147027 (Add new `tyalias` intra-doc link disambiguator)
 - rust-lang/rust#147031 (mbe: Simplify check_redundant_vis_repetition)
 - rust-lang/rust#147058 (Ignore more failing ui tests for GCC backend)

Failed merges:

 - rust-lang/rust#147046 (Rename `rust.use-lld` to `rust.bootstrap-override-lld`)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-27 00:44:47 +00:00
Mark Rousskov
54669d7db4 Bump stage0 2025-09-26 19:09:23 -04:00
Mark Rousskov
201f299ef6 Apply cfg(bootstrap) replacement 2025-09-26 19:09:23 -04:00
Mark Rousskov
4e9716fbc5 Update CURRENT_RUSTC_VERSION post-bump 2025-09-26 18:41:32 -04:00
Aapo Alasuutari
e88fa086fb move Reborrow to ops, fix fmt issues 2025-09-27 01:11:01 +03:00
Camille Gillot
d13a5b0a6c Handle self-loops too. 2025-09-26 20:44:06 +00:00
Guillaume Gomez
b7e444de16 Add regression test for merged doctests compilation time display 2025-09-26 22:04:00 +02:00
Augie Fackler
bd860bdf26
Fix typo in LLVM_VERSION_ macro use
Co-authored-by: Nikita Popov <github@npopov.com>
2025-09-26 15:38:30 -04:00
Jakub Beránek
852aa20c90
Rename rust.use-lld to rust.bootstrap-override-lld 2025-09-26 20:21:21 +02:00
Joshua Rayton
2e904c4d07
update issue number for more_float_constants 2025-09-26 18:35:29 +01:00