306450 Commits

Author SHA1 Message Date
Augie Fackler
42cf78f762 llvm: update remarks support on LLVM 22
LLVM change dfbd76bda01e removed separate remark support entirely, but
it turns out we can just drop the parameter and everything appears to
work fine.

Fixes 146912 as far as I can tell (the test passes.)

@rustbot label llvm-main
2025-09-23 13:25:04 -04:00
Matthias Krüger
8e21b89135
Rollup merge of #146877 - el-ev:issue146816, r=fmease,lolbinarycat,GuillaumeGomez
prevent line number from being copied in chrome

- Closes rust-lang/rust#146816

Fix the issue where line numbers are copied along with code in Chrome
2025-09-23 18:13:57 +02:00
Matthias Krüger
c71a2c4819
Rollup merge of #146875 - Enselic:better-file-names, r=jieyouxu
tests/run-make/crate-loading: Rename source files for clarity

For rust-lang/rust#146874 I originally tried to extend the existing test **tests/run-make/crate-loading**. That didn't work out since adding a re-export of the entire crate significantly changes the emitted error messsage.

I did put some effort into making that test easier to understand however, by renaming its files. (Since I was confused myself at first.)  Let's save some time for future devs by doing just the renames.

Further cleanups are possible, but that will change the blessed output, so let's not do that right now.

r? ```@jieyouxu``` since you have the context of rust-lang/rust#146874
2025-09-23 18:13:56 +02:00
Matthias Krüger
35ceb3d447
Rollup merge of #146827 - foxtran:doc/linker-plugin-lto, r=nnethercote
Linker-plugin-based LTO: update list of good combinations (inc. beta + nightly)

This PR updates the list of good combinations of Rust toolchains and LLVM releases for linker-plugin-based LTO

Related to first question in https://users.rust-lang.org/t/questions-regarding-linker-plugin-based-lto/134070
2025-09-23 18:13:56 +02:00
Matthias Krüger
6d152339da
Rollup merge of #146806 - el-ev:issue60926, r=lolbinarycat
add private module override re-export test

- Closes rust-lang/rust#60926

Added a new test to check that `rustdoc` does not create links to `m2` in the crate root when `pub use m1::*` is overrided by `use crate::m1::m2`.
2025-09-23 18:13:55 +02:00
Matthias Krüger
15c323fa6d
Rollup merge of #146802 - joshtriplett:mbe-simplifications, r=petrochenkov
mbe: Simplifications and refactoring

A few simplifications and refactors in advance of other work.

Macro metavariable expressions were using `Ident::as_str` and doing string
comparisons; I converted them to use symbols.

I factored out a function for transcribing a `ParseNtResult`, which will help
separate the evaluation and transcription of future macro metavariable
expressions.
2025-09-23 18:13:54 +02:00
Matthias Krüger
64e81e5cb7
Rollup merge of #146799 - cuviper:dangling-count-latch, r=lcnr
Fix a dangling reference in `rustc_thread_pool`

This diverged from `rayon` in rust-lang/rust#142384, where a cleanup commit turned the matched `worker_index` into a reference, which is read _after_ the `set` that may kill it. I've moved that read beforehand, and I hope the new comments will emphasize the subtlety of this unsafe code.

Hopefully fixes rust-lang/rust#146677.
2025-09-23 18:13:53 +02:00
Matthias Krüger
8f11c4dadb
Rollup merge of #146784 - dpaoliello:findmsvc, r=wesleywiser
[win] Use find-msvc-tools instead of cc to find the linker and rc on Windows

`find-msvc-tools` was factored out from `cc` to allow updating the use in `rustc_codegen_ssa` (finding the linker when running the Rust compiler) and `rustc_windows_rc` (finding the Windows Resource Compiler when running the Rust compiler) to be separate from the use in `rustc_llvm` (building LLVM as part of building the Rust compiler).
2025-09-23 18:13:53 +02:00
Matthias Krüger
8905ad9838
Rollup merge of #146775 - hkBst:clippy-fix-11, r=petrochenkov
fixes for numerous clippy warnings
2025-09-23 18:13:52 +02:00
Matthias Krüger
ba9d057804
Rollup merge of #146731 - Muscraft:svg-test-terminal-url, r=jdonszelmann
test: Use SVG for terminal url test

I came across the test for `-Zterminal-urls` and found its output a bit hard to read. So, I decided to switch it to an SVG test, as I found it easier to differentiate the link and link text.

Note: `anstyle-svg` needed to be upgraded to at least `0.1.8` to support links in SVGs, so I went ahead and upgraded it to the latest version (`0.1.11`).
2025-09-23 18:13:52 +02:00
Matthias Krüger
076ada52d3
Rollup merge of #146632 - ctz:jbp-adaptor-spelling, r=petrochenkov
Fix uses of "adaptor"

These docs are in en_US, so "adapter" is the correct spelling (and indeed used in the next line.)

A second commit comes along for the ride to fix other instances in non-rustdoc comments.
2025-09-23 18:13:51 +02:00
Reuben Cruise
08020def99 Changes some aarch64 CIs g++ install & ubuntu ver.
GCS support was added to GCC in version 15, thus the rmake test for this
patch requires GCC15
Similarly, the ubuntu version is updated so the newer clang version is
available, and/or GCC15 is the default.
2025-09-23 13:56:53 +01:00
Nikita Popov
bc7986ec79 Add attributes for #[global_allocator] functions
Emit `#[rustc_allocator]` etc. attributes on the functions generated
by the `#[global_allocator]` macro, which will emit LLVM attributes
like `"alloc-family"`. If the module with the global allocator
participates in LTO, this ensures that the attributes typically
emitted on the allocator declarations are not lost if the
definition is imported.
2025-09-23 10:21:17 +02:00
Ralf Jung
85be36c1d3
Merge pull request #4601 from RalfJung/rustup
Rustup
2025-09-23 07:57:20 +00:00
Ralf Jung
0cd72a2f8d Merge ref 'f6092f224d2b' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh.

Upstream ref: f6092f224d2b1774b31033f12d0bee626943b02f
Filtered ref: f843cd4f29bdcd8d474dbb9e5e4365eb7f263ec6

This merge was created using https://github.com/rust-lang/josh-sync.
2025-09-23 09:28:24 +02:00
Ralf Jung
3c8d8da693 Prepare for merging from rust-lang/rust
This updates the rust-version file to f6092f224d2b1774b31033f12d0bee626943b02f.
2025-09-23 09:09:53 +02:00
bors
4056082360 Auto merge of #146317 - saethlin:panic=immediate-abort, r=nnethercote
Add panic=immediate-abort

MCP: https://github.com/rust-lang/compiler-team/issues/909

This adds a new panic strategy, `-Cpanic=immediate-abort`. This panic strategy essentially just codifies use of `-Zbuild-std-features=panic_immediate_abort`. This PR is intended to just set up infrastructure, and while it will change how the compiler is invoked for users of the feature, there should be no other impacts.

In many parts of the compiler, `PanicStrategy::ImmediateAbort` behaves just like `PanicStrategy::Abort`, because actually most parts of the compiler just mean to ask "can this unwind?" so I've added a helper function so we can say `sess.panic_strategy().unwinds()`.

The panic and unwind strategies have some level of compatibility, which mostly means that we can pre-compile the sysroot with unwinding panics then the sysroot can be linked with aborting panics later. The immediate-abort strategy is all-or-nothing, enforced by `compiler/rustc_metadata/src/dependency_format.rs` and this is tested for in `tests/ui/panic-runtime/`. We could _technically_ be more compatible with the other panic strategies, but immediately-aborting panics primarily exist for users who want to eliminate all the code size responsible for the panic runtime. I'm open to other use cases if people want to present them, but not right now. This PR is already large.

`-Cpanic=immediate-abort` sets both `cfg(panic = "immediate-abort")` _and_ `cfg(panic = "abort")`. bjorn3 pointed out that people may be checking for the abort cfg to ask if panics will unwind, and also the sysroot feature this is replacing used to require `-Cpanic=abort` so this seems like a good back-compat step. At least for the moment. Unclear if this is a good idea indefinitely. I can imagine this being confusing.

The changes to the standard library attributes are purely mechanical. Apart from that, I removed an `unsafe` we haven't needed for a while since the `abort` intrinsic became safe, and I've added a helpful diagnostic for people trying to use the old feature.

To test that `-Cpanic=immediate-abort` conflicts with other panic strategies, I've beefed up the core-stubs infrastructure a bit. There is now a separate attribute to set flags on it.

I've added a test that this produces the desired codegen, called `tests/run-make-cargo/panic-immediate-abort-codegen/` and also a separate run-make-cargo test that checks that we can build a binary.
2025-09-23 06:37:03 +00:00
Iris Shi
9ae7aef06d
prevent line number from being copied in chrome 2025-09-23 13:26:19 +08:00
Ben Kimock
4c1595a93b Skip the panic-immediate-abort-works test when cross-compiling 2025-09-22 21:13:38 -04:00
Josh Stone
389a502ade Fix a dangling reference in rustc_thread_pool 2025-09-22 14:04:04 -07:00
cyrgani
60f60127e7 add regression test for issue 146537 2025-09-22 22:02:24 +02:00
binarycat
82c4018619 fix ICE in rustdoc::invalid_html_tags 2025-09-22 14:57:36 -05:00
Peter Lyons Kehl
819f8b05b9 Mutex/RwLock/ReentrantLock::data_ptr to be const fn 2025-09-22 12:51:50 -07:00
Alex
2d18c886f5 Fix a crash/mislex when more than one frontmatter closing possibility is considered 2025-09-22 15:10:41 -04:00
bors
f6092f224d Auto merge of #146892 - GuillaumeGomez:rollup-fa7lp0n, r=GuillaumeGomez
Rollup of 5 pull requests

Successful merges:

 - rust-lang/rust#146795 (Enable `limit_rdylib_exports` on wasm targets)
 - rust-lang/rust#146828 (fix a crash in rustdoc merge finalize without input file)
 - rust-lang/rust#146848 (Add x86_64-unknown-motor (Motor OS) tier 3 target)
 - rust-lang/rust#146884 (Fix modification check of `rustdoc-json-types`)
 - rust-lang/rust#146887 (Remove unused #![feature(get_mut_unchecked)] in Rc and Arc examples)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-22 17:49:53 +00:00
rustbot
5e7d346364 Update books 2025-09-22 19:01:13 +02:00
Ralf Jung
0d906b746a
Merge pull request #4600 from RalfJung/sifa
fix SIFA logic
2025-09-22 16:37:24 +00:00
Martin Nordholts
2dc1354cd0 tests/run-make/crate-loading: Rename source files for clarity
To make the code easier to understand.
2025-09-22 18:18:36 +02:00
Ralf Jung
293e0a3aa0 fix SIFA logic 2025-09-22 18:08:17 +02:00
Iris Shi
bd98e73fe0
Update tests/rustdoc/reexport/private-mod-override-reexport.rs 2025-09-22 17:45:51 +02:00
Guillaume Gomez
9814d08545
Rollup merge of #146887 - taiki-e:rc-doc-feature, r=joboet
Remove unused #![feature(get_mut_unchecked)] in Rc and Arc examples

https://github.com/rust-lang/rust/pull/93109 removed the use of APIs enabled by this feature in these examples, but the `#![feature]` attributes ware not removed.
2025-09-22 17:17:46 +02:00
Guillaume Gomez
4852e692cd
Rollup merge of #146884 - Kobzol:tidy-rustdoc-modified, r=GuillaumeGomez
Fix modification check of `rustdoc-json-types`

r? `@GuillaumeGomez`
2025-09-22 17:17:45 +02:00
Guillaume Gomez
090befc5e0
Rollup merge of #146848 - moturus:motor-os_tier-3, r=davidtwco
Add x86_64-unknown-motor (Motor OS) tier 3 target

Add the initial no-std Motor OS compiler target.

Motor OS has been developed for several years in the open: https://github.com/moturus/motor-os.

It has a more or less full implementation of Rust std library, as well as tokio/mio ports.

> A tier 3 target must have a designated developer or developers (the "target maintainers") on record to be CCed when issues arise regarding the target. (The mechanism to track and CC such developers may evolve over time.)

Ack. [U. Lasiotus](https://github.com/lasiotus) will maintain the target.

 > Targets must use naming consistent with any existing targets; for instance, a target for the same CPU or OS as an existing Rust target should use the same name for that CPU or OS. Targets should normally use the same names and naming conventions as used elsewhere in the broader ecosystem beyond Rust (such as in other toolchains), unless they have a very good reason to diverge. Changing the name of a target can be highly disruptive, especially once the target reaches a higher tier, so getting the name right is important even for a tier 3 target.

> Target names should not introduce undue confusion or ambiguity unless absolutely necessary to maintain ecosystem compatibility. For example, if the name of the target makes people extremely likely to form incorrect beliefs about what it targets, the name should be changed or augmented to disambiguate it.

> If possible, use only letters, numbers, dashes and underscores for the name. Periods (.) are known to cause issues in Cargo.

Ack. The new target is named `x86_64-unknown-motor`, as it represents Motor OS on x86_64.

> Tier 3 targets may have unusual requirements to build or use, but must not create legal issues or impose onerous legal terms for the Rust project or for Rust developers or users.

> The target must not introduce license incompatibilities.

> Anything added to the Rust repository must be under the standard Rust license (MIT OR Apache-2.0).

> The target must not cause the Rust tools or libraries built for any other host (even when supporting cross-compilation to the target) to depend on any new dependency less permissive than the Rust licensing policy. This applies whether the dependency is a Rust crate that would require adding new license exceptions (as specified by the tidy tool in the rust-lang/rust repository), or whether the dependency is a native library or binary. In other words, the introduction of the target must not cause a user installing or running a version of Rust or the Rust tools to be subject to any new license requirements.

Ack. Motor OS is dual-licensed under MIT and/or Apache-2.0.

> Compiling, linking, and emitting functional binaries, libraries, or other code for the target (whether hosted on the target itself or cross-compiling from another target) must not depend on proprietary (non-FOSS) libraries. Host tools built for the target itself may depend on the ordinary runtime libraries supplied by the platform and commonly used by other applications built for the target, but those libraries must not be required for code generation for the target; cross-compilation to the target must not require such libraries at all. For instance, rustc built for the target may depend on a common proprietary C runtime library or console output library, but must not depend on a proprietary code generation library or code optimization library. Rust's license permits such combinations, but the Rust project has no interest in maintaining such combinations within the scope of Rust itself, even at tier 3.

> "onerous" here is an intentionally subjective term. At a minimum, "onerous" legal/licensing terms include but are not limited to: non-disclosure requirements, non-compete requirements, contributor license agreements (CLAs) or equivalent, "non-commercial"/"research-only"/etc terms, requirements conditional on the employer or employment of any particular Rust developers, revocable terms, any requirements that create liability for the Rust project or its developers or users, or any requirements that adversely affect the livelihood or prospects of the Rust project or its developers or users.

> Neither this policy nor any decisions made regarding targets shall create any binding agreement or estoppel by any party. If any member of an approving Rust team serves as one of the maintainers of a target, or has any legal or employment requirement (explicit or implicit) that might affect their decisions regarding a target, they must recuse themselves from any approval decisions regarding the target's tier status, though they may otherwise participate in discussions.

> This requirement does not prevent part or all of this policy from being cited in an explicit contract or work agreement (e.g. to implement or maintain support for a target). This requirement exists to ensure that a developer or team responsible for reviewing and approving a target does not face any legal threats or obligations that would prevent them from freely exercising their judgment in such approval, even if such judgment involves subjective matters or goes beyond the letter of these requirements.

Ack.

> Tier 3 targets should attempt to implement as much of the standard libraries as possible and appropriate (core for most targets, alloc for targets that can support dynamic memory allocation, std for targets with an operating system or equivalent layer of system-provided functionality), but may leave some code unimplemented (either unavailable or stubbed out as appropriate), whether because the target makes it impossible to implement or challenging to implement. The authors of pull requests are not obligated to avoid calling any portions of the standard library on the basis of a tier 3 target not implementing those portions.

Motor OS has a functional implementation of the standard library: https://github.com/moturus/rust/tree/motor-os_stdlib, which will be the subject of a later PR.

> The target must provide documentation for the Rust community explaining how to build for the target, using cross-compilation if possible. If the target supports running binaries, or running tests (even if they do not pass), the documentation must explain how to run such binaries or tests for the target, using emulation if possible or dedicated hardware if necessary.

Building instructions for Motor OS: https://github.com/moturus/motor-os/blob/main/docs/build.md.

> Tier 3 targets must not impose burden on the authors of pull requests, or other developers in the community, to maintain the target. In particular, do not post comments (automated or manual) on a PR that derail or suggest a block on the PR based on a tier 3 target. Do not send automated messages or notifications (via any medium, including via `@)` to a PR author or others involved with a PR regarding a tier 3 target, unless they have opted into such messages.

Ack.

> Backlinks such as those generated by the issue/PR tracker when linking to an issue or PR are not considered a violation of this policy, within reason. However, such messages (even on a separate repository) must not generate notifications to anyone involved with a PR who has not requested such notifications.

> Patches adding or updating tier 3 targets must not break any existing tier 2 or tier 1 target, and must not knowingly break another tier 3 target without approval of either the compiler team or the maintainers of the other tier 3 target.

> In particular, this may come up when working on closely related targets, such as variations of the same architecture with different features. Avoid introducing unconditional uses of features that another variation of the target may not have; use conditional compilation or runtime detection, as appropriate, to let each target run code supported by that target.

Ack.

> Tier 3 targets must be able to produce assembly using at least one of rustc's supported backends from any host target. (Having support in a fork of the backend is not sufficient, it must be upstream.)

Motor OS uses the standard x86_64 rustc/llvm toolchain.

> If a tier 3 target stops meeting these requirements, or the target maintainers no longer have interest or time, or the target shows no signs of activity and has not built for some time, or removing the target would improve the quality of the Rust codebase, we may post a PR to remove it; any such PR will be CCed to the target maintainers (and potentially other people who have previously worked on the target), to check potential interest in improving the situation.

Ack.
2025-09-22 17:17:44 +02:00
Guillaume Gomez
de7065b7d8
Rollup merge of #146828 - el-ev:issue146646, r=GuillaumeGomez
fix a crash in rustdoc merge finalize without input file

- Closes rust-lang/rust#146646

`SerializedSearchIndex::union` calls `Symbol::intern`, requiring `SESSION_GLOBALS` to be set.
2025-09-22 17:17:43 +02:00
Guillaume Gomez
dc176bd216
Rollup merge of #146795 - alexcrichton:wasm-limit-rdylib-exports, r=bjorn3
Enable `limit_rdylib_exports` on wasm targets

This commit updates the target specification of wasm targets to set the `limit_rdylib_exports` value to `true` like it is on other native platforms. This was originally not implemented long ago as `wasm-ld` didn't have options for symbol exports, but since then it's grown a `--export` flag and such to control this. A custom case is needed in the linker implementation to handle wasm targets as `wasm-ld` doesn't support linker scripts used on other targets, but other than that the implementation is straightforward.

The goal of this commit is enable building dynamic libraries on `wasm32-wasip2` which don't export every single symbol in the Rust standard library. Currently, without otherwise control over symbol visibility, all symbols end up being exported which generates excessively large binaries because `--gc-sections` ends up doing nothing as it's all exported anyway.
2025-09-22 17:17:42 +02:00
bors
ce4beebecb Auto merge of #146683 - clarfonthey:safe-intrinsics, r=RalfJung,Amanieu
Mark float intrinsics with no preconditions as safe

Note: for ease of reviewing, the list of safe intrinsics is sorted in the first commit, and then safe intrinsics are added in the second commit.

All *recently added* float intrinsics have been correctly marked as safe to call due to the fact that they have no preconditions. This adds the remaining float intrinsics which are safe to call to the safe intrinsic list, and removes the unsafe blocks around their calls.

---

Side note: this may want a try run before being added to the queue, since I'm not sure if there's any tier-2 code that uses these intrinsics that might not be tested on the usual PR flow. We've already uncovered a few places in subtrees that do this, and it's worth double-checking before clogging up the queue.
2025-09-22 14:35:46 +00:00
Tshepang Mbambo
70f3768fb8
Merge pull request #2593 from rust-lang/tshepang/testing-with-ci
various improvements resulting from reading Testing with CI
2025-09-22 16:33:40 +02:00
Tshepang Mbambo
1e2594f94f various improvements resulting from reading Testing with CI 2025-09-22 16:32:50 +02:00
Tshepang Mbambo
45f891d832
Merge pull request #2596 from rust-lang/tshepang/sembr
reduce overlong lines
2025-09-22 16:27:31 +02:00
Tshepang Mbambo
62b2bd5809 reduce overlong lines 2025-09-22 16:26:27 +02:00
Nathaniel McCallum
5dde557fc4 constify {float}::total_cmp() 2025-09-22 10:24:39 -04:00
Tshepang Mbambo
391a2ea868
Merge pull request #2595 from rust-lang/rustc-pull
Rustc pull update
2025-09-22 16:18:39 +02:00
Ralf Jung
bd5e7e59f8
Merge pull request #4599 from RalfJung/nondet
share non-det test helpers and increase iteration counts
2025-09-22 13:19:24 +00:00
Taiki Endo
823337a4ad Remove unused #![feature(get_mut_unchecked)] in Rc and Arc examples 2025-09-22 22:15:25 +09:00
Ralf Jung
37de09fed9 share the check_nondet helper as well 2025-09-22 14:52:35 +02:00
Ralf Jung
a25896bc27 share check_all_outcomes impl, and increase max iteration counts 2025-09-22 14:52:35 +02:00
Iris Shi
42ebba214b
address review comments 2025-09-22 20:36:18 +08:00
Jakub Beránek
870a98c7b3
Fix modification check of rustdoc-json-types 2025-09-22 14:14:48 +02:00
Ralf Jung
5caffb1830
Merge pull request #4595 from RalfJung/tb-terms
TB: update terminology to match paper & MiniRust
2025-09-22 11:50:27 +00:00
bors
29005cb128 Auto merge of #146879 - Zalathar:rollup-vm97j8b, r=Zalathar
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#145411 (regression test for Cow<[u8]> layout)
 - rust-lang/rust#146397 (std_detect on Darwin AArch64: update features)
 - rust-lang/rust#146791 (emit attribute for readonly non-pure inline assembly)
 - rust-lang/rust#146831 (Support ctr and lr as clobber-only registers in PowerPC inline assembly)
 - rust-lang/rust#146838 (Introduce "wrapper" helpers to rustdoc)
 - rust-lang/rust#146845 (Add self-profile events for target-machine creation)
 - rust-lang/rust#146846 (btree InternalNode::new safety comments)
 - rust-lang/rust#146858 (Make mips64el-unknown-linux-muslabi64 link dynamically)
 - rust-lang/rust#146878 (assert_unsafe_precondition: fix some incorrect check_language_ub)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-09-22 11:15:49 +00:00