-
Notifications
You must be signed in to change notification settings - Fork 247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support proc-macros #192
Comments
I'm going to look into this! |
I traced the issue down to some weird behavior in rustc. The gist of the issue is that when building with the spir-v backend we configure the compiler to generate rust-gpu/crates/rustc_codegen_spirv/src/lib.rs Lines 163 to 166 in afe3e1f
However, for some reason, rustc uses the same postfix and suffix (
I'm not acquainted enough with the rustc codebase to diagnose the error any further on my own. Hopefully someone else will be able to pick this up :) |
The code is at https://github.com/rust-lang/rust/blob/ffe52882ed79be67344dd6085559e308241e7f60/compiler/rustc_metadata/src/locator.rs It seems that rustc does some pre-filtering to check if the filename makes any sense. There doesn't seem to be a special case for proc-macros to use the host prefix/suffix. I think it is luck that Windows -> Linux cross-compilation works when using proc-macros. (Or does it?) |
There is a special case here: https://github.com/rust-lang/rust/blob/ae6aa22cf26fede2177abe4ff974030058885b7a/compiler/rustc_metadata/src/creader.rs#L419-L430 // Load the proc macro crate for the host
locator.reset();
locator.is_proc_macro = Some(true);
locator.target = &self.sess.host;
locator.triple = TargetTriple::from_triple(config::host_triple());
locator.filesearch = self.sess.host_filesearch(path_kind);
let host_result = match self.load(locator)? {
Some(host_result) => host_result,
None => return Ok(None),
}; So all of the But loading a proc macro crate is attempted only if loading failed as a target crate: https://github.com/rust-lang/rust/blob/ae6aa22cf26fede2177abe4ff974030058885b7a/compiler/rustc_metadata/src/creader.rs#L496-L502 match self.load(&mut locator)? {
Some(res) => (res, None),
None => {
dep_kind = CrateDepKind::MacrosOnly;
match self.load_proc_macro(&mut locator, path_kind)? {
Some(res) => res,
None => return Err(locator.into_error()), AFAICT, that I'll see what I can get by debugging the relevant part of EDIT: silent loading failure cause found, see #268. |
The text was updated successfully, but these errors were encountered: