Skip to content

Allow macro calls in arguments #86

Closed as not planned
Closed as not planned
@jjant

Description

I want to write a crate that interally uses include_dir, something like this:

// some_crate
macro_rules! include_assets {
  ($path: tt) => {{
    static DIR: Dir = include_dir!(concat!(env!("CARGO_MANIFEST_DIR"), "/", $path));
    ...
  }}
}

// use site
fn main() {
  let assets = some_crate::include_assets!("assets");
}

But that currently fails because include_dir only allows literal strings as arguments.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions