-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
Description
To support code-gen from build.rs, we should fully support all elements of include!(concat!(env!("OUT_DIR"), "/bindings.rs")) incantation.
This needs a few moving parts to be in place:
- we should extract the
OUT_DIRfrom cargo. It looks like this info might be missing fromcargo metadataat present, but we can always start with heuristic, while working on proper solution upstream in parallel - we need to support
env!macro. To do this, we need to add anenv: FxHashMap<String, String>to theCrateGraph, similarly to how we addedcfgrecently. When expandingenv!, we should look in the map first, and fall back to realstd::env::varafter that. include!andconcat!seem to use "eager expansion" of some sorts. We need to figure what this means, how it is implemented in rustc, and add it to rust-analyzer. Might be tricky.- handling the actual
include!shouldn't be hard: we only need to plug the included file into the raw_items machinery. Work to supportinclude!("some-path.rs")can be done in parallel to other bullet points here
Timmmm, szbergeron, Masterchef365, noxabellus, Kobzol and 8 more