Commit Graph

3385 Commits

Author SHA1 Message Date
bors b2fabe39bd Auto merge of #153673 - JonathanBrouwer:rollup-cGOKonI, r=JonathanBrouwer
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#153560 (Introduce granular tidy_ctx's check in extra_checks)
 - rust-lang/rust#153666 (Add a regression test for rust-lang/rust#153599)
 - rust-lang/rust#153493 (Remove `FromCycleError` trait)
 - rust-lang/rust#153549 (tests/ui/binop: add annotations for reference rules)
 - rust-lang/rust#153641 (Move `Spanned`.)
 - rust-lang/rust#153663 (Remove `TyCtxt::node_lint` method and `rustc_middle::lint_level` function)
 - rust-lang/rust#153664 (Add test for rust-lang/rust#109804)
2026-03-11 05:12:10 +00:00
bors d1c79458b5 Auto merge of #153379 - TKanX:refactor/149164-simplify-autodiff-rlib, r=ZuseZ4
refactor(autodiff): Simplify Autodiff Handling of `rlib` Dependencies

### Summary:

Resolves the two FIXMEs left in rust-lang/rust#149033, per @bjorn3 guidance in [the discussion](https://github.com/rust-lang/rust/pull/149033#discussion_r2535465880).

Closes rust-lang/rust#149164 

r? @ZuseZ4
cc @bjorn3
2026-03-11 02:03:25 +00:00
Nicholas Nethercote c12ab08c14 Move Spanned.
It's defined in `rustc_span::source_map` which doesn't make any sense
because it has nothing to do with source maps. This commit moves it to
the crate root, a more sensible spot for something this basic.
2026-03-11 06:25:23 +11:00
David Wood db5e2dc248 abi: s/ScalableVector/SimdScalableVector
Renaming to remove any ambiguity as to what "vector" refers to in this
context
2026-03-10 11:52:22 +00:00
Zalathar 985b41d387 Remove the rustc_data_structures::assert_matches! re-exports 2026-03-08 22:02:23 +11:00
Josh Stone 32bae1353e Update cfg(bootstrap) 2026-03-07 10:42:02 -08:00
Jonathan Brouwer 10eb844bac Remove eagerly_format_to_string from DiagCtxt 2026-03-06 18:52:11 +01:00
bors 64b72a1fa5 Auto merge of #150447 - WaffleLapkin:maybe-dangling-semantics, r=RalfJung
Implement `MaybeDangling` compiler support



Tracking issue: https://github.com/rust-lang/rust/issues/118166



cc @RalfJung
2026-03-05 12:21:27 +00:00
Waffle Lapkin 11bcf3759e make PointeeInfo::align non-optional
Instead of defaulting to `None` it now defaults to `Align::ONE` i.e.
no alignment restriction. Codegen test changes are due to us now skipping
`align 1` annotations (they are useless; not skipping them makes all the
raw pointers gain an `align 1` annotation which doesn't seem any good)
2026-03-05 11:53:38 +01:00
Waffle Lapkin 312055fad5 refactor PointeeInfo
Make `size`/`align` always correct rather than conditionally on the
`safe` field. This makes it less error prone and easier to work with for
`MaybeDangling` / potential future pointer kinds like `Aligned<_>`.
2026-03-05 11:53:38 +01:00
Jonathan Brouwer 7595e5b80d Rollup merge of #152283 - Sa4dUs:offload-handle-alloca, r=ZuseZ4
Properly pass offload sizes to kernel args

This PRs prevents offload from creating an unnecessary alloca when all the arg sizes are static.
I'll implement the first dynamic-size data type in a follow up PR (slice support).

r? @ZuseZ4
2026-03-05 06:31:37 +01:00
Jonathan Brouwer 53ef4d297e Rollup merge of #153414 - JonathanBrouwer:translate_cleanup, r=Kivooeo
Rename translation -> formatting

Because there is no translation happening anymore

r? @Kivooeo
2026-03-04 19:30:42 +01:00
Jonathan Brouwer d8092147fe Rename translation -> formatting 2026-03-04 17:47:24 +01:00
Tony Kan 8a3d0f4867 refactor(autodiff): Cast primal to fn ptr, drop Instance::try_resolve for source 2026-03-04 03:54:24 -08:00
Tony Kan dd9922151f refactor(autodiff): Simplify rlib dep handling; use fn_ptr_ty in adjust_activity_to_abi, drop mono-collection & cross-crate-inline workarounds 2026-03-04 03:53:52 -08:00
bjorn3 6ea5244ebf Move some methods to WriteBackendMethods 2026-03-03 15:26:30 +00:00
bjorn3 eff0d4c6f4 Fuse codegen into LTO optimize methods 2026-03-03 15:25:43 +00:00
bjorn3 22d4bb2592 Move print_pass_timings and print_statistics calls to rustc_interface 2026-03-03 15:25:42 +00:00
bjorn3 9e917ee7a6 Replace spawn_named_thread method with thread_profiler 2026-03-03 15:25:00 +00:00
bjorn3 dc3db2373c Slightly simplify write_bitcode_to_file handling
This also causes bitcode to be saved for the allocator shim with
-Csave-temps.
2026-03-03 15:24:16 +00:00
Jonathan Brouwer ee8e2dfaea Rollup merge of #153184 - bjorn3:split_crate_info_out_of_codegen_results, r=nnethercote
Replace CodegenResults with CompiledModules

This is already CodegenResults without CrateInfo. The driver can calculate the CrateInfo and pass it by-ref to the backend. Using CompiledModules makes it a bit easier to move some other things out of the backend as will be necessary for moving LTO to the link phase.

Helps with https://github.com/rust-lang/compiler-team/issues/908
2026-03-03 13:08:44 +01:00
Marcelo Domínguez abb86d6df4 Avoid alloca for fully static sizes 2026-03-03 11:52:01 +01:00
Jonathan Brouwer ca1b24406d Rollup merge of #152941 - RalfJung:abi-control, r=mati865
prefer actual ABI-controling fields over target.abi when making ABI decisions

We don't actually check that `abi` is consistent with the fields that control the ABI, e.g. one could set `llvm_abiname` to "ilp32e" on a riscv target without setting a matching `abi`. So, if we need to make actual decisions, better to use the source of truth we forward to LLVM than the informational string we forward to the user.

This is a breaking change for aarch64 JSON target specs: setting `abi` to "softfloat" is no longer enough; one has to also set `rustc_abi` to "softfloat". That is consistent with riscv and arm32, but it's still surprising. Cc @Darksonn in case this affects the Linux kernel.

Also see https://github.com/rust-lang/rust/pull/153035 which does something similar for PowerPC, and [Zulip](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/De-spaghettifying.20ABI.20controls/with/575095372). Happy to delay this PR if someone has a better idea.

Cc @folkertdev @workingjubilee
2026-03-03 07:14:11 +01:00
bjorn3 5aa980e6dc Replace CodegenResults with CompiledModules
This is already CodegenResults without CrateInfo. The driver can
calculate the CrateInfo and pass it by-ref to the backend. Using
CompiledModules makes it a bit easier to move some other things out of
the backend as will be necessary for moving LTO to the link phase.
2026-03-02 16:39:41 +00:00
bjorn3 a192c617ec Use CompiledModules inside CodegenResults
In preparation for fully replacing CodegenResults with CompiledModules.
2026-03-02 16:39:13 +00:00
Jonathan Brouwer ad4b2c01a1 Rollup merge of #153046 - bjorn3:cg_ssa_cleanups, r=TaKO8Ki
Couple of cg_ssa refactorings

These should help a bit with using cg_ssa in cg_clif at some point in the future.
2026-03-02 09:49:22 +01:00
Jonathan Brouwer 5cd5b90a38 Port rustc_autodiff to the attribute parsers 2026-02-26 09:50:36 +01:00
Jonathan Brouwer 90c93ab7c1 Move rustc_ast::AutoDiffAttrs to rustc_hir::RustcAutodiff 2026-02-26 09:41:21 +01:00
Jacob Pratt 236327e901 Rollup merge of #153092 - mu001999-contrib:cleanup/redundant-self, r=JonathanBrouwer
Remove redundant self usages

Extracted from https://github.com/rust-lang/rust/pull/152996.

r? petrochenkov
2026-02-25 21:42:58 -05:00
Jacob Pratt cb78bc4dd4 Rollup merge of #151771 - hoodmane:wasm-double-panic, r=bjorn3
Fix: On wasm targets, call `panic_in_cleanup` if panic occurs in cleanup

Previously this was not correctly implemented. Each funclet may need its own terminate block, so this changes the `terminate_block` into a `terminate_blocks` `IndexVec` which can have a terminate_block for each funclet. We key on the first basic block of the funclet -- in particular, this is the start block for the old case of the top level terminate function.

I also fixed the `terminate` handler to not be invoked when a foreign exception is raised, mimicking the behavior from msvc. On wasm, in order to avoid generating a `catch_all` we need to call `llvm.wasm.get.exception` and `llvm.wasm.get.ehselector`.
2026-02-25 21:42:53 -05:00
mu001999 ff0f239bb1 Remove redundant self usages 2026-02-25 22:51:53 +08:00
bjorn3 df4b228c71 Merge const_data_from_alloc into static_addr_of
In Cranelift a Value can't hold arbitrarily sized values.
2026-02-25 11:11:06 +00:00
Jacob Pratt 989efb8423 Rollup merge of #153017 - makai410:di-unsafe-binder, r=wesleywiser
Implement debuginfo for unsafe binder types

Fixes: rust-lang/rust#139462

This treats an unsafe binder like a struct with a single field. This way we'd have the binder's distinct type name while keeping the wrapped value accessible.

Tracking:
- https://github.com/rust-lang/rust/issues/130516
2026-02-24 22:51:40 -05:00
Hood Chatham acbfd79acf Fix: On wasm targets, call panic_in_cleanup if panic occurs in cleanup
Previously this was not correctly implemented. Each funclet may need its own terminate
block, so this changes the `terminate_block` into a `terminate_blocks` `IndexVec` which
can have a terminate_block for each funclet. We key on the first basic block of the
funclet -- in particular, this is the start block for the old case of the top level
terminate function.

Rather than using a catchswitch/catchpad pair, I used a cleanuppad. The reason for the
pair is to avoid catching foreign exceptions on MSVC. On wasm, it seems that the
catchswitch/catchpad pair is optimized back into a single cleanuppad and a catch_all
instruction is emitted which will catch foreign exceptions. Because the new logic is
only used on wasm, it seemed better to take the simpler approach seeing as they do the
same thing.
2026-02-24 17:47:27 +01:00
bjorn3 f03581a12b Introduce FunctionSignature associated type for BackendTypes
In Cranelift the regular Type enum can't represent function signatures.
Function pointers are represented as plain pointer sized integer.
2026-02-24 15:40:43 +00:00
bjorn3 e94aaf136d Reorder associated types in BackendTypes to be a bit more logical 2026-02-24 10:39:03 +00:00
bjorn3 e33e56225c Merge typeid_metadata into type_checked_load
This allows removing the Metadata associated type from BackendTypes.
2026-02-24 10:36:50 +00:00
Ralf Jung c66597eeec prefer actual ABI-controling fields over target.abi when making ABI decisions 2026-02-24 09:22:19 +01:00
Makai b6083435d8 implement debuginfo for unsafe binders 2026-02-23 23:32:56 +08:00
bjorn3 3decb52756 Remove last remaining ModuleBuffer/ThinBuffer duplication 2026-02-21 11:47:46 +00:00
bjorn3 ff454c12cd Simplify function signatures of serialize_module and prepare_thin 2026-02-21 11:47:45 +00:00
bjorn3 474a7168ab Remove explicit EmitThinLTOSummary argument
In favor of passing a NULL ThinLTOSummaryBufferRef. And improve type
improve type safety on the Rust side.
2026-02-21 11:47:45 +00:00
bjorn3 a086b3617e Remove ModuleBuffer ThinBuffer duplication 2026-02-21 11:47:45 +00:00
bjorn3 a5372d1dba Replace LLVMRustThinLTOBuffer with separate LLVMRustBuffers for bitcode and summary 2026-02-21 11:47:45 +00:00
bjorn3 8b2c10ff82 Replace LLVMRustModuleBuffer with generic LLVMRustBuffer 2026-02-21 11:47:45 +00:00
Jonathan Brouwer bbce734ce0 Rollup merge of #152527 - bjorn3:remove_z_emit_thin_lto, r=cuviper
Remove -Zemit-thin-lto flag

As far as I can tell it was introduced in https://github.com/rust-lang/rust/pull/98162 to allow fat LTO with `-Clinker-plugin-lto`. In https://github.com/rust-lang/rust/pull/136840 a change was made to automatically disable ThinLTO summary generation when `-Clinker-plugin-lto -Clto=fat` is used, so we can safely remove it.

Fixes rust-lang/rust#152490
2026-02-20 22:00:56 +01:00
bjorn3 6366a698e3 Remove -Zemit-thin-lto flag
As far as I can tell it was introduced to allow fat LTO with
-Clinker-plugin-lto. Later a change was made to automatically disable
ThinLTO summary generation when -Clinker-plugin-lto -Clto=fat is used,
so we can safely remove it.
2026-02-20 12:19:41 +00:00
Jana Dönszelmann decec173ec remove AttributeKind everywhere 2026-02-20 09:50:16 +01:00
Jana Dönszelmann 63edc913fa change all uses 2026-02-20 09:50:16 +01:00
Jonathan Brouwer 46126ac931 Rollup merge of #151733 - jdonszelmann:eii-on-apple, r=oli-obk
Use function shims to make sure EII works on apple targets

Use function shims to make sure EII works on apple targets (and generally accepts target-arch attributes)

Explainer: https://github.com/rust-lang/rust/pull/146348#issuecomment-3631810110
Tracking issue: https://github.com/rust-lang/rust/issues/125418
2026-02-19 10:56:36 +01:00