Skip to content

Port #[link] to the new attribute parsing infrastructure #143193

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

JonathanBrouwer
Copy link
Contributor

Ports link to the new attribute parsing infrastructure for #131229 (comment)

This rework is not yet finished, it is blocked on the cfg attribute being finished, since link takes a cfg attribute as argument

@rustbot blocked

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Jun 29, 2025
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Jun 30, 2025

☔ The latest upstream changes (presumably #143233) made this pull request unmergeable. Please resolve the merge conflicts.

@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Jul 15, 2025
@rust-log-analyzer

This comment has been minimized.

@JonathanBrouwer JonathanBrouwer force-pushed the link_rework branch 5 times, most recently from 147aeec to 29b3648 Compare July 15, 2025 22:30
PrintAttribute
)]
#[derive(HashStable_Generic)]
pub enum NativeLibKind {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This type was moved here because it is needed for the link attribute and the original location caused a dependency cycle


#[link(name = "bar", import_name_type = "decorated", kind = "raw-dylib")]
#[link(name = "bar", kind = "raw-dylib")]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is not testing for the invalid attribute, but instead for the link attribute on an extern type. Because attributes are parsed earlier and this attribute was invalid the error blocked the crash from happening. This is true for quite a few other of the test changes as well

@@ -81,8 +81,7 @@
#[export_stable = 1]
//~^ ERROR malformed
#[link]
//~^ ERROR attribute must be of the form
//~| WARN this was previously accepted by the compiler
//~^ ERROR malformed
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BREAKING CHANGE 1: A #[link] attribute which is not a list #[link(...)] used to be a warning future error, is now an error. This needs a crater run.

@@ -61,7 +61,7 @@
#![doc = "2400"]
#![cold] //~ WARN attribute should be applied to a function
//~^ WARN this was previously accepted
#![link()] //~ WARN attribute should be applied to an `extern` block
#![link(name = "x")] //~ WARN attribute should be applied to an `extern` block
Copy link
Contributor Author

Choose a reason for hiding this comment

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

BREAKING CHANGE 2: A link attribute applied to an invalid target was not checked for syntactic correctness, it now is. The invalid target remains a warning, but the syntactic corectness is now checked

@JonathanBrouwer
Copy link
Contributor Author

@rustbot ready
r? @jdonszelmann

Needs a crater run

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Jul 16, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 16, 2025

jdonszelmann is currently at their maximum review capacity.
They may take a while to respond.

@JonathanBrouwer JonathanBrouwer marked this pull request as ready for review July 16, 2025 12:25
@rustbot
Copy link
Collaborator

rustbot commented Jul 16, 2025

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in compiler/rustc_attr_data_structures

cc @jdonszelmann

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

@jdonszelmann
Copy link
Contributor

@bors try @craterbot queue

bors added a commit that referenced this pull request Jul 16, 2025
Port `#[link]` to the new attribute parsing infrastructure

Ports `link` to the new attribute parsing infrastructure for #131229 (comment)

This rework is not yet finished, it is blocked on the `cfg` attribute being finished, since `link` takes a `cfg` attribute as argument

`@rustbot` blocked
@bors
Copy link
Collaborator

bors commented Jul 16, 2025

⌛ Trying commit 6b10a20 with merge 4797991...

@bors
Copy link
Collaborator

bors commented Jul 16, 2025

☀️ Try build successful - checks-actions
Build commit: 4797991 (4797991aa2efb6d658150f10425b3f3b5d10eceb)

@jdonszelmann
Copy link
Contributor

@craterbot queue

@craterbot
Copy link
Collaborator

🚨 Error: failed to parse the command

🆘 If you have any trouble with Crater please ask in t-infra on Zulip
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@jdonszelmann
Copy link
Contributor

@craterbot check oops

@craterbot
Copy link
Collaborator

🚨 Error: failed to parse the command

🆘 If you have any trouble with Crater please ask in t-infra on Zulip
ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more

@jdonszelmann
Copy link
Contributor

@craterbot check

@craterbot
Copy link
Collaborator

👌 Experiment pr-143193 created and queued.
🤖 Automatically detected try build 4797991
🔍 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-review Status: Awaiting review from the assignee but also interested parties. labels Jul 16, 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-run-make Area: port run-make Makefiles to rmake.rs S-waiting-on-crater Status: Waiting on a crater run to be completed. 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.

6 participants