Skip to content

treat no_mangle_generic_items as hard error instead of lint warning - #154585

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
HerrCai0907:fix/no_mangle_generic_items
Aug 6, 2026
Merged

treat no_mangle_generic_items as hard error instead of lint warning#154585
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
HerrCai0907:fix/no_mangle_generic_items

Conversation

@HerrCai0907

@HerrCai0907 HerrCai0907 commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Reference PR:

View all comments

In rust-lang/miri#4929 (comment), rustc should reject the no_mangled generic function.
This PR treat is as a hard error

@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. labels Mar 30, 2026
@rustbot

This comment was marked as outdated.

@HerrCai0907

Copy link
Copy Markdown
Contributor Author

r? @oli-obk

@rustbot rustbot assigned oli-obk and unassigned fmease Mar 30, 2026
@rustbot

rustbot commented Mar 30, 2026

Copy link
Copy Markdown
Collaborator

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

@fmease fmease added the needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. label Mar 30, 2026
@oli-obk

oli-obk commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

Please make it a hard error and not a lint at all if crater doesn't show any significant regressions.

For crater purposes this works.

@rust-bors

This comment was marked as off-topic.

@rust-bors rust-bors Bot 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 Mar 30, 2026
@oli-obk

This comment was marked as off-topic.

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Mar 30, 2026
@oli-obk

oli-obk commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Mar 30, 2026
set no_mangle_generic_items deny by default
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: ac4c361 (ac4c3613be2acd5395b65d85e5657b81e3c982f0, parent: 4cf5f9580233c36f6bc8db76e282ba8a1c1ea491)

@oli-obk

oli-obk commented Mar 30, 2026

Copy link
Copy Markdown
Contributor

@craterbot check

@craterbot

Copy link
Copy Markdown
Collaborator

👌 Experiment pr-154585 created and queued.
🤖 Automatically detected try build ac4c361
🔍 You can check out the queue and this experiment's details.

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot craterbot added S-waiting-on-crater Status: Waiting on a crater run to be completed. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Mar 30, 2026
@craterbot

Copy link
Copy Markdown
Collaborator

🚧 Experiment pr-154585 is now running

ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@craterbot

Copy link
Copy Markdown
Collaborator

🎉 Experiment pr-154585 is completed!
📊 5 regressed and 2 fixed (871888 total)
📊 5110 spurious results on the retry-regressed-list.txt, consider a retry1 if this is a significant amount.
📰 Open the summary report.

⚠️ If you notice any spurious failure please add them to the denylist!
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

Footnotes

  1. re-run the experiment with crates=https://crater-reports.s3.amazonaws.com/pr-154585/retry-regressed-list.txt

@craterbot craterbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-crater Status: Waiting on a crater run to be completed. labels Apr 6, 2026
@RalfJung RalfJung added S-waiting-on-reference Status: PR has a reference opened and is waiting for it to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 29, 2026
ehuss added a commit to ehuss/reference that referenced this pull request Jul 29, 2026
@traviscross traviscross added has-reference-pr This language change has an approved Reference PR. and removed needs-reference-pr This language change needs an approved Reference PR to proceed. S-waiting-on-reference Status: PR has a reference opened and is waiting for it to complete. labels Aug 5, 2026
@traviscross

Copy link
Copy Markdown
Contributor

@bors r=oli-obk

@rust-bors

rust-bors Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit ff04387 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Aug 5, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 5, 2026
…items, r=oli-obk

treat no_mangle_generic_items as hard error instead of lint warning

In rust-lang/miri#4929 (comment), rustc should reject the no_mangled generic function.
This PR treat is as a hard error
rust-bors Bot pushed a commit that referenced this pull request Aug 5, 2026
…uwer

Rollup of 25 pull requests

