Commit graph

4714 commits

Author SHA1 Message Date
bjorn3
a8774c3dab Merge branch 'sync_from_rust' 2025-02-15 14:16:35 +00:00
bjorn3
0b90953a2d Merge commit '557ed8ebb7' into sync_cg_clif-2025-02-15 2025-02-15 14:13:01 +00:00
bjorn3
557ed8ebb7 Rustup to rustc 1.86.0-nightly (d8810e3e2 2025-02-14) 2025-02-15 12:30:44 +00:00
bjorn3
91397074fc Sync from rust d8810e3e2d 2025-02-15 11:24:22 +00:00
bjorn3
de27d8593d Update to newer Ubuntu in CI for distributing precompiled artifacts
GHA is going to remove support for ubuntu-20.04 in a couple of months
2025-02-14 10:57:29 +00:00
bjorn3
aa9cbd7c3c Rustup to rustc 1.86.0-nightly (a567209da 2025-02-13) 2025-02-14 10:17:47 +00:00
bjorn3
c0c106d4aa Sync from rust a567209daa 2025-02-14 10:08:19 +00:00
clubby789
66bcca11ed Make -O mean -C opt-level=3 2025-02-13 19:47:55 +00:00
bjorn3
8dda1ebfb6 Update rustfmt.toml to match the rust repo 2025-02-13 14:54:50 +00:00
bjorn3
cdadd5f4cd Use correct size for stack slot in inline asm codegen 2025-02-13 14:29:49 +00:00
bjorn3
27e8329b20 Slightly optimize dynamic realignment in create_stack_slot 2025-02-13 14:23:18 +00:00
bjorn3
c27715bf66 Use abi rather than preferred alignment everywhere
Turns out the size of a type is not necessarily a multiple of the
preferred alignment, which broke the realignment logic in
create_stack_slot.
2025-02-13 14:22:57 +00:00
Jacob Pratt
7a4b898b2d Rollup merge of #136660 - compiler-errors:BikeshedGuaranteedNoDrop, r=lcnr
Use a trait to enforce field validity for union fields + `unsafe` fields + `unsafe<>` binder types

This PR introduces a new, internal-only trait called `BikeshedGuaranteedNoDrop`[^1] to faithfully model the field check that used to be implemented manually by `allowed_union_or_unsafe_field`.

942db6782f/compiler/rustc_hir_analysis/src/check/check.rs (L84-L115)

Copying over the doc comment from the trait:

```rust
/// Marker trait for the types that are allowed in union fields, unsafe fields,
/// and unsafe binder types.
///
/// Implemented for:
/// * `&T`, `&mut T` for all `T`,
/// * `ManuallyDrop<T>` for all `T`,
/// * tuples and arrays whose elements implement `BikeshedGuaranteedNoDrop`,
/// * or otherwise, all types that are `Copy`.
///
/// Notably, this doesn't include all trivially-destructible types for semver
/// reasons.
///
/// Bikeshed name for now.
```

As far as I am aware, there's no new behavior being guaranteed by this trait, since it operates the same as the manually implemented check. We could easily rip out this trait and go back to using the manually implemented check for union fields, however using a trait means that this code can be shared by WF for `unsafe<>` binders too. See the last commit.

The only diagnostic changes are that this now fires false-negatives for fields that are ill-formed. I don't consider that to be much of a problem though.

r? oli-obk

[^1]: Please let's not bikeshed this name lol. There's no good name for `ValidForUnsafeFieldsUnsafeBindersAndUnionFields`.
2025-02-13 03:53:30 -05:00
Michael Goulet
c6ddd335a8 Implement and use BikeshedGuaranteedNoDrop for union/unsafe field validity 2025-02-13 03:45:04 +00:00
bors
f9116db090 Auto merge of #136954 - jhpratt:rollup-koefsot, r=jhpratt
Rollup of 12 pull requests

