Forbid the use of #[target_feature] on main by LeSeulArtichaut · Pull Request #108651 · rust-lang/rust (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation31 Commits3 Checks0 Files changed

Conversation

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

[ Show hidden characters]({{ revealButtonHref }})

LeSeulArtichaut

@rustbot

r? @jackh726

(rustbot has picked a reviewer for you, use r? to override)

@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 2, 2023

Noratrieb

Choose a reason for hiding this comment

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

r? Nilstrieb
@bors delegate
r=me when CI is green

@Noratrieb

Uh, I don't think target_feature should be an only_local attribute.... that's unsound, isn't it? When it always pretends it isn't there across crates? Sounds like we need to encode it in the metadata (which is as simple as removing the @only_local: true)

@WaffleLapkin

@WaffleLapkin

Hm, target_feature was made local_only in #98450 as an optimization...

Ig it is fine, actually? Maybe? If the codegen only happens inside the crate, then target_feature being local is totally fine. At least we don't have any tests that tried to access target_feature in non-local crate...

@Noratrieb

This isn't unsound, the safeaty check probably goes through target feature queries instead of the attr.
So I guess you should try figuring out how that works and whether you can use the same way - although encoding target_feature is also a possible solution.

@LeSeulArtichaut

the safeaty check probably goes through target feature queries instead of the attr

Yes, see

let callee_features = &self.tcx.codegen_fn_attrs(func_did).target_features;
// The body might be a constant, so it doesn't have codegen attributes.
let self_features = &self.tcx.body_codegen_attrs(self.body_did.to_def_id()).target_features;

@LeSeulArtichaut

Also we need to forbid #[target_feature] on start, no?

@Noratrieb

Now it looks good and green 😊
@bors r+

@bors

📌 Commit dc6e0d9 has been approved by Nilstrieb

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

Mar 2, 2023

compiler-errors added a commit to compiler-errors/rust that referenced this pull request

Mar 2, 2023

@compiler-errors

…ure-on-main, r=Nilstrieb

Forbid the use of #[target_feature] on main

Fixes rust-lang#108645.

@Noratrieb

@bors r- this will fail after the revert, needs to add the unstable feature to the test

@bors bors 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 2, 2023

@LeSeulArtichaut

(I'll need to add the feature gates back if #108654 lands first)

@matthiaskrgr

@compiler-errors

@bors r-

Fair chance this will land after #108654, so this needs blessing and fixing.

@LeSeulArtichaut

Noratrieb

@rustbot

Some changes occurred in src/tools/cargo

cc @ehuss

@LeSeulArtichaut

(Committed a submodule change by accident, sorry for the noise)

@Noratrieb

@bors

📌 Commit 28dca77acf1d7280b51372abf3dd50c14616b628 has been approved by Nilstrieb

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-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Mar 11, 2023

@bors

@bors bors 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 12, 2023

@Noratrieb

@bors

📌 Commit 29b1789 has been approved by Nilstrieb

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-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Mar 12, 2023

bors added a commit to rust-lang-ci/rust that referenced this pull request

Mar 12, 2023

@bors

…iaskrgr

Rollup of 8 pull requests

Successful merges:

Failed merges:

r? @ghost @rustbot modify labels: rollup

@ehuss ehuss mentioned this pull request

Mar 14, 2023

@est31 est31 mentioned this pull request

Mar 20, 2023

Labels

S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.