Successful merges:

 - #154585 (treat no_mangle_generic_items as hard error instead of lint warning)
 - #158147 (std: fix stack buffer overflow in Windows junction_point)
 - #160130 (Select cache values to verify by key fingerprint, not value fingerprint)
 - #160343 (Rename `OutlivesPredicate` to `OutlivesClause`)
 - #160360 (Remove rustc_middle dependency on rustc_hir_pretty)
 - #160387 (rustc_codegen_ssa: Correctly apply the static `--jobs-backend` limit to backend parallelism)
 - #160422 (move mir-opt miri tests to CI logic)
 - #160444 (Avoid resolving path keywords outside `TypeNS`)
 - #160510 (Resolver: (un)tracked borrows for `CmRefCell` made safe my unsafe speculative flag)
 - #155424 ([blocked] Link to proposed LLM policy in CONTRIBUTING and pull request template)
 - #158726 (std: move futex implementations into sys::sync::futex)
 - #158762 (Emit thumb code on VEX V5)
 - #159225 (Split IncrCompSession out of Session)
 - #159820 (Make the `rustc_unsafe_specialization_marker` attribute actually `unsafe`)
 - #160198 (Rework `smallest_range_containing` to handle duplicates)
 - #160362 (Split `SpannedTypeVisitor` into its own crate, `rustc_ty_walk`)
 - #160390 (autodiff: Handle slice-tailed DSTs in type trees)
 - #160420 (Suggest `cast_signed()` for overflowing signed integer literals)
 - #160516 (Add regression test for HRTB projection in closure)
 - #160520 (Add some tests for specialization)
 - #160522 (fix(bootstrap): Normalize the names of proc macro dependency crates)
 - #160523 (Add regression test for opaque type)
 - #160531 (docs: fix typo in AllowExprMetavar comment)
 - #160538 (Update expect messages in tcp.rs doc examples to follow the style guide)
 - #160548 (bootstrap: Register `coverage-map` and `coverage-run` aliases via a separate step)
@JonathanBrouwer

Copy link
Copy Markdown
Contributor

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #160557 (comment)

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Aug 5, 2026
@rust-bors

rust-bors Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

View changes since this unapproval

@RalfJung
RalfJung force-pushed the fix/no_mangle_generic_items branch from ff04387 to 814f124 Compare August 5, 2026 11:39
@rustbot

rustbot commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@RalfJung
RalfJung force-pushed the fix/no_mangle_generic_items branch from 814f124 to 9c37be3 Compare August 5, 2026 11:45
// CHECK: ret

#[unsafe(naked)]
#[no_mangle]

@RalfJung RalfJung Aug 5, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@folkertdev @Amanieu I had to remove the no_mangle here as that does not work any more on generic functions. That means the CHECK-LABEL also does not work any more. I can make it work by hard-coding a bit of the mangling but that may be a bad idea? Any suggestions for what to do with this test?

View changes since the review

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need the name mangling to make it match in the right place, right?

It's probably fine this way. Maybe there is some combination of CHECK-LABEL and CHECK-SAME that works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah the code we are patching looks like this

           40: module asm ".balign 4" 
           41: module asm ".globl _RINvCs3Y2WkPYsbfo_8generics16generic_functionxEB2_" 
           42: module asm ".type _RINvCs3Y2WkPYsbfo_8generics16generic_functionxEB2_, @function" 
           43: module asm "_RINvCs3Y2WkPYsbfo_8generics16generic_functionxEB2_:" 
           44: module asm "call _RNvXCs3Y2WkPYsbfo_8genericsxNtB2_6Invert6invert" 
           45: module asm "ret" 
           46: module asm ".Lfunc_end__RINvCs3Y2WkPYsbfo_8generics16generic_functionxEB2_:" 
           47: module asm ".size _RINvCs3Y2WkPYsbfo_8generics16generic_functionxEB2_, . - _RINvCs3Y2WkPYsbfo_8generics16generic_functionxEB2_" 

@RalfJung

RalfJung commented Aug 5, 2026

Copy link
Copy Markdown
Member

@bors r=oli-obk

@rust-bors

rust-bors Bot commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9c37be3 has been approved by oli-obk

It is now in the queue for this repository.

@rust-bors rust-bors Bot 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 5, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 5, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #159014 ([rustdoc] Do not take `doc(cfg())` into account when filtering doctests)
 - #159029 (rustc_llvm: Emit module summaries when using -Clto=fat)
 - #160574 (Update rustc-perf submodule)
 - #154585 (treat no_mangle_generic_items as hard error instead of lint warning)
 - #159473 (Fix, simplify, and document doc meta finalize mode)
 - #157489 (Add CoerceShared field-wise reborrow WF checks)
 - #160532 (Add Enzyme bugfix to support rust+llvm23)
 - #160545 (Reorder the methods in `#[rustc_must_implement_one_of]`)
 - #160558 (Revert "codegen_ssa: no dbginfo for scalable vec local w/ `-O0`")
 - #160566 (Re-enable bool indexing assembly test for LLVM 23)
 - #160569 (Remove `OnDuplicate::Custom`)
 - #160576 ([rustdoc] Create output file after we checked that the standalone markdown file is valid)
@rust-bors
rust-bors Bot merged commit 872bc2c into rust-lang:main Aug 6, 2026
13 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. has-reference-pr This language change has an approved Reference PR. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-lang Relevant to the language team to-announce Announce this issue on triage meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.