mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 15:20:24 +01:00
Instead of walking individual rust files and reading the AST from those, we instead call `RUSTC_BOOTSTRAP=1 cargo rustc --profile=check -- -Zunstable-options --pretty=expanded` and let it create one giant lib.rs which we can parse as a whole. This allows us to parse a post-macro crate, working with structs and functions created inside macros just fine. It does require handling a few things that we didn't previously, most notably Clone via `impl ::core::clone::Clone` blocks instead of just looking for `#![derive(Clone)]`. This ends up resolving a few types slightly differently, resulting in different bindings, but only in ways which don't impact the runtime.
15 lines
304 B
TOML
15 lines
304 B
TOML
[package]
|
|
name = "c-bindings-gen"
|
|
version = "0.0.1"
|
|
authors = ["Matt Corallo"]
|
|
edition = "2018"
|
|
|
|
[dependencies]
|
|
syn = { version = "1", features = ["full", "extra-traits"] }
|
|
proc-macro2 = "1"
|
|
|
|
[profile.release]
|
|
debug = true
|
|
|
|
# We're not in the workspace as we're just a binary code generator:
|
|
[workspace]
|