Skip to content

How much should rustc understand the template string? #6

Open
@fintelia

Description

@fintelia

There are a range of options here, some of which have already been ruled out based on feasibility / functionality. Some of these might be possible to add after a MVP, but it is worth considering whether doing so would be a breaking change or if small actions now could ensure they aren't:

  1. No understanding, not even of escape characters + register replacements
  2. Register replacements + escape characters, but no concern of whether replacements are reasonable. {} is allowed inside quoted strings and will directly concatenate register names with adjacent characters.
  3. Commented regions are stripped out, but no other semantic understanding of asm.
  4. A "C-like" preprocessor is run over the code
  5. Rustc and/or clippy do some tokenization to sanity check the string. Only issues that would definitely result in an assembler error are reported.
  6. Deprecated syntax and/or blacklisted assembler directives trigger warnings/errors
  7. Only whitelisted syntax/directives, but no code transformation or semantic understanding of what the asm code or assembler directives actually do.
  8. Simple "psuedo assembler directives" which act as aliases for more complicated ones, use Rust formatted octal literals rather than C-formatted ones, etc.
  9. More substantial syntax level transformations on the format string, without understanding individual instructions
  10. Assembly instructions for each architecture are validated against a whitelist, maybe also validating operands
  11. Inline asm as syntax: the template string is really a DSL compiled by rustc directly to llvm IR / machine code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions