-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
rustc: Add #[rustc_args_required_const]
#48018
Conversation
r? @pnkfelix (rust_highfive has picked a reviewer for you, use r? to override) |
r? @eddyb |
@@ -73,7 +73,7 @@ pub enum Candidate { | |||
|
|||
/// Array of indices found in the third argument of | |||
/// a call to one of the simd_shuffleN intrinsics. |
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.
Should also update the comment.
let terminator = mir[bb].terminator(); | ||
let ty = match terminator.kind { | ||
TerminatorKind::Call { ref args, .. } => { | ||
args[2].ty(mir, tcx) | ||
args[index].ty(mir, tcx) | ||
} | ||
_ => { | ||
span_bug!(terminator.source_info.span, |
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.
Also the ICE message here.
This commit adds a new unstable attribute to the compiler which requires that arguments to a function are always provided as constants. The primary use case for this is SIMD intrinsics where arguments are defined by vendors to be constant and in LLVM they indeed must be constant as well. For now this is mostly just a semantic guarantee in rustc that an argument is a constant when invoked, phases like trans don't actually take advantage of it yet. This means that we'll be able to use this in stdsimd but we won't be able to remove the `constify_*` macros just yet. Hopefully soon though!
dfca1b7
to
27a4e73
Compare
@bors: r=eddyb |
📌 Commit 27a4e73 has been approved by |
Out of curiosity, is there a reason you decided to use argument indices rather than names, which would appear to me to be more readable and harder to get wrong? |
@varkor Names come from pattern-matching bindings, arguments don't (necessarily) have them. |
…ddyb rustc: Add `#[rustc_args_required_const]` This commit adds a new unstable attribute to the compiler which requires that arguments to a function are always provided as constants. The primary use case for this is SIMD intrinsics where arguments are defined by vendors to be constant and in LLVM they indeed must be constant as well. For now this is mostly just a semantic guarantee in rustc that an argument is a constant when invoked, phases like trans don't actually take advantage of it yet. This means that we'll be able to use this in stdsimd but we won't be able to remove the `constify_*` macros just yet. Hopefully soon though!
This commit adds a new unstable attribute to the compiler which requires that
arguments to a function are always provided as constants. The primary use case
for this is SIMD intrinsics where arguments are defined by vendors to be
constant and in LLVM they indeed must be constant as well.
For now this is mostly just a semantic guarantee in rustc that an argument is a
constant when invoked, phases like trans don't actually take advantage of it
yet. This means that we'll be able to use this in stdsimd but we won't be able
to remove the
constify_*
macros just yet. Hopefully soon though!