Successful merges:

 - #134090 (Stabilize target_feature_11)
 - #135025 (Cast allocas to default address space)
 - #135841 (Reject `?Trait` bounds in various places where we unconditionally warned since 1.0)
 - #136217 (Mark condition/carry bit as clobbered in C-SKY inline assembly)
 - #136699 (std: replace the `FromInner` implementation for addresses with private conversion functions)
 - #136806 (Fix cycle when debug-printing opaque types from RPITIT)
 - #136807 (compiler: internally merge `PtxKernel` into `GpuKernel`)
 - #136818 (Implement `read*_exact` for `std:io::repeat`)
 - #136927 (Correctly escape hashtags when running `invalid_rust_codeblocks` lint)
 - #136937 (Update books)
 - #136945 (Add diagnostic item for `std::io::BufRead`)
 - #136947 (Reinstate nnethercote in the review rotation.)

r? `@ghost`
`@rustbot` modify labels: rollup
2025-02-13 02:13:24 +00:00
Jacob Pratt
7b12050ad9 Rollup merge of #136807 - workingjubilee:merge-gpus-to-get-the-arcradeongeforce, r=bjorn3
compiler: internally merge `PtxKernel` into `GpuKernel`

r? ``@bjorn3`` for review
2025-02-12 20:10:00 -05:00
bors
159080c92e Auto merge of #135994 - 1c3t3a:rename-unsafe-ptr, r=oli-obk
Rename rustc_middle::Ty::is_unsafe_ptr to is_raw_ptr

The wording unsafe pointer is less common and not mentioned in a lot of places, instead this is usually called a "raw pointer". For the sake of uniformity, we rename this method.
This came up during the review of
https://github.com/rust-lang/rust/pull/134424.

r? `@Noratrieb`
2025-02-12 23:18:14 +00:00
bjorn3
ecad689332 Rustup to rustc 1.86.0-nightly (92bedea1c 2025-02-11) 2025-02-12 16:09:55 +00:00
bjorn3
4836002ed0 Sync from rust 92bedea1c5 2025-02-12 14:48:04 +00:00
Matthias Krüger
603534fbf4 Rollup merge of #136714 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.146

Exposes the error function so we can expose this in the standard library [1].

[1]: https://github.com/rust-lang/compiler-builtins/pull/753
2025-02-10 16:38:26 +01:00
Bastian Kersting
732132f6b1 Extend the renaming to coerce_unsafe_ptr 2025-02-10 13:01:55 +00:00
Jubilee Young
f97679d6ba cg_clif: stop worrying about Conv::PtxKernel 2025-02-09 23:15:14 -08:00
bjorn3
6bd92ef9cb Rustfmt 2025-02-08 22:12:13 +00:00
bjorn3
28a241f7a9 Merge branch 'sync_from_rust' 2025-02-07 21:02:27 +00:00
Trevor Gross
7d73de8557 Update compiler-builtins to 0.1.146
Exposes the error function so we can expose this in the standard
library [1].

[1]: https://github.com/rust-lang/compiler-builtins/pull/753
2025-02-07 20:58:28 +00:00
bjorn3
04e580fcc5 Merge commit '8332329f83' into sync_cg_clif-2025-02-07 2025-02-07 20:58:27 +00:00
bjorn3
8332329f83 Fix rustc test suite 2025-02-07 20:33:50 +00:00
bjorn3
6c4b94bf33 Rustup to rustc 1.86.0-nightly (942db6782 2025-02-06) 2025-02-07 20:01:00 +00:00
bjorn3
8bbe4a022d Sync from rust 942db6782f 2025-02-07 19:32:21 +00:00
bjorn3
46333985ce Remove outdated fixme 2025-02-07 14:14:42 +00:00
bjorn3
c92520a3b5 Workaround bug in the linker-warning test
It incorrectly replaces rustc_codegen_cranelift in paths with rustc. It
also doesn't handle panic=abort correctly.
2025-02-07 14:07:31 +00:00
bjorn3
03764709ca Disable extern_weak test on macOS 2025-02-07 11:34:04 +00:00
bjorn3
b004312ee4 Implement arm64 vaddlvq_u8 and vld1q_u8_x4 vendor intrinsics
This is required for using the bytecount crate on arm64.
2025-02-07 11:01:59 +00:00
bjorn3
ed91b73179 Simplify usage of UnsafeMessage::send 2025-02-06 17:25:59 +00:00
bjorn3
b0b0b25c9c Remove unnecessary abort_if_errors from cg_clif 2025-02-06 17:25:29 +00:00
bjorn3
0ea2ce4f6d Rustup to rustc 1.86.0-nightly (bef3c3b01 2025-02-04) 2025-02-05 11:27:16 +00:00
bjorn3
b226c6e2d6 Sync from rust bef3c3b01f 2025-02-05 11:23:20 +00:00
许杰友 Jieyou Xu (Joe)
a005ccdc4e Rollup merge of #136537 - tgross35:update-builtins, r=tgross35
Update `compiler-builtins` to 0.1.145

