about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-09-07Reimplement DestinationPropagation according to live ranges.Camille GILLOT-554/+435
2025-09-07Introduce fast insertion at extremities to IntervalSet.Camille GILLOT-27/+90
2025-09-07Auto merge of #146289 - cjgillot:gvn-aggregate, r=dianqkbors-28/+17
GVN: Allow reusing aggregates if LHS is not a simple local. This resolves a FIXME in the code. I don't see a reason not to allow this.
2025-09-07Ensure indirect is first projection in try_as_place.Camille GILLOT-0/+5
2025-09-07Introduce PlaceContext::may_observe_address.Camille GILLOT-8/+23
2025-09-07Auto merge of #146292 - matthiaskrgr:rollup-bkjs887, r=matthiaskrgrbors-153/+38
Rollup of 2 pull requests Successful merges: - rust-lang/rust#146254 (Use `Itertools::all_equal_value()` where applicable) - rust-lang/rust#146290 (Revert "Add LSX accelerated implementation for source file analysis") r? `@ghost` `@rustbot` modify labels: rollup
2025-09-07Rollup merge of #146290 - heiher:r-src-analysis-lsx, r=lqdMatthias Krüger-107/+3
Revert "Add LSX accelerated implementation for source file analysis" This reverts commit 5b43244ac59119870c9e0f6b642340ab88355b23 to fix native build failures on LoongArch. Link: https://github.com/rust-lang/rust/pull/145963#issuecomment-3263195096 Link: https://github.com/rust-lang/rust/pull/145963#issuecomment-3263420700
2025-09-07Rollup merge of #146254 - yotamofek:pr/itertools-all-equal-value, r=cjgillotMatthias Krüger-46/+35
Use `Itertools::all_equal_value()` where applicable Just a small cleanup. We already have `itertools` as a dep in these crates, so might as well use another of its features. Makes the code simpler IMHO :)
2025-09-07Auto merge of #146271 - niacdoial:improperctypes-refactor1, r=tgross35bors-886/+1036
lint ImproperCTypes: refactor linting architecture (part 1) This is the first PR in an effort to split rust-lang/rust#134697 into individually-mergeable parts. This one focuses on properly packaging the lint and its tests, as well as properly separate the "linting" and "type-checking" code. There is exactly one user-visible change: the safety of `Option<Box<FFISafePointee>>` is now the same in `extern` blocks and function definitions: it is safe. r? `@tgross35` because you are already looking at the original
2025-09-07Revert "Add LSX accelerated implementation for source file analysis"WANG Rui-107/+3
This reverts commit 5b43244ac59119870c9e0f6b642340ab88355b23 to fix native build failures on LoongArch.
2025-09-07Allow simplifying aggregates if LHS is not a simple local.Camille GILLOT-28/+17
2025-09-07Auto merge of #146285 - matthiaskrgr:rollup-oaokoo3, r=matthiaskrgrbors-22/+16
Rollup of 4 pull requests Successful merges: - rust-lang/rust#146200 (Simplify rustdoc-gui tester by calling directly browser-ui-test) - rust-lang/rust#146236 (gpu offload: change suspicious map into filter) - rust-lang/rust#146240 (DynamicConfig: use canonical clone impl) - rust-lang/rust#146251 (rustc_middle: clippy fixes) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-06Rollup merge of #146251 - hkBst:clippy-fix-8, r=cjgillotMatthias Krüger-20/+14
rustc_middle: clippy fixes Fixes for: ```text warning: bound is defined in more than one place warning: empty line after doc comment ```
2025-09-06Rollup merge of #146240 - hkBst:query-1, r=cjgillotMatthias Krüger-1/+1
DynamicConfig: use canonical clone impl Fixes clippy warning: ```text warning: non-canonical implementation of `clone` on a `Copy` type --> compiler/rustc_query_impl/src/lib.rs:60:29 | 60 | fn clone(&self) -> Self { | _____________________________^ 61 | | DynamicConfig { dynamic: self.dynamic } 62 | | } | |_____^ help: change this to: `{ *self }` ```
2025-09-06Rollup merge of #146236 - hkBst:gpu-1, r=ZuseZ4Matthias Krüger-1/+1
gpu offload: change suspicious map into filter Fixes clippy warning: ```text warning: this call to `map()` won't have an effect on the call to `count()` --> compiler/rustc_codegen_llvm/src/builder/gpu_offload.rs:194:25 | 194 | let num_ptr_types = types | _________________________^ 195 | | .iter() 196 | | .map(|&x| matches!(cx.type_kind(x), rustc_codegen_ssa::common::TypeKind::Pointer)) 197 | | .count(); | |________________^ | = help: make sure you did not confuse `map` with `filter`, `for_each` or `inspect` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#suspicious_map = note: `-W clippy::suspicious-map` implied by `-W clippy::suspicious` = help: to override `-W clippy::suspicious` add `#[allow(clippy::suspicious_map)]` ```
2025-09-06Auto merge of #146282 - tgross35:rollup-0n5tjnm, r=tgross35bors-6/+17
Rollup of 5 pull requests Successful merges: - rust-lang/rust#139524 (Add socket extensions for cygwin) - rust-lang/rust#145940 (single buffer for exponent fmt of integers) - rust-lang/rust#146206 (identity uses are ok, even if there are no defining uses) - rust-lang/rust#146272 (Update comment for `-Werror` on LLVM builds) - rust-lang/rust#146280 (Make `LetChainsPolicy` public for rustfmt usage) r? `@ghost` `@rustbot` modify labels: rollup
2025-09-06ImproperCTypes: redo state trackingniacdoial-138/+225
No changes should be visible by rustc users This is just some architecture changes to the type checking to facilitate FFI-safety decisions that depend on how the type is used (the change here is not complete, there are still bits of "legacy" state passing for this, but since this is a retconned commit, I can tell you those bits will disappear before the end of the commit chain) (there is at least one bit where the decision making code is weird, but that this is because we do not want to change the lint's behaviour this early in the chain)
2025-09-06ImproperCTypes: re-separate linting and checkingniacdoial-224/+292
no visible changes to rust users, just making the inner architecture of the ImproperCTypes lints more sensible, with a clean separation between the struct (now singular) that interacts with the linting system and the struct (now singular) that visits the types to check FFI-safety
2025-09-06ImproperCTypes: more pre-emptive cleanupniacdoial-30/+15
Mainly, we realise that the non-null assumption on a Box<_> argument does not depend on what side of the FFI boundary the function is on. And anyway, this is not the way to deal with this assumption being maybe violated.
2025-09-06ImproperCTypes: move code and tests into proper directoriesniacdoial-859/+869
2025-09-06Rollup merge of #146280 - mohe2015:public-for-rustfmt-forks, r=lqdTrevor Gross-1/+3
Make `LetChainsPolicy` public for rustfmt usage Related to https://github.com/rust-lang/rust/pull/138511. To call `Parser::parse_expr_cond` from [rustfmt forks for custom macro formatting](https://github.com/tucant/rustfmt/blob/30c83df9e1db10007bdd16dafce8a86b404329b2/src/parse/macros/html.rs#L57) you need to pass this enum so it would be nice if it could be public. Thank you.
2025-09-06Rollup merge of #146272 - rperier:rustc_llvm_werror_remove_commment_llvm22, ↵Trevor Gross-4/+4
r=tgross35 Update comment for `-Werror` on LLVM builds cc rust-lang/rust#109712 see https://github.com/rust-lang/rust/issues/109712#issuecomment-3257474643
2025-09-06Rollup merge of #146206 - lcnr:fix-non-defining-uses, r=BoxyUwUTrevor Gross-1/+10
identity uses are ok, even if there are no defining uses fix rust-lang/rust#146191 I've tried moving the "is this an identity use" check to `fn clone_and_resolve_opaque_types` and this would allow the following code to compile as it now ignores `Opaque<'!a> = Opaque<'!a>` while they previously resulted in errors https://github.com/rust-lang/rust/blob/71289c378d0a406a4f537fe4001282d19362931f/tests/ui/type-alias-impl-trait/hkl_forbidden.rs#L42-L46 The closure signature gets inferred to `for<'a> fn(&'a ()) -> Inner<'a>`. The closure then has a defining use `Inner<'a_latbound> = &'a_latebound ()` while the parent function has a non-defining `Inner<'!a> = Inner<'!a>`. By eagerly discarding identity uses we don't error on the non-defining use in the parent. r? `@BoxyUwU`
2025-09-06Auto merge of #146233 - jieyouxu:run-make-fission, r=Kobzolbors-5/+21
Split `run-make` into two {`run-make`,`run-make-cargo`} test suites ## Summary Split `tests/run-make` into two test suites, to make it faster and more convenient for contributors to run run-make tests that do not need in-tree `cargo`. | New test suites | Explanation | | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `tests/run-make` | The "fast path" test suite intended for run-make tests that do not need in-tree `cargo`. These tests may not use `cargo`. | | `tests/run-make-cargo` | The "slow path" test suite that requires checking out `cargo` submodule and building in-tree `cargo`, and thus will have access to in-tree `cargo`. In practice, these constitute a very small portion of the original `run-make` tests. | This PR carries out [MCP 847: Split run-make test suite into slower-building test suite with suitably-staged cargo and faster-building test suite without cargo](https://github.com/rust-lang/compiler-team/issues/847). Fixes rust-lang/rust#135573 (for the tests that do not need in-tree `cargo`). Fixes rust-lang/rust#134109. ## Remarks - I considered if we want to split by in-tree tools previously. However, as discussed rust-lang/rust#134109, in practice `rustdoc` is not very slow to build, but `cargo` takes a good few minutes. So, the partition boundary was determined to be along in-tree `cargo` availability. - The `run-make` tests previously that wanted to use `cargo` cannot just use the bootstrap `cargo`, otherwise they would run into situations where bootstrap `cargo` can significantly diverge from in-tree `cargo` (see https://github.com/rust-lang/rust/pull/130642). --- try-job: aarch64-msvc-1 try-job: test-various try-job: x86_64-gnu-debug try-job: aarch64-gnu-debug try-job: aarch64-apple try-job: dist-various-1
2025-09-06Move timers into execute_*_work_itembjorn3-27/+20
2025-09-06Remove want_summary argument from prepare_thinbjorn3-37/+16
It is always false nowadays. ThinLTO summary writing is instead done by llvm_optimize.
2025-09-06Remove thin_link_data method from ThinBufferMethodsbjorn3-13/+8
It is only used within cg_llvm.
2025-09-06Make `LetChainsPolicy` public for rustfmt usageMoritz Hedtke-1/+3
2025-09-06Auto merge of #146232 - bjorn3:lto_allocator_shim, r=lqdbors-29/+60
Make the allocator shim participate in LTO again This is likely the cause of the perf regression in https://github.com/rust-lang/rust/pull/145955. It also caused some functional regressions. Fixes https://github.com/rust-lang/rust/issues/146235 Fixes https://github.com/rust-lang/rust/issues/146239
2025-09-06Update comment for werror on rust-lang/rust CI explaining why we keep MSVC ↵Romain Perier-4/+4
definitively excluded
2025-09-06identity uses are ok, even if there are no defining useslcnr-1/+10
2025-09-06Ensure fat LTO doesn't merge everything into the allocator modulebjorn3-3/+21
2025-09-06Rollup merge of #146211 - Urgau:cfg-disallow-shebang, r=fmeaseMatthias Krüger-22/+42
Disallow shebang in `--cfg` and `--check-cfg` arguments This PR is similar to https://github.com/rust-lang/rust/issues/146130, where we disallowed frontmatter in `--cfg` and `--check-cfg` arguments. While fixing the other one we also discovered that shebang `#!/usr/bin/shebang` are currently also allowed in `--cfg` and `--check-cfg` arguments. Allowing shebang in them (which are just ignored) was never intended, this PR fixes that by not stripping shebang for `--cfg` and `--check-cfg` arguments. This is technically a breaking-change, although I don't expect anyone to actually rely on this unintended behavior. Fixes https://github.com/rust-lang/rust/issues/146130#issuecomment-3246299499 r? fmease
2025-09-06Rollup merge of #144801 - estebank:issue-144734, r=spastorinoMatthias Krüger-10/+68
Suggest bounds in more cases, accounting for type parameters referenced in predicate Use a `ty::Visitor` to see if the failed predicate references a type parameter. If it does, then we only suggest adding a bound to an (associated) item only if the referenced parameter is present in its generics. Provide adding bound suggestion in trait and impl associated functions in cases we previously weren't: ``` error[E0277]: `?` couldn't convert the error to `ApplicationError` --> $DIR/suggest-complex-bound-on-method.rs:18:16 | LL | t.run()?; | -----^ the trait `From<<T as Trait>::Error>` is not implemented for `ApplicationError` | | | this can't be annotated with `?` because it has type `Result<_, <T as Trait>::Error>` | note: `ApplicationError` needs to implement `From<<T as Trait>::Error>` --> $DIR/suggest-complex-bound-on-method.rs:12:1 | LL | enum ApplicationError { | ^^^^^^^^^^^^^^^^^^^^^ = note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement | LL | fn thing<T: Trait>(&self, t: T) -> Result<(), ApplicationError> where ApplicationError: From<<T as Trait>::Error> { | +++++++++++++++++++++++++++++++++++++++++++++++++ ``` Fix rust-lang/rust#144734.
2025-09-06Rollup merge of #127316 - klensy:tracing-bump, r=KobzolMatthias Krüger-3/+3
move pinned version from tracing_core to tracing This PR removes pin from `tracing-core` and moves it to `tracing`, which regressed perf in > 0.1.37 versions.
2025-09-06Make the allocator shim participate in LTO againbjorn3-26/+39
2025-09-05Some hygiene doc improvementsCameron Steffen-12/+22
2025-09-05Ignore intrinsic calls in cross-crate-inlining cost modelBen Kimock-1/+10
2025-09-06Disallow shebang in `--cfg` and `--check-cfg` argumentsUrgau-22/+42
2025-09-05Rollup merge of #146243 - matthiaskrgr:declone, r=lqdLeón Orell Valerian Liehr-4/+4
remove couple of redundant clones
2025-09-05Rollup merge of #146241 - hkBst:context-1, r=jieyouxuLeón Orell Valerian Liehr-1/+1
rustc_infer: change top-level doc comment to inner
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 #138944 - madsmtm:apple_os_version_check, r=tgross35León Orell Valerian Liehr-2/+6
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-05Use `Itertools::all_equal_value()` where applicableYotam Ofek-46/+35
2025-09-05compiler: Add Windows resources to rustc-main and rustc_driverAleksey Kliger-3/+257
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-05rustc_middle: clippy fixesMarijn Schouten-20/+14
2025-09-05Auto merge of #146121 - Muscraft:filter-suggestion-parts, r=petrochenkovbors-16/+17
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 __isOSVersionAtLeast and __isPlatformVersionAtLeast symbolsMads Marquart-2/+6
Allows users to link to Objective-C code using `@available(...)`.
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