Partially support building and locating wasm proc-macros - #160981
Conversation
|
Some changes occurred in src/tools/compiletest cc @jieyouxu |
|
These changes are based on my wasip1 PR and I have rebased that PR on top of this. It should work just fine for wasip2 too though. |
| // In this case, the only path we can pass | ||
| // with '--extern-meta' is the '.rlib' file | ||
| AuxType::Lib => Some(format!("lib{name}.rlib")), | ||
| // FIXME maybe use `rustc --print file-names` instead? |
There was a problem hiding this comment.
This probably applies to the full match/function, not just this line, right?
There was a problem hiding this comment.
Yeah, although for rlibs using the hard coded lib{name}.rlib would be fine on all targets,
| &self, | ||
| crate_rejections: &mut CrateRejections, | ||
| ) -> Result<Option<Library>, CrateError> { | ||
| debug!("find_commandline_library {}", self.crate_name); |
There was a problem hiding this comment.
Don't we need support here for finding .wasm?
There was a problem hiding this comment.
This function is indirectly called by CStore::load_proc_macro. This function first tries to load for the host by calling locator.for_proc_macro() before calling CStore::load on it, and then for the wasm target by calling locator.for_wasm_proc_macro() before CStore::load. For the second call, the for_wasm_proc_macro causes the locator to attempt to load a crate for wasm32-wasip2. This in turn causes the locator to use the .wasm suffix for dylibs as indicated in the target spec.
b97e027 to
63c5ce6
Compare
|
I've added |
This comment has been minimized.
This comment has been minimized.
fc1faeb to
a63ba48
Compare
This comment has been minimized.
This comment has been minimized.
a63ba48 to
00a1d38
Compare
For building this currently only removes the crate type check and doesn't implement crate metadata support for wasip2 or the proc-macro ABI. And for locating wasip2 needs support for loading crate metadata. Crate metadata building and loading should work for wasip1.
This can be used by cargo to determine the target for which wasm proc-macros should be compiled.
00a1d38 to
f2abd0e
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
For building this currently only removes the crate type check and doesn't implement crate metadata support for wasip2 or the proc-macro ABI. And for locating wasip2 needs support for loading crate metadata. Crate metadata building and loading should work for wasip1.
Part of #160389
r? @Mark-Simulacrum