Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
Cargo.toml
LICENSE
README.md
azure-pipelines.yml

README.md

rust-proc-macro-expander

Build Status Build Status

This utility is capable of calling compiled Rust custom derive dynamic libraries on arbitrary code.

IMPORTANT: compiler API, used in this utility, is not in stable rustc build. Use nightly rustc version to build it.

Usage

IMPORTANT: should be built with RUSTFLAGS='--cfg procmacro2_semver_exempt' as stated here.

Expander launches as CLI tool and accepts json array of expansion tasks from stdin.

Assuming you have expansion_task.json in current directory, and compiled procedural macro id_macro somewhere:

[
  {
    "macro_body": "struct S {}", 
    "macro_name": "id_macro",
    "libs": [ "path/to/libid_macro.so" ]
  }
]

you can launch proc_macro_expander like this:

> cat expansion_task.json | ./proc_macro_expander

[ {"type": "success", "expansion": "struct S { }"} ]

Testing

You can launch tests with this command:

> RUSTFLAGS='--cfg procmacro2_semver_exempt' cargo +nightly-2019-04-01 test

Current stable and nighly builds are having incompatible ABIs due to this PR. That is why nightly-2019-04-01 is used. As soon as changes from this PR make it into the stable branch, tests should be able to run on current nightly.

You can’t perform that action at this time.