Skip to content
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

Unsafe extern blocks #124482

Merged
merged 12 commits into from
Jun 6, 2024
Merged

Unsafe extern blocks #124482

merged 12 commits into from
Jun 6, 2024

Conversation

spastorino
Copy link
Member

@spastorino spastorino commented Apr 28, 2024

This implements RFC 3484.

Tracking issue #123743 and RFC rust-lang/rfcs#3484

This is better reviewed commit by commit.

@rustbot
Copy link
Collaborator

rustbot commented Apr 28, 2024

r? @cjgillot

rustbot has assigned @cjgillot.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot
Copy link
Collaborator

rustbot commented Apr 28, 2024

⚠️ Warning ⚠️

  • These commits modify submodules.

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Apr 28, 2024
@rust-log-analyzer

This comment has been minimized.

@spastorino
Copy link
Member Author

⚠️ Warning ⚠️

* These commits modify **submodules**.

Ohh I forgot to mention this. I'd need to land some PRs, at least to stdarch so it doesn't warn for the usages of extern blocks without unsafe.
I was planning to do ![allow(unknown_lints)] + #![allow(missing_unsafe_on_extern)], so this doesn't warn in new versions and doesn't error in old versions for the usage of missing_unsafe_on_extern which is unknown.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Copy link
Contributor

@traviscross traviscross left a comment

Choose a reason for hiding this comment

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

Looks right to me.

@traviscross
Copy link
Contributor

Tested cargo fix on a side project, unsure if we are testing somehow in the compiler the machine-applicable information we return in errors?. Maybe making the compiler output json and checking that the machine-applicable fixes are there?. Or do we do that in cargo?.

Have a look at the run-rustfix header command.

See for example this test.

@spastorino
Copy link
Member Author

Tested cargo fix on a side project, unsure if we are testing somehow in the compiler the machine-applicable information we return in errors?. Maybe making the compiler output json and checking that the machine-applicable fixes are there?. Or do we do that in cargo?.

Have a look at the run-rustfix header command.

See for example this test.

Added this too!.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 5, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Jun 5, 2024

📌 Commit 525828d has been approved by oli-obk

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 Jun 5, 2024
@spastorino
Copy link
Member Author

@bors rollup=never

@bors
Copy link
Contributor

bors commented Jun 6, 2024

⌛ Testing commit 525828d with merge 2d28b63...

@bors
Copy link
Contributor

bors commented Jun 6, 2024

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 2d28b63 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 6, 2024
@bors bors merged commit 2d28b63 into rust-lang:master Jun 6, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone Jun 6, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2d28b63): comparison URL.

Overall result: ❌ regressions - ACTION NEEDED

Next Steps: If you can justify the regressions found in this perf run, please indicate this with @rustbot label: +perf-regression-triaged along with sufficient written justification. If you cannot justify the regressions please open an issue or create a new PR that fixes the regressions, add a comment linking to the newly created issue or PR, and then add the perf-regression-triaged label to this PR.

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.3% [0.2%, 0.4%] 32
Regressions ❌
(secondary)
0.2% [0.2%, 0.3%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.3% [0.2%, 0.4%] 32

Max RSS (memory usage)

Results (primary 0.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.3% [4.3%, 4.3%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [-2.9%, 4.3%] 2

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 672.766s -> 672.761s (-0.00%)
Artifact size: 319.44 MiB -> 319.40 MiB (-0.01%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 6, 2024
@Kobzol
Copy link
Contributor

Kobzol commented Jun 11, 2024

This adds a new feature, so a small regression is probably to be expected. Marking as triaged.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 11, 2024
@oli-obk oli-obk deleted the unsafe-extern-blocks branch June 11, 2024 07:09
@spastorino
Copy link
Member Author

spastorino commented Jun 11, 2024

This adds a new feature, so a small regression is probably to be expected. Marking as triaged.

@rustbot label: +perf-regression-triaged

👍, anyway there's a pre-existing issue in the way we use ItemKind and convert to ForeignItemKind for the sake of code reuse that this PR made slightly worser and may cause such small perf regression. I have this in my todo list to address.
Basically due to these conversions, we have data in ItemKind that we shouldn't.

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 13, 2024
…li-obk

Unsafe extern blocks

This implements RFC 3484.

Tracking issue rust-lang#123743 and RFC rust-lang/rfcs#3484

This is better reviewed commit by commit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. 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. T-lang Relevant to the language team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet