Skip to content

Move packages.rs to OUT_DIR #1186

@philpax

Description

@philpax

As part of #1171, the guest package projection codegen was moved to a build script that generates src/packages.rs. This was previously implemented in the proc macro, but this led to editor responsiveness issues and the projection frequently being out of date.

However, the build script adds a file to src instead of OUT_DIR, which is the convention for generated files in Rust. This is because, during testing, rust-analyzer often failed to autocomplete items that were defined in OUT_DIR/packages.rs, especially after the creation of a new package.

I was unable to reproduce that issue in a fresh Rust project with a mock build script that did something similar in a similar setup (wasm32-wasi, multiple binaries), making it difficult to narrow down the cause of the issue.

When we have some free time, we should figure out if we can get this working to avoid cluttering users' src directories. (That being said, there's the counter-argument that seeing the projection in filesystem makes it clearer to see what's happening. Could go either way.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesttopic:apiAPI functionality, including both host and guest

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions