-
Notifications
You must be signed in to change notification settings - Fork 13k
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
base: master
Are you sure you want to change the base?
Conversation
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 (
|
The Miri subtree was changed cc @rust-lang/miri Some changes occurred to the platform-builtins intrinsics. Make sure the cc @antoyo, @GuillaumeGomez, @bjorn3, @calebzulawski, @programmerjake Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter 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 |
Thanks for the PR!
However this definitely does not "fix" that issue, it's just next step. Also, have you coordinated with @BLANKatGITHUB who is assigned to that issue?
|
@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. |
Also please pick a proper PR title that summarizes the changes.
|
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! |
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 | ||
There was a problem hiding this comment.
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)
This comment has been minimized.
This comment has been minimized.
src/tools/rust-analyzer/crates/hir-ty/src/consteval/tests/intrinsics.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
This comment has been minimized.
This comment has been minimized.
You can locally test this with |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Ah! Amazing, thanks! Appreciate you guiding me through it with such patience :) |
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. |
@RalfJung This looks good to merge. Could you kindly review it? |
The change looks good, thanks! Please squash the history into a single commit to get rid of the back-and-forth. |
@rustbot author |
…acy extern "rust-intrinsic" blocks
ecb99f9
to
c79fc90
Compare
@rustbot ready |
@bors r+ rollup |
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! |
…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.
…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.
…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
Part of #132735: Replace
extern "rust-intrinsic"
with#[rustc_intrinsic]
macroextern "rust-intrinsic"
to use the#[rustc_intrinsic]
macro..md
files and test files to avoid unnecessary changes.