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

Partial progress on #132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase #135333

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vayunbiyani
Copy link

@vayunbiyani vayunbiyani commented Jan 10, 2025

Part of #132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] macro

  • Updated all instances of extern "rust-intrinsic" to use the #[rustc_intrinsic] macro.
  • Skipped .md files and test files to avoid unnecessary changes.

@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2025

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @compiler-errors (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@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. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jan 10, 2025

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred to the platform-builtins intrinsics. Make sure the
LLVM backend as well as portable-simd gets adapted for the changes.

cc @antoyo, @GuillaumeGomez, @bjorn3, @calebzulawski, @programmerjake

Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter
gets adapted for the changes, if necessary.

cc @rust-lang/miri, @rust-lang/wg-const-eval

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@RalfJung
Copy link
Member

RalfJung commented Jan 10, 2025 via email

@vayunbiyani
Copy link
Author

@RalfJung Thank you for the feedback!

I apologize for the confusion regarding the wording. You're right that this change is only part of the solution and doesn’t fully fix the issue.

I also overlooked that the issue is already assigned to @BLANKatGITHUB — my apologies for that. I’m happy to collaborate with them to move this forward. Given they mentioned being busy with exams, I’d also be happy to take ownership of the issue if that helps reduce their workload.

Please let me know how you'd like me to proceed. I’m keen to contribute further and ensure the issue is fully addressed.

@RalfJung
Copy link
Member

RalfJung commented Jan 10, 2025 via email

@vayunbiyani vayunbiyani changed the title changes in all rs files Partial progress on #132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase Jan 10, 2025
@vayunbiyani
Copy link
Author

Apologies for the initial title — I’m new to contributing to a project as large as Rust. I've updated the title now!

Please let me know if you have any other feedback!

Comment on lines 255 to 263
fn no_missing_unsafe_diagnostic_with_legacy_safe_intrinsic() {
check_diagnostics(
r#"
extern "rust-intrinsic" {
#[rustc_safe_intrinsic]
pub fn bitreverse(x: u32) -> u32; // Safe intrinsic
pub fn floorf32(x: f32) -> f32; // Unsafe intrinsic
}
#[rustc_intrinsic]
#[rustc_safe_intrinsic]
pub fn bitreverse(x: u32) -> u32; // Safe intrinsic
#[rustc_intrinsic]
pub unsafe fn floorf32(x: f32) -> f32; // Unsafe intrinsic
Copy link
Member

@Veykril Veykril Jan 10, 2025

Choose a reason for hiding this comment

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

This test specifically tests the old syntax so it needs to stay as is (we need to keep supporting it for temporary back-compat)

@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@RalfJung RalfJung left a comment

Choose a reason for hiding this comment

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

The miri changes LGTM.

@vayunbiyani vayunbiyani marked this pull request as draft January 10, 2025 14:56
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

}
#[rustc_intrinsic]
#[rustc_nounwind]
pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
Copy link
Member

Choose a reason for hiding this comment

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

It complains that the arguments are unused... that's unfortunate, ideally in an intrinsic without body we'd suppress that warning. Could you file an issue for that?

But for now, just add _ in front of every variable name, that is probably the simplest approach.

Copy link
Author

Choose a reason for hiding this comment

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

Issue here

@@ -16,7 +16,7 @@ use std::simd::prelude::*;

#[rustc_intrinsic]
#[rustc_nounwind]
pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(x: T, y: T) -> U;
pub fn simd_shuffle_generic<T, U, const IDX: &'static [u32]>(_x: T, _y: T) -> U;
Copy link
Member

Choose a reason for hiding this comment

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

This will be needed for all the Miri tests you changed.

@rust-log-analyzer

This comment has been minimized.

@RalfJung
Copy link
Member

You can locally test this with ./x test miri -- intrinsic. That should be better than always waiting for CI. :)

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@vayunbiyani
Copy link
Author

You can locally test this with ./x test miri -- intrinsic. That should be better than always waiting for CI. :)

Ah! Amazing, thanks! Appreciate you guiding me through it with such patience :)

@RalfJung
Copy link
Member

There are still some unresolved comments further up. It may be better, in fact, to just not touch rust-analyzer at all here? They probably want to remove support for this syntax at their own pace.

@vayunbiyani vayunbiyani marked this pull request as ready for review January 18, 2025 13:21
@vayunbiyani
Copy link
Author

@RalfJung This looks good to merge. Could you kindly review it?

@RalfJung
Copy link
Member

The change looks good, thanks! Please squash the history into a single commit to get rid of the back-and-forth.

@RalfJung
Copy link
Member

@rustbot author
Please post @rustbot ready when the PR is ready for the next round of review.

@rustbot rustbot 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-review Status: Awaiting review from the assignee but also interested parties. labels Jan 19, 2025
@vayunbiyani
Copy link
Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 20, 2025
@RalfJung
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 20, 2025

📌 Commit c79fc90 has been approved by RalfJung

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 Jan 20, 2025
@RalfJung
Copy link
Member

You wrote "fix #132735" in the PR description -- that's not accurate; the PR makes progress on the issue but more work remains. "fix" makes github close the issue, so please only use that when the PR really fully resolves an issue.

@vayunbiyani
Copy link
Author

You wrote "fix #132735" in the PR description -- that's not accurate; the PR makes progress on the issue but more work remains. "fix" makes github close the issue, so please only use that when the PR really fully resolves an issue.

Apologies, I'll keep that in mind going forward!

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 20, 2025
…lfJung

Partial progress on rust-lang#132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase

Part of rust-lang#132735: Replace `extern "rust-intrinsic"` with `#[rustc_intrinsic]` macro

- Updated all instances of `extern "rust-intrinsic"` to use the `#[rustc_intrinsic]` macro.
- Skipped `.md` files and test files to avoid unnecessary changes.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 20, 2025
…lfJung

Partial progress on rust-lang#132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase

Part of rust-lang#132735: Replace `extern "rust-intrinsic"` with `#[rustc_intrinsic]` macro

- Updated all instances of `extern "rust-intrinsic"` to use the `#[rustc_intrinsic]` macro.
- Skipped `.md` files and test files to avoid unnecessary changes.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2025
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#133695 (Reexport likely/unlikely in std::hint)
 - rust-lang#135330 (Respect --sysroot for rustc -vV and -Cpasses=list)
 - rust-lang#135333 (Partial progress on rust-lang#132735: Replace extern "rust-intrinsic" with #[rustc_intrinsic] across the codebase)
 - rust-lang#135741 (Recognise new IPv6 documentation range from IETF RFC 9637)
 - rust-lang#135770 (Update contributing docs for submodule/subtree changes)
 - rust-lang#135775 (Subtree update of `rust-analyzer`)
 - rust-lang#135776 (Subtree sync for rustc_codegen_cranelift)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants