Skip to content

Update no_mangle to use the attribute template - #1904

Open
ehuss wants to merge 10 commits into
rust-lang:masterfrom
ehuss:no_mangle
Open

Update no_mangle to use the attribute template#1904
ehuss wants to merge 10 commits into
rust-lang:masterfrom
ehuss:no_mangle

Conversation

@ehuss

@ehuss ehuss commented Jun 30, 2025

Copy link
Copy Markdown
Contributor

New rules:

  • abi.no_mangle.syntax
  • abi.no_mangle.allowed-positions
  • abi.no_mangle.duplicates
  • abi.no_mangle.export_name
  • abi.no_mangle.ascii-only
  • abi.no_mangle.generic

@rustbot rustbot added the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Jun 30, 2025
@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

@oli-obk

oli-obk commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Can we land this? it's blocking rust-lang/rust#154585

Comment thread src/abi.md Outdated
`no_mangle` may only be used on items with a name that only contains ASCII characters.

r[abi.no_mangle.generic]
`no_mangle` has no effect on generic items.

@RalfJung RalfJung Jul 29, 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.

With rust-lang/rust#154585, no_mangle is forbidden on generic items.

View changes since the review

ehuss added 9 commits July 29, 2026 06:48
This moves it below to match the template of having behavioral rules
after the syntax.
This is to match the template order.
It doesn't really work with any item, it is functions and statics.
This specifies the conflict between no_mangle and export_name.
This is a restriction that wasn't previously documented.
@rustbot

rustbot commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different master 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.

@traviscross traviscross removed the S-waiting-on-review Status: The marked PR is awaiting review from a maintainer label Aug 5, 2026
@traviscross
traviscross added this pull request to the merge queue Aug 5, 2026
@traviscross
traviscross removed this pull request from the merge queue due to a manual request Aug 5, 2026
Let's revise this section editorially.
@traviscross
traviscross enabled auto-merge August 5, 2026 11:30
@traviscross
traviscross disabled auto-merge August 5, 2026 11:31
@traviscross traviscross added the S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository 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

Reference PR:

- rust-lang/reference#1904

In rust-lang/miri#4929 (comment), rustc should reject the no_mangled generic function.
This PR treat is as a hard error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-stabilization Waiting for a stabilization PR to be merged in the main Rust repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants