Commit graph

1988 commits

Author SHA1 Message Date
Antoni Boucher
38fa4a4861 Fix sysroot Cargo.toml for compiler-builtins 2025-06-28 18:08:26 -04:00
Antoni Boucher
a80f3c4a84 Fix clippy warnings 2025-06-28 16:31:38 -04:00
Antoni Boucher
a836612ab0 Merge branch 'master' into sync_from_rust_2025_06_28 2025-06-28 16:25:46 -04:00
antoyo
b7091eca6d
Merge pull request #694 from rust-lang/sync_from_rust_2025_06_02
Sync from rust 2025/06/02
2025-06-28 16:02:50 -04:00
Antoni Boucher
8385f3c4b0 Stop skipping libcore's f16::test_total_cmp 2025-06-28 15:41:58 -04:00
Antoni Boucher
f876b18783 Add TODOs 2025-06-28 15:40:48 -04:00
Antoni Boucher
49e65a0459 Remove commented code 2025-06-28 15:38:35 -04:00
Antoni Boucher
c7c16223ce Ignore failing test 2025-06-28 15:17:42 -04:00
Antoni Boucher
eb4d429515 Fix for libgccjit 12 2025-06-28 14:55:31 -04:00
Antoni Boucher
144989400e Fix to use Function instead of RValue 2025-06-28 14:51:16 -04:00
Antoni Boucher
5735bb39ab Merge branch 'master' into sync_from_rust_2025_06_02 2025-06-28 14:49:27 -04:00
Antoni Boucher
7c71c8388f Fix type_name intrinsic 2025-06-28 14:44:54 -04:00
Philipp Krones
7014ca4285 rustc_codegen_gcc: Fix clippy::manual_is_multiple_of 2025-06-27 13:56:13 +02:00
antoyo
98d65f234f
Merge pull request #722 from FractalFir/func_refactor
Remove unnecesary uses of the 'current_func' field, replacing it with  a call to function.
2025-06-26 09:22:52 -04:00
michal kostrubiec
413821fcbd Remove unnecesary uses of the 'current_func' field, replacing it with a call to function. 2025-06-26 11:00:31 +02:00
antoyo
79564c86d1
Merge pull request #720 from FractalFir/func_refactor
Refactored the codebase to use Function instead of RValue where possible.
2025-06-25 08:52:27 -04:00
michal kostrubiec
b03f7f87ff Refactored the codebase to use Function instead of RValue where possible. 2025-06-25 13:19:28 +02:00
antoyo
54b1ff5027
Merge pull request #718 from FractalFir/needless_align
Skip needless calls to get_align in some cases.
2025-06-24 18:19:46 -04:00
michal kostrubiec
8571aee687 Skip needless calls to get_align in some cases. 2025-06-24 22:34:43 +02:00
Mark Rousskov
f8db66bc5c Remove dead instructions in terminate blocks 2025-06-22 11:38:47 -04:00
antoyo
962a08ff4a
Merge pull request #716 from FractalFir/abi-cafe
Fixed some clippy warnings.
2025-06-20 14:37:22 -04:00
michal kostrubiec
b2b117ee28 Fixed some clippy warnings. 2025-06-20 19:34:48 +02:00
Ralf Jung
1aabebc32b various minor target feature cleanups 2025-06-19 10:50:03 +09:00
Ralf Jung
3a0881c11b cg_gcc: properly populate cfg(target_features) with -Ctarget-features 2025-06-19 09:45:07 +09:00
Ralf Jung
63c9292d56 move -Ctarget-feature handling into shared code 2025-06-19 09:44:01 +09:00
Ralf Jung
25eb2ee146 move cfg(target_feature) computation into shared place 2025-06-19 09:42:35 +09:00
antoyo
395bca1671
Merge pull request #710 from FractalFir/abi-cafe
Added support for testing the backend with abi-cafe
2025-06-18 18:58:31 -04:00
Guillaume Gomez
6bbf8b1098 GCC backend: Remove add_eval if no function is created 2025-06-18 15:31:01 +02:00
Guillaume Gomez
efb79975f6 Merge commit 'fda0bb9588' into subtree-update_cg_gcc_2025-06-18 2025-06-18 15:11:44 +02:00
bors
265f4a7b63 Auto merge of #141061 - dpaoliello:shimasfn, r=bjorn3
Change __rust_no_alloc_shim_is_unstable to be a function

This fixes a long sequence of issues:

1. A customer reported that building for Arm64EC was broken: #138541
2. This was caused by a bug in my original implementation of Arm64EC support, namely that only functions on Arm64EC need to be decorated with `#` but Rust was decorating statics as well.
3. Once I corrected Rust to only decorate functions, I started linking failures where the linker couldn't find statics exported by dylib dependencies. This was caused by the compiler not marking exported statics in the generated DEF file with `DATA`, thus they were being exported as functions not data.
4. Once I corrected the way that the DEF files were being emitted, the linker started failing saying that it couldn't find `__rust_no_alloc_shim_is_unstable`. This is because the MSVC linker requires the declarations of statics imported from other dylibs to be marked with `dllimport` (whereas it will happily link to functions imported from other dylibs whether they are marked `dllimport` or not).
5. I then made a change to ensure that `__rust_no_alloc_shim_is_unstable` was marked as `dllimport`, but the MSVC linker started emitting warnings that `__rust_no_alloc_shim_is_unstable` was marked as `dllimport` but was declared in an obj file. This is a harmless warning which is a performance hint: anything that's marked `dllimport` must be indirected via an `__imp` symbol so I added a linker arg in the target to suppress the warning.
6. A customer then reported a similar warning when using `lld-link` (<https://github.com/rust-lang/rust/pull/140176#issuecomment-2872448443>). I don't think it was an implementation difference between the two linkers but rather that, depending on the obj that the declaration versus uses of `__rust_no_alloc_shim_is_unstable` landed in we would get different warnings, so I suppressed that warning as well: #140954.
7. Another customer reported that they weren't using the Rust compiler to invoke the linker, thus these warnings were breaking their build: <https://github.com/rust-lang/rust/pull/140176#issuecomment-2881867433>. At that point, my original change was reverted (#141024) leaving Arm64EC broken yet again.

Taking a step back, a lot of these linker issues arise from the fact that `__rust_no_alloc_shim_is_unstable` is marked as `extern "Rust"` in the standard library and, therefore, assumed to be a foreign item from a different crate BUT the Rust compiler may choose to generate it either in the current crate, some other crate that will be statically linked in OR some other crate that will by dynamically imported.

Worse yet, it is impossible while building a given crate to know if `__rust_no_alloc_shim_is_unstable` will statically linked or dynamically imported: it might be that one of its dependent crates is the one with an allocator kind set and thus that crate (which is compiled later) will decide depending if it has any dylib dependencies or not to import `__rust_no_alloc_shim_is_unstable` or generate it. Thus, there is no way to know if the declaration of `__rust_no_alloc_shim_is_unstable` should be marked with `dllimport` or not.

There is a simple fix for all this: there is no reason `__rust_no_alloc_shim_is_unstable` must be a static. It needs to be some symbol that must be linked in; thus, it could easily be a function instead. As a function, there is no need to mark it as `dllimport` when dynamically imported which avoids the entire mess above.

There may be a perf hit for changing the `volatile load` to be a `tail call`, so I'm happy to change that part back (although I question what the codegen of a `volatile load` would look like, and if the backend is going to try to use load-acquire semantics).

Build with this change applied BEFORE #140176 was reverted to demonstrate that there are no linking issues with either MSVC or MinGW: <https://github.com/rust-lang/rust/actions/runs/15078657205>

Incidentally, I fixed `tests/run-make/no-alloc-shim` to work with MSVC as I needed it to be able to test locally (FYI for #128602)

r? `@bjorn3`
cc `@jieyouxu`
2025-06-18 09:24:40 +00:00
bors
2811b34c0e Auto merge of #137944 - davidtwco:sized-hierarchy, r=oli-obk
Sized Hierarchy: Part I

This patch implements the non-const parts of rust-lang/rfcs#3729. It introduces two new traits to the standard library, `MetaSized` and `PointeeSized`. See the RFC for the rationale behind these traits and to discuss whether this change makes sense in the abstract.

These traits are unstable (as is their constness), so users cannot refer to them without opting-in to `feature(sized_hierarchy)`. These traits are not behind `cfg`s as this would make implementation unfeasible, there would simply be too many `cfg`s required to add the necessary bounds everywhere. So, like `Sized`, these traits are automatically implemented by the compiler.

RFC 3729 describes changes which are necessary to preserve backwards compatibility given the introduction of these traits, which are implemented and as follows:

- `?Sized` is rewritten as `MetaSized`
- `MetaSized` is added as a default supertrait for all traits w/out an explicit sizedness supertrait already.

There are no edition migrations implemented in this,  as these are primarily required for the constness parts of the RFC and prior to stabilisation of this (and so will come in follow-up PRs alongside the const parts). All diagnostic output should remain the same (showing `?Sized` even if the compiler sees `MetaSized`) unless the `sized_hierarchy` feature is enabled.

Due to the use of unstable extern types in the standard library and rustc, some bounds in both projects have had to be relaxed already - this is unfortunate but unavoidable so that these extern types can continue to be used where they were before. Performing these relaxations in the standard library and rustc are desirable longer-term anyway, but some bounds are not as relaxed as they ideally would be due to the inability to relax `Deref::Target` (this will be investigated separately).

It is hoped that this is implemented such that it could be merged and these traits could exist "under the hood" without that being observable to the user (other than in any performance impact this has on the compiler, etc). Some details might leak through due to the standard library relaxations, but this has not been observed in test output.

**Notes:**

- Any commits starting with "upstream:" can be ignored, as these correspond to other upstream PRs that this is based on which have yet to be merged.
- This best reviewed commit-by-commit. I've attempted to make the implementation easy to follow and keep similar changes and test output updates together.
  - Each commit has a short description describing its purpose.
  - This patch is large but it's primarily in the test suite.
- I've worked on the performance of this patch and a few optimisations are implemented so that the performance impact is neutral-to-minor.
- `PointeeSized` is a different name from the RFC just to make it more obvious that it is different from `std::ptr::Pointee` but all the names are yet to be bikeshed anyway.
- `@nikomatsakis` has confirmed [that this can proceed as an experiment from the t-lang side](https://rust-lang.zulipchat.com/#narrow/channel/435869-project-goals/topic/SVE.20and.20SME.20on.20AArch64.20.28goals.23270.29/near/506196491)
- FCP in https://github.com/rust-lang/rust/pull/137944#issuecomment-2912207485

Fixes rust-lang/rust#79409.

r? `@ghost` (I'll discuss this with relevant teams to find a reviewer)
2025-06-17 15:08:50 +00:00
David Wood
e9d795d717 cranelift/gcc: {Meta,Pointee,}Sized in minicore
As in many previous commits, adding the new traits to minicore, but this
time for cranelift and gcc.
2025-06-16 23:04:37 +00:00
Daniel Paoliello
5615d055a7 Change __rust_no_alloc_shim_is_unstable to be a function 2025-06-16 10:54:07 -07:00
antoyo
fda0bb9588
Merge pull request #713 from GuillaumeGomez/fix-warnings
Fix fuzz warnings and deny warnings by default in build system
2025-06-16 11:55:20 -04:00
Guillaume Gomez
8392a0041f Make the tempfile version in Cargo.toml matches the one in Cargo.lock 2025-06-16 17:33:03 +02:00
Guillaume Gomez
bbcc84a05d Update tempfile dependency 2025-06-16 17:01:56 +02:00
Guillaume Gomez
fec46a44ba Fix clippy lints 2025-06-16 17:01:56 +02:00
Guillaume Gomez
46c14b7b3f Run clippy correctly, run it on build_system as well and run it earlier 2025-06-16 16:15:36 +02:00
Guillaume Gomez
05af962fa4 Fix warnings when not using the master feature 2025-06-16 15:07:24 +02:00
Guillaume Gomez
9848c66a36 Fix warnings 2025-06-16 14:23:45 +02:00
beetrees
308ca33774 Fix RISC-V C function ABI when passing/returning structs containing floats 2025-06-16 10:14:07 +01:00
León Orell Valerian Liehr
8f47346726 Rollup merge of #141769 - bjorn3:codegen_metadata_module_rework, r=workingjubilee,saethlin
Move metadata object generation for dylibs to the linker code

This deduplicates some code between codegen backends and may in the future allow adding extra metadata that is only known at link time.

Prerequisite of https://github.com/rust-lang/rust/issues/96708.
2025-06-15 23:51:54 +02:00
León Orell Valerian Liehr
29e0e4f4ea Rollup merge of #133952 - bjorn3:remove_wasm_legacy_abi, r=alexcrichton
Remove wasm legacy abi

Closes https://github.com/rust-lang/rust/issues/122532
Closes https://github.com/rust-lang/rust/issues/138762
Fixes https://github.com/rust-lang/rust/issues/71871
https://github.com/rust-lang/rust/issues/88152
Fixes https://github.com/rust-lang/rust/issues/115666
Fixes https://github.com/rust-lang/rust/issues/129486
2025-06-15 23:51:53 +02:00
antoyo
82d7cd4dbc
Merge pull request #709 from rust-lang/reenable-run-make-tests
Reenable run-make tests
2025-06-14 18:10:49 -04:00
Antoni Boucher
735a6d3a50 Switch to gcc-14 by default to fix some run-make tests 2025-06-14 17:44:47 -04:00
michal kostrubiec
ed441b64ed Added support for testing the backend with abi-cafe 2025-06-14 20:58:07 +02:00
bors
5b660c5357 Auto merge of #142259 - sayantn:simplify-intrinsics, r=workingjubilee
Simplify implementation of Rust intrinsics by using type parameters in the cache

The current implementation of intrinsics have a lot of duplication to handle different overloads of overloaded LLVM intrinsic. This PR uses the **base name and the type parameters** in the cache instead of the full, overloaded name. This has the benefit that `call_intrinsic` doesn't need to provide the full name, rather the type parameters (which is most of the time more available). This uses `LLVMIntrinsicCopyOverloadedName2` to get the overloaded name from the base name and the type parameters, and only uses it to declare the function.

(originally was part of rust-lang/rust#140763, split off later)

`@rustbot` label A-codegen A-LLVM
r? codegen
2025-06-14 16:43:34 +00:00
Antoni Boucher
5bd2c804b0 Fix for tests/run-make/no-builtins-attribute 2025-06-14 11:19:53 -04:00
bjorn3
3c96f6e5a7 Remove all support for wasm's legacy ABI 2025-06-14 09:57:06 +00:00
Matthias Krüger
4ffcf8021a Rollup merge of #141811 - mejrs:bye_locals, r=compiler-errors
Unimplement unsized_locals

Implements https://github.com/rust-lang/compiler-team/issues/630

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

Note that this just removes the feature, not the implementation, and does not touch `unsized_fn_params`. This is because it is required to support `Box<dyn FnOnce()>: FnOnce()`.

There may be more that should be removed (possibly in follow up prs)
- the `forget_unsized` function and `forget` intrinsic.
- the `unsized_locals` test directory; I've just fixed up the tests for now
- various codegen support for unsized values and allocas

cc ``@JakobDegen`` ``@oli-obk`` ``@Noratrieb`` ``@programmerjake`` ``@bjorn3``

``@rustbot`` label F-unsized_locals

Fixes rust-lang/rust#79409
2025-06-14 11:27:10 +02:00