Skip to content

Conversation

@JonathanBrouwer
Copy link
Contributor

@JonathanBrouwer JonathanBrouwer commented Dec 26, 2025

Successful merges:

r? @ghost
@rustbot modify labels: rollup

Create a similar rollup

bjorn3 and others added 15 commits November 26, 2025 19:34
Intrinsics only need a fraction of the functionality offered by
BuilderMethods::call and in particular don't need the FnAbi to be
computed other than (currently) as step towards computing the function
value type.
This moves all LLVM intrinsic handling out of the regular call path for
cg_gcc and makes it easier to hook into this code for future cg_llvm
changes.
As this is the only unwinding intrinsic we use and
codegen_llvm_intrinsic_call currently doesn't handle unwinding
intrinsics, this uses the conventional call path for llvm.wasm.throw.
…henkov

compiler/middle/lint: Suggest `#[expect(dead_code)]` instead of `#[allow(dead_code)]`

Until now the compiler suggested

> help: to override `-W unused` add `#[allow(dead_code)]`

when encountering e.g. an unused function in the codebase.

This PR changes the suggestion to `#[expect(dead_code)]`, which will warn again once the code is being used somewhere. This is helpful because it lets the developer know that the attribute can now be removed again. Without this the codebase will eventually be littered with stray `#[allow(dead_code)]` attributes that are no longer serving any purpose.

This was suggested in https://bsky.app/profile/steveklabnik.com/post/3m2uh7pf6e225 and I agreed strongly enough to take a look and implement it 😆
…ndling, r=WaffleLapkin

Split LLVM intrinsic abi handling from the rest of the abi handling

LLVM intrinsics have weird requirements like requiring the fake "unadjusted" abi, not being callable through function pointers and for all codegen backends other than cg_llvm requiring special cases to redirect them to the correct backend specific intrinsic (or directly codegen their implementation inline without any intrinsic call). By splitting the LLVM intrinsic handling it becomes easier for backends to special case them and should in the future allow getting rid of the abi calculation for `extern "unadjusted"` in favor of computing the correct abi directly in the backend without depending on the exact way cg_ssa lowers types.
…onathanBrouwer

Port `#[rustc_must_implement_one_of]` to attribute parser

Stumbled upon a weird (bug ?) behaviour while making this PR

it seems like it is possible to reach `check_attr.rs` checks without the attribute allowed target checks having already been finished, I added a comment about how to reproduce this in `check_attr.rs`

otherwise good to note is that a bunch of code was moved from `compiler/rustc_hir_analysis/src/collect.rs` to `check_attr.rs`

r? `@JonathanBrouwer`
@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. 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. rollup A PR which is a rollup labels Dec 26, 2025
@JonathanBrouwer
Copy link
Contributor Author

@bors r+ rollup=never p=5

@bors
Copy link
Collaborator

bors commented Dec 26, 2025

📌 Commit 5ec8d23 has been approved by JonathanBrouwer

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. labels Dec 26, 2025
@bors
Copy link
Collaborator

bors commented Dec 26, 2025

⌛ Testing commit 5ec8d23 with merge ec5fc88...

bors added a commit that referenced this pull request Dec 26, 2025
…uwer

Rollup of 3 pull requests

Successful merges:

 - #147717 (compiler/middle/lint: Suggest `#[expect(dead_code)]` instead of `#[allow(dead_code)]`)
 - #148533 (Split LLVM intrinsic abi handling from the rest of the abi handling)
 - #150236 (Port `#[rustc_must_implement_one_of]` to attribute parser)

r? `@ghost`
`@rustbot` modify labels: rollup
@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    |
    = help: items from traits can only be used if the trait is in scope
help: one of the expressions' fields has a method of the same name
    |
627 |                 let fn_abi = self.cx.tcx.fn_abi_of_instance(instance, ty::List::empty());
    |                                   +++++++
help: one of the expressions' fields has a method of the same name
    |
627 |                 let fn_abi = self.tcx.fn_abi_of_instance(instance, ty::List::empty());
    |                                   ++++
help: trait `FnAbiOf` which provides `fn_abi_of_instance` is implemented but not in scope; perhaps you want to import it
    |
  1 + use crate::rustc_middle::ty::layout::FnAbiOf;
    |
help: there is a method `fn_abi_of_fn_ptr` with a similar name
    |

@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    |
    = help: items from traits can only be used if the trait is in scope
help: one of the expressions' fields has a method of the same name
    |
627 |                 let fn_abi = self.cx.tcx.fn_abi_of_instance(instance, ty::List::empty());
    |                                   +++++++
help: one of the expressions' fields has a method of the same name
    |
627 |                 let fn_abi = self.tcx.fn_abi_of_instance(instance, ty::List::empty());
    |                                   ++++
help: trait `FnAbiOf` which provides `fn_abi_of_instance` is implemented but not in scope; perhaps you want to import it
    |
  1 + use crate::rustc_middle::ty::layout::FnAbiOf;
    |
help: there is a method `fn_abi_of_fn_ptr` with a similar name
    |

@bors
Copy link
Collaborator

bors commented Dec 26, 2025

💔 Test failed - checks-actions

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Dec 26, 2025
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 26, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. rollup A PR which is a rollup 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.

7 participants