about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-09-05Rollup merge of #146144 - heiher:entry-func-features, r=petrochenkovLeón Orell Valerian Liehr-10/+22
compiler: Apply target features to the entry function Fixes rust-lang/rust#146143
2025-09-05Rollup merge of #146041 - lolbinarycat:tidy-escheck-bless, r=KobzolLeón Orell Valerian Liehr-10/+22
tidy: --bless now makes escheck run with --fix this mirrors how other extra-check tools work. unsure if this also needs to be done for tsc and es-check.
2025-09-05Rollup merge of #145735 - joshtriplett:style-guide-trailing-whitespace, ↵León Orell Valerian Liehr-2/+10
r=joshtriplett style-guide: Document absence of trailing whitespace We didn't previously have a blanket prohibition on trailing whitespace. Adding one, inspired by discussion in https://github.com/rust-lang/rust/pull/145617 .
2025-09-05Rollup merge of #139113 - folkertdev:sanitizer-unstable-book-check-block, ↵León Orell Valerian Liehr-16/+16
r=rcvalle unstable book: in a sanitizer example, check the code Use some `#` directives to make sure the code checks on x86_64, and does not produce errors on other platforms. This example still used an older version of `#[naked]`, and because the snippet was ignored that was missed before. I'm not sure when this gets built on CI exactly, so it might be worthwhile to try and build it for a non-x86_64 architecture to make sure that works. I'm not sure how to verify locally that e.g. on aarch64 this code works without errors/warnings. try-job: aarch64-apple try-job: x86_64-msvc-2
2025-09-05Rollup merge of #138944 - madsmtm:apple_os_version_check, r=tgross35León Orell Valerian Liehr-2/+1127
Add `__isPlatformVersionAtLeast` and `__isOSVersionAtLeast` symbols ## Motivation When Objective-C code uses ```@available(...)`,`` Clang inserts a call to [`__isPlatformVersionAtLeast`](https://github.com/llvm/llvm-project/blob/llvmorg-20.1.0/compiler-rt/lib/builtins/os_version_check.c#L276) (`__isOSVersionAtLeast` in older Clang versions). These symbols not being available sometimes ends up causing linker errors. See the new test `tests/run-make/apple-c-available-links` for a minimal reproducer. The workaround is to link `libclang_rt.osx.a`, see e.g. https://github.com/alexcrichton/curl-rust/issues/279. But that's very difficult for users to figure out (and the backreferences to that issue indicates that people are still running into this in their own projects every so often). For another recent example, this is preventing `rustc` from using LLVM assertions on macOS, see https://github.com/rust-lang/rust/pull/62592#issuecomment-510670657 and https://github.com/rust-lang/rust/pull/134275#issuecomment-2543067830. It is also a blocker for [setting the correct minimum OS version in `cc-rs`](https://github.com/rust-lang/rust/issues/136113), since fixing this in `cc-rs` might end up introducing linker errors in places where we weren't before (by default, if using e.g. ```@available(macos`` 10.15, *)`, the symbol usually happens to be left out, since `clang` defaults to compiling for the host macOS version, and thus things _seem_ to work - but the availability check actually compiles down to nothing, which is a huge correctness footgun for running on older OSes). (My super secret evil agenda is also to expose some variant of ```@available``` in Rust's `std` after https://github.com/rust-lang/rfcs/pull/3750 progresses further, will probably file an ACP for this later. But I believe this PR has value regardless of those future plans, since we'd be making C/Objective-C/Swift interop easier). ## Solution Implement `__isPlatformVersionAtLeast` and `__isOSVersionAtLeast` as part of the "public ABI" that `std` exposes. **This is insta-stable**, in the same sense that additions to `compiler-builtins` are insta-stable, though the availability of these symbols can probably be considered a "quality of implementation" detail rather than a stable promise. I originally proposed to implement this in `compiler-builtins`, see https://github.com/rust-lang/compiler-builtins/pull/794, but we discussed moving it to `std` instead ([Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Provide.20.60__isPlatformVersionAtLeast.60.20in.20.60std.60.3F/with/507880717)), which makes the implementation substantially simpler, and we avoid gnarly issues with requiring the user to link `libSystem.dylib` (since `std` unconditionally does that). Note that this does not solve the linker errors for (pure) `#![no_std]` users, but that's _probably_ fine, if you are using ```@available``` to test the OS version on Apple platforms, you're likely also using `std` (and it is still possible to work around by linking `libclang_rt.*.a`). A thing to note about the implementation, I've choosen to stray a bit from LLVM's upstream implementation, and not use `_availability_version_check` since [it has problems when compiling with an older SDK](https://github.com/llvm/llvm-project/issues/64227). Instead, we use `sysctl kern.osproductversion` when available to still avoid the costly PList lookup in most cases, but still with a fall back to the PList lookup when that is not available (with the PList fallback being is similar to LLVM's implementation). ## Testing Apple has a lot of different "modes" that they can run binaries in, which can be a bit difficult to find your bearings in, but I've tried to be as thorough as I could in testing them all. Tested using roughly the equivalent of `./x test library/std -- platform_version` on the following configurations: - macOS 14.7.3 on a Macbook Pro M2 - `aarch64-apple-darwin` - `x86_64-apple-darwin` (under Rosetta) - `aarch64-apple-ios-macabi` - `x86_64-apple-ios-macabi` (under Rosetta) - `aarch64-apple-ios` (using Xcode's "Designed for iPad" setting) - `aarch64-apple-ios-sim` (in iOS Simulator, as iPhone with iOS 17.5) - `aarch64-apple-ios-sim` (in iOS Simulator, as iPad with iOS 18.2) - `aarch64-apple-tvos-sim` (in tvOS Simulator) - `aarch64-apple-watchos-sim` (in watchOS Simulator) - `aarch64-apple-ios-sim` (in visionOS simulator, using Xcode's "Designed for iPad" setting) - `aarch64-apple-visionos-sim` (in visionOS Simulator) - macOS 15.3.1 VM - `aarch64-apple-darwin` - `aarch64-apple-ios-macabi` - macOS 10.12.6 on an Intel Macbook from 2013 - `x86_64-apple-darwin` - `i686-apple-darwin` - `x86_64-apple-ios` (in iOS Simulator) - iOS 9.3.6 on a 1st generation iPad Mini - `armv7-apple-ios` with an older compiler Along with manually inspecting the output of `version_from_sysctl()` and `version_from_plist()`, and verifying that they actually match what's expected. I believe the only real omissions here would be: - `aarch64-apple-ios` on a newer iPhone that has `sysctl` available (iOS 11.4 or above). - `aarch64-apple-ios` on a Vision Pro using Xcode's "Designed for iPad" setting. But I don't have the hardware available to test those. ``@rustbot`` label O-apple A-linkage -T-compiler -A-meta -A-run-make try-job: aarch64-apple
2025-09-05clean-up a bitAda Alakbarova-24/+20
- if-else reordering: having one fewer nesting levels makes it easier to understand imo
2025-09-05Merge pull request #2422 from aDotInTheVoid/tenthousandyearsAlona Enraght-Moony-2/+84
Start documenting tests/rustdoc-json
2025-09-05Better linkAlona Enraght-Moony-1/+1
2025-09-05Consistent punctuationAlona Enraght-Moony-4/+4
2025-09-05Make footnote render correctly in githubAlona Enraght-Moony-2/+2
2025-09-05Use `Itertools::all_equal_value()` where applicableYotam Ofek-46/+35
2025-09-05Bump stage0 rustfmtLeón Orell Valerian Liehr-121/+121
2025-09-05Fix `never_loop` forget to remove `break` in nested loop (#15356)Alejandra González-14/+170
Closes rust-lang/rust-clippy#15350 Follow up of rust-lang/rust-clippy#15064 changelog: [`never_loop`] add to remove `break` in nested loop
2025-09-05compiler: Add Windows resources to rustc-main and rustc_driverAleksey Kliger-8/+271
Adds Windows resources with the rust version information to rustc-main.exe and rustc_driver.dll Sets the product description to "Rust Compiler" or "Rust Compiler (channel)" for non-stable channels
2025-09-05Optimize Cargo with LTOJakub Beránek-2/+4
2025-09-05Fix conditionJakub Beránek-1/+1
2025-09-05single buffer for exponent fmt of integersPascal S. de Kloe-176/+213
2025-09-05rustc_middle: clippy fixesMarijn Schouten-20/+14
2025-09-05Auto merge of #146121 - Muscraft:filter-suggestion-parts, r=petrochenkovbors-8/+4
fix: Filter suggestion parts that match existing code While testing my changes to make `rustc` use `annotate-snippets`, I encountered a new `clippy` test failure stemming from [two](https://github.com/rust-lang/rust/pull/145273/files#diff-6e8403e31463539666afbc00479cb416dc767a518f562b6e2960630953ee7da2R275-R278) [suggestion](https://github.com/rust-lang/rust/pull/145273/files#diff-6e8403e31463539666afbc00479cb416dc767a518f562b6e2960630953ee7da2R289-R292) output changes in rust-lang/rust#145273. The new output in these two cases feels like a regression as it is not as clear as the old output, and adds unnecessary information. Before rust-lang/rust#145273 (`Diff` style) ![before](https://github.com/user-attachments/assets/36f33635-cbce-45f1-823d-0cbe6f0cfe46) After rust-lang/rust#145273 ("multi-line" style) ![after](https://github.com/user-attachments/assets/d4cb00b8-5a42-436e-9329-db84347138f0) The reason for the change was that a new suggestion part (which matches existing code) was added on a different line than the existing parts, causing the suggestion style to change from `Diff` to "multi-line". Since this new part matches existing code, no code changes show up in the output for it, but it still makes the suggestion style "multi-line" when it doesn't need to be. To get the old output back, I made it so that suggestion parts that perfectly match existing code get filtered out. try-job: aarch64-apple
2025-09-05Auto merge of #146121 - Muscraft:filter-suggestion-parts, r=petrochenkovbors-24/+21
fix: Filter suggestion parts that match existing code While testing my changes to make `rustc` use `annotate-snippets`, I encountered a new `clippy` test failure stemming from [two](https://github.com/rust-lang/rust/pull/145273/files#diff-6e8403e31463539666afbc00479cb416dc767a518f562b6e2960630953ee7da2R275-R278) [suggestion](https://github.com/rust-lang/rust/pull/145273/files#diff-6e8403e31463539666afbc00479cb416dc767a518f562b6e2960630953ee7da2R289-R292) output changes in rust-lang/rust#145273. The new output in these two cases feels like a regression as it is not as clear as the old output, and adds unnecessary information. Before rust-lang/rust#145273 (`Diff` style) ![before](https://github.com/user-attachments/assets/36f33635-cbce-45f1-823d-0cbe6f0cfe46) After rust-lang/rust#145273 ("multi-line" style) ![after](https://github.com/user-attachments/assets/d4cb00b8-5a42-436e-9329-db84347138f0) The reason for the change was that a new suggestion part (which matches existing code) was added on a different line than the existing parts, causing the suggestion style to change from `Diff` to "multi-line". Since this new part matches existing code, no code changes show up in the output for it, but it still makes the suggestion style "multi-line" when it doesn't need to be. To get the old output back, I made it so that suggestion parts that perfectly match existing code get filtered out. try-job: aarch64-apple
2025-09-05Add a comment about the "specialization" feature required because of `im-rc`Jakub Beránek-0/+2
2025-09-05Merge pull request #2577 from ada4a/patch-2Tshepang Mbambo-2/+2
Update renamed `take_region_var_origins`
2025-09-05Update renamed `take_region_var_origins`Ada Alakbarova-2/+2
This was first renamed to `get_region_var_origins` in https://github.com/rust-lang/rust/pull/109753, and then to `get_region_var_infos` in https://github.com/rust-lang/rust/commit/b0fc1d47d5dcffb5d516059d4a5af3b6843132d5
2025-09-05Add snapshot test for disting compiler docsJakub Beránek-1/+53
2025-09-05Respect top stage when documenting CargoJakub Beránek-2/+15
2025-09-05Merge pull request #2576 from ada4a/patch-1Tshepang Mbambo-1/+1
Update link to `resolve_regions_and_report_errors`
2025-09-05Allow `specialization` feature when documenting CargoJakub Beránek-4/+16
2025-09-05Add __isOSVersionAtLeast and __isPlatformVersionAtLeast symbolsMads Marquart-2/+1127
Allows users to link to Objective-C code using `@available(...)`.
2025-09-05Update link to `resolve_regions_and_report_errors`Ada Alakbarova-1/+1
Moved into `ObligationCtxt` in https://github.com/rust-lang/rust/commit/a19adefa0e5aca0aabca2430530577ee140e4efa
2025-09-05rustc-dev-guide: update docs for `run-make-cargo`Jieyou Xu-30/+39
2025-09-05triagebot: account for new `tests/run-make-cargo` test suiteJieyou Xu-0/+3
2025-09-05tidy: account for moved `tests/run-make/uefi-qemu`Jieyou Xu-1/+1
2025-09-05cg_gcc: run `run-make-cargo` testsJieyou Xu-3/+19
2025-09-05cg_clif: run `run-make-cargo` test suiteJieyou Xu-1/+1
2025-09-05cg_clif: account for moved `tests/run-make-cargo/compiler-builtins`Jieyou Xu-1/+1
2025-09-05ci: update jobs to also run `tests/run-make-cargo`Jieyou Xu-7/+9
For the ones that explicitly picks which test suite to run.
2025-09-05remove couple of clonesMatthias Krüger-4/+4
2025-09-05tests: update test instruction in `thumb-none-cortex-m`Jieyou Xu-1/+1
2025-09-05tests: move `run-make` tests requiring in-tree cargo to `run-make-cargo` ↵Jieyou Xu-0/+0
test suite
2025-09-05`run-make-support`: handle unavailable in-tree cargo under `run-make` test suiteJieyou Xu-6/+13
2025-09-05compiletest: implement {`run-make`,`run-make-cargo`} test suite splitJieyou Xu-7/+10
- `run-make` test suite will now no longer receive a `cargo`. - NOTE: the user could technically still write `Command::new("cargo")` which might find *a* cargo from the environment, but that is not a supported case. - `run-make-cargo` will receive a built in-tree `cargo`.
2025-09-05bootstrap: split `run-make` into {`run-make`,`run-make-cargo`} test suitesJieyou Xu-21/+80
So that contributors who don't need to run `run-make` tests that require in-tree `cargo` can run the non-cargo `run-make` tests without having to wait for `cargo` (which would require rebuilding as the build cache would be invalidated by compiler modifications without some kind of `--keep-stage-cargo`).
2025-09-05Ensure that `--html-after-content` option is used to check ↵Guillaume Gomez-2/+4
`scrape_examples_ice` rustdoc GUI test
2025-09-05rustc_infer: change top-level doc comment to innerMarijn Schouten-1/+1
2025-09-05DynamicConfig: use canonical clone implMarijn Schouten-1/+1
2025-09-05Auto merge of #146044 - estebank:issue-88727, r=chenyukangbors-49/+393
Suggest parentheses when `match` or `if` expression in binop is parsed as statement ``` error[E0308]: mismatched types --> $DIR/expr-as-stmt.rs:81:5 | LL | match () { _ => true } && match () { _ => true }; | ^^^^^^^^^^^^^^^^^^^^^^ expected `()`, found `bool` | help: parentheses are required to parse this as an expression | LL | (match () { _ => true }) && match () { _ => true }; | + + ``` Address the common case from rust-lang/rust#88727. The original parse error is still outstanding, but the cases brought up in the thread are resolved.
2025-09-05Merge pull request #4570 from RalfJung/atomic-rmw-intRalf Jung-1/+2
atomic rmw intrinsics: RHS must be an integer
2025-09-05gpu offload: change suspicious map into filterMarijn Schouten-1/+1
2025-09-05atomic rmw intrinsics: RHS must be an integerRalf Jung-1/+2
2025-09-05Merge pull request #4569 from RalfJung/atomic-rmwRalf Jung-127/+83
atomics: unify handling min/max and the other RMWs