Skip to content

Subtree sync for rustc_codegen_cranelift #137078

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
Feb 16, 2025

Conversation

bjorn3
Copy link
Member

@bjorn3 bjorn3 commented Feb 15, 2025

This fixes a miscompilation (rust-lang/rustc_codegen_cranelift#1560)

r? @ghost

@rustbot label +A-codegen +A-cranelift +T-compiler

bjorn3 and others added 25 commits February 7, 2025 20:58
Exposes the error function so we can expose this in the standard
library [1].

[1]: rust-lang/compiler-builtins#753
Update `compiler-builtins` to 0.1.146

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

[1]: rust-lang/compiler-builtins#753
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
rust-lang#134424.

r? `@Noratrieb`
…he-arcradeongeforce, r=bjorn3

compiler: internally merge `PtxKernel` into `GpuKernel`

r? ``@bjorn3`` for review
Rollup of 12 pull requests

Successful merges:

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

r? `@ghost`
`@rustbot` modify labels: rollup
…NoDrop, 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`.

https://github.com/rust-lang/rust/blob/942db6782f4a28c55b0b75b38fd4394d0483390f/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`.
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.
GHA is going to remove support for ubuntu-20.04 in a couple of months
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. has-merge-commits PR has merge commits, merge with caution. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 15, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 15, 2025

There are merge commits (commits with multiple parents) in your changes. We have a no merge policy so these commits will need to be removed for this pull request to be merged.

You can start a rebase with the following commands:

$ # rebase
$ git pull --rebase https://github.com/rust-lang/rust.git master
$ git push --force-with-lease

The following commits are merge commits:

@rustbot rustbot added A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend labels Feb 15, 2025
@bjorn3
Copy link
Member Author

bjorn3 commented Feb 15, 2025

@bors r+ p=1 subtree sync

@bors
Copy link
Collaborator

bors commented Feb 15, 2025

📌 Commit 7a6206e has been approved by bjorn3

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 15, 2025
@ehuss ehuss mentioned this pull request Feb 15, 2025
@bors
Copy link
Collaborator

bors commented Feb 16, 2025

⌛ Testing commit 7a6206e with merge c3fe9e7...

@bors
Copy link
Collaborator

bors commented Feb 16, 2025

☀️ Test successful - checks-actions
Approved by: bjorn3
Pushing c3fe9e7 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Feb 16, 2025
@bors bors merged commit c3fe9e7 into rust-lang:master Feb 16, 2025
7 checks passed
@rustbot rustbot added this to the 1.87.0 milestone Feb 16, 2025
@bjorn3 bjorn3 deleted the sync_cg_clif-2025-02-15 branch February 16, 2025 08:58
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c3fe9e7): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (primary 2.8%, secondary 5.4%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.8% [2.2%, 3.9%] 4
Regressions ❌
(secondary)
6.2% [3.3%, 9.2%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.6%] 1
All ❌✅ (primary) 2.8% [2.2%, 3.9%] 4

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 789.592s -> 790.836s (0.16%)
Artifact size: 350.02 MiB -> 350.03 MiB (0.00%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-codegen Area: Code generation A-cranelift Things relevant to the [future] cranelift backend has-merge-commits PR has merge commits, merge with caution. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.