Implement asm! interpolate#156719
Conversation
| mir::ConstValue::Slice { alloc_id, meta } => { | ||
| (alloc_id, alloc_range(Size::ZERO, Size::from_bytes(meta))) | ||
| } |
There was a problem hiding this comment.
I was unable to actually trigger this.
If this really can't happen we should remove it.
| let Ok(interpret::Scalar::Ptr(ptr, _)) = ptr else { | ||
| span_bug!( | ||
| sp, | ||
| "expected Ptr in ScalarPair for promoted asm interpolate, but got {ptr:#?}", | ||
| ) | ||
| }; | ||
| let Ok(interpret::Scalar::Int(size)) = size else { | ||
| span_bug!( | ||
| sp, | ||
| "expected Int in ScalarPair for promoted asm interpolate, but got {size:#?}", | ||
| ) | ||
| }; |
There was a problem hiding this comment.
I'm not sure if this is overkill. Happy to just unwrap() + unreachable!() if it actually makes sense. I assume at least the interpret::Scalar variant could be behind an unreachable!() because we check the initial abi::Scalar above.
|
This PR changes rustc_public cc @oli-obk, @celinval, @ouz-a, @makai410 The GCC codegen subtree was changed The parser was modified, potentially altering the grammar of (stable) Rust cc @fmease The Clippy subtree was changed cc @rust-lang/clippy This PR changes MIR cc @oli-obk, @RalfJung, @JakobDegen, @vakaras The Cranelift subtree was changed cc @bjorn3 |
| /// Target features on arm. | ||
| (unstable, arm_target_feature, "1.27.0", Some(150246)), | ||
| /// Enables experimental inline assembly support for the `interpolate` operator. | ||
| (unstable, asm_interpolate, "CURRENT_RUSTC_VERSION", None), |
There was a problem hiding this comment.
Just leaving this here so we don't forget replacing the tracking issue with the actual one when we are ready.
This adds a new operator to inline ASM:
interpolate, which allows you to pass const strings verbatim into the assembly.As this would be a new language feature, it will require going through an RFC or similar.
Resolves #132083.
r? @Amanieu.