Skip to content

Broken link on https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html #1507

Closed
@ChayimFriedman2

Description

@ChayimFriedman2
Contributor

https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html#inputs-and-outputs

This will write the value 5 into the u64 variable x. You can see that the string literal we use to specify instructions is actually a template string. It is governed by the same rules as Rust [format strings][format-syntax]. The arguments that are inserted into the template however look a bit different than you may be familiar with. First we need to specify if the variable is an input or an output of the inline assembly. In this case it is an output. We declared this by writing out. We also need to specify in what kind of register the assembly expects the variable. In this case we put it in an arbitrary general purpose register by specifying reg. The compiler will choose an appropriate register to insert into the template and will read the variable from there after the inline assembly finishes executing.

The text in bold was meant to be a link but is broken. I don't know what should be the link target.

CC @Amanieu (you wrote this in ebbc1ab).

Activity

Amanieu

Amanieu commented on Feb 23, 2022

@Amanieu
Member
added a commit that references this issue on Feb 23, 2022
5a6d2e3
added a commit that references this issue on Feb 23, 2022
363621f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @Amanieu@ChayimFriedman2

      Issue actions

        Broken link on https://doc.rust-lang.org/nightly/rust-by-example/unsafe/asm.html · Issue #1507 · rust-lang/rust-by-example