pull/12487/headaee941559
("rust: recursively pull proc-macro dependencies as well") had to be reverted (ina66cb97e8
) because it broke Mesa cross compilation. This happened because a C shared library was linked with a Rust C-ABI static library, which caused it to inherit the proc macro dependency the Rust static library was linked with. The right way to handle this is for only Rust targets to inherit proc macro dependencies from static libraries they link with. A Rust executable, library, or whatever will need the proc macros its Rust dependencies use, as illustrated in the test case that I've reintroduced here. I've verified that Mesa still cross compiles correctly with this change. The same failure was also identified by the "rust/21 transitive dependencies" test case, but only when cross compiling, so it wasn't caught by CI. Co-authored-by: Xavier Claessens <xavier.claessens@collabora.com>
parent
6e20022295
commit
a05f6a260e
6 changed files with 33 additions and 5 deletions
@ -0,0 +1,8 @@ |
|||||||
|
extern crate proc_macro_examples; |
||||||
|
use proc_macro_examples::make_answer; |
||||||
|
|
||||||
|
make_answer!(); |
||||||
|
|
||||||
|
pub fn func() -> u32 { |
||||||
|
answer() |
||||||
|
} |
@ -0,0 +1 @@ |
|||||||
|
pm_in_subdir = rust.proc_macro('proc_macro_examples3', '../proc.rs') |
@ -0,0 +1,7 @@ |
|||||||
|
extern crate staticlib; |
||||||
|
use staticlib::func; |
||||||
|
|
||||||
|
|
||||||
|
fn main() { |
||||||
|
assert_eq!(42, func()); |
||||||
|
} |
Loading…
Reference in new issue