Skip to content

Unsafe extern blocks#124482

Merged
bors merged 12 commits intorust-lang:masterfrom
spastorino:unsafe-extern-blocks
Jun 6, 2024
Merged

Unsafe extern blocks#124482
bors merged 12 commits intorust-lang:masterfrom
spastorino:unsafe-extern-blocks

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.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from eff0aa5 to 4db4aac Compare April 29, 2024 19:10
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from 4db4aac to 109be86 Compare April 29, 2024 19:50
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from 109be86 to 429a626 Compare April 29, 2024 21:14
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from 429a626 to b4828d8 Compare April 29, 2024 21:23
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from b4828d8 to e7d5d4e Compare April 29, 2024 21:55
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from e7d5d4e to cc91d7f Compare April 29, 2024 22:32
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from cc91d7f to 542a307 Compare April 29, 2024 22:58
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from 542a307 to 7b82197 Compare April 30, 2024 01:39
@rust-log-analyzer

This comment has been minimized.

@spastorino spastorino force-pushed the unsafe-extern-blocks branch from 7b82197 to 8f0c075 Compare April 30, 2024 02:06
@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
Collaborator

bors commented Jun 5, 2024

📌 Commit 525828d has been approved by oli-obk

It is now in the queue for this repository.

@spastorino
Copy link
Member Author

@bors rollup=never

@bors
Copy link
Collaborator

bors commented Jun 6, 2024

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

@bors
Copy link
Collaborator

bors commented Jun 6, 2024

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

@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%)

@Kobzol
Copy link
Member

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

@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.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.