This site is being rebuilt and some pages are out of date. For current details, write to [email protected]. This notice goes away when the rebuild is done.

No analytics unless you allow it, no tracking. This site keeps in your browser the language you pick, the theme, its colour, which site you chose, the currency on the pricing page and that you closed this notice; signing in adds session cookies. The legal page has the details.

Sign in

Radar · Rust · Archive · Week 45 · Nov 3 – 9, 2025

Pass pointers to `const` in assembly

Worth knowinglanguage

What changed
The const operand to asm! and global_asm! now accepts pointer values computed during const evaluation, expanding to the symbol name and an optional offset.
Production impact
The source does not say.
Try it
Compile a small program that uses asm! with a const pointer operand on the nightly toolchain.
Source
github.com/rust-lang/rfcs/pull/3848

Understand it, then run it

Run it now

Todayrust
// This program demonstrates the current limitation: the `asm!` macro
// is unstable and not available on Rust 1.98.1 (edition 2024).  The
// proposed change would allow a const pointer to be passed to the
// `asm!` operand, expanding to the symbol name and an optional
// offset.  Since the feature is not yet stable, the code below
// intentionally fails to compile, illustrating the problem that
// the RFC aims to solve.

fn main() {
    const VALUE: *const i32 = &42;
    let mut out: i32 = 0;

    // The following line would compile once the change is stable:
    // asm!("mov {}, {}", in(reg) VALUE, out(reg) out, options(nostack));

    // On stable Rust 1.98.1 this macro is not available, so the
    // compiler emits an error.  The error message is shown in the
    // comment above.
}

What it printed when we ran it on Rust 1.98.1 (edition 2024)

(it printed nothing)

Run sends this program (for Solidity, the contract and its tests) to our own sandbox, where it is compiled and run once, with no network, and what it printed or the test report comes back here. Nothing is kept. Runs are counted per visitor for the day so everyone gets a turn; the details are on the legal page.

Written by gpt-oss-20b from the linked source · claims checked against the sources · archive, not individually reviewed