This includes https://github.com/rust-lang/compiler-builtins/pull/752 which is required for LLVM 20.
2025-02-05 19:09:37 +08:00
Trevor Gross
f71e666dff Update compiler-builtins to 0.1.145
This includes [1] which is required for LLVM 20.

[1]: https://github.com/rust-lang/compiler-builtins/pull/752
2025-02-04 11:49:01 +00:00
Celina G. Val
3a14dbbd94 Refactor contract builtin macro + error handling
Instead of parsing the different components of a function signature,
eagerly look for either the `where` keyword or the function body.

- Also address feedback to use `From` instead of `TryFrom` in cranelift
  contract and ubcheck codegen.
2025-02-03 13:55:15 -08:00
Felix S. Klock II
fa43703573 Contracts core intrinsics.
These are hooks to:

  1. control whether contract checks are run
  2. allow 3rd party tools to intercept and reintepret the results of running contracts.
2025-02-03 12:53:57 -08:00
Matthias Krüger
84595c2b1e Rollup merge of #136279 - Zalathar:ensure-ok, r=oli-obk
Rename `tcx.ensure()` to `tcx.ensure_ok()`, and improve the associated docs

This is all based on my archaeology for https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.60TyCtxtEnsure.60.

The main renamings are:
- `tcx.ensure()` → `tcx.ensure_ok()`
- `tcx.ensure_with_value()` → `tcx.ensure_done()`
- Query modifier `ensure_forwards_result_if_red` → `return_result_from_ensure_ok`

Hopefully these new names are a better fit for the *actual* function and purpose of these query call modes.
2025-02-02 12:31:55 +01:00
bjorn3
cf5521b5a3 Enable x87 target feature on x86_64 2025-02-01 17:17:37 +00:00
bjorn3
c8f0f36d66 Rustfmt 2025-02-01 16:47:02 +00:00
bjorn3
42271d452c Fix rustc test suite 2025-02-01 16:39:07 +00:00
bjorn3
3228d5ee62 Rustup to rustc 1.86.0-nightly (854f22563 2025-01-31) 2025-02-01 16:02:06 +00:00
bjorn3
77009e9924 Sync from rust 854f22563c 2025-02-01 15:54:08 +00:00
Matthias Krüger
bbb8733515 Rollup merge of #130514 - compiler-errors:unsafe-binders, r=oli-obk
Implement MIR lowering for unsafe binders

This is the final bit of the unsafe binders puzzle. It implements MIR, CTFE, and codegen for unsafe binders, and enforces that (for now) they are `Copy`. Later on, I'll introduce a new trait that relaxes this requirement to being "is `Copy` or `ManuallyDrop<T>`" which more closely models how we treat union fields.

Namely, wrapping unsafe binders is now `Rvalue::WrapUnsafeBinder`, which acts much like an `Rvalue::Aggregate`. Unwrapping unsafe binders are implemented as a MIR projection `ProjectionElem::UnwrapUnsafeBinder`, which acts much like `ProjectionElem::Field`.

Tracking:
- https://github.com/rust-lang/rust/issues/130516
2025-02-01 16:41:03 +01:00
Zalathar
89abc19215 Rename tcx.ensure() to tcx.ensure_ok() 2025-02-01 12:38:54 +11:00
Michael Goulet
6c0f4bbd75 Enforce unsafe binders must be Copy (for now) 2025-01-31 17:40:28 +00:00