Repository navigation
Error when #[export_name] is used on invalid targets - #166351
Open
JonathanBrouwer wants to merge 1 commit into
Open
JonathanBrouwer wants to merge 1 commit into
JonathanBrouwer wants to merge 1 commit into
Conversation
Collaborator
|
Some changes occurred in compiler/rustc_attr_parsing |
mejrs
reviewed
Nov 22, 2026
|
|
||
| impl SingleAttributeParser for ExportNameParser { | ||
| const PATH: &[rustc_span::Symbol] = &[sym::export_name]; | ||
| const ON_DUPLICATE: OnDuplicate = OnDuplicate::WarnButFutureError; |
Member
There was a problem hiding this comment.
Can duplicates be an error as well?
Member
Author
There was a problem hiding this comment.
I agree that would be desirable. We need to do a crater run for that tho, so let's remove the lang nomination and do that first
Member
Author
There was a problem hiding this comment.
Actually I'll make this a separate PR
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
rust-bors Bot
pushed a commit
that referenced
this pull request
Nov 22, 2026
Error when `export_name` is applied to wrong targets
export_name is applied to wrong targetsexport_name is used incorrectly
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
JonathanBrouwer
marked this pull request as draft
November 22, 2026 15:09
export_name is used incorrectly#[export_name] is used on invalid targets
JonathanBrouwer
force-pushed
the
export-name-cleanup
branch
from
November 22, 2026 15:11
85d85c4 to
12c1756
Compare
JonathanBrouwer
marked this pull request as ready for review
November 22, 2026 15:15
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently,
#[export_name]has the following behaviour regarding targets it is allowed on:This PR makes the following changes to that:
export_nameon provided trait associated functions has funny behavior #164571In summary, the following 4 examples will produce an error after this PR:
A crater run was performed here: rust-lang/rust#164789 (comment)
This crater run shows no regressions. That is, all 212 regressions were for no_mangle, 0 for export_name.