Skip to content

Syntax extension to load an entire file into [u8] at compile-time #1654

Description

@brson

For testing purposes I've frequently wanted to do something like:

// Run my test on some external data
let source = str::from_bytes(#readfile("test.rs"));
...

It would read a file relative to the directory of the current source file (not sure what it would do when building stdin - probably relative to cwd).

I think nmatsakis mentioned that D can do something like this. Let's copy it.

Activity

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

    A-frontendArea: Compiler frontend (errors, parsing and HIR)A-syntaxextArea: Syntax extensionsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions