Failure to compile unit tests for procedural macros on stable-x86_64-pc-windows-gnu
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 119k
- Forks
- 16.1k
- PR merge metrics
- PR metrics pending
Description
I tried the following code.
In the proc-macro nested crate macros-derive:
use proc_macro::TokenStream;
#[proc_macro_derive(NoDerive)] // does nothing
pub fn derive_print_type(_input: proc_macro::TokenStream) -> proc_macro::TokenStream {
TokenStream::new()
}
#[cfg(test)]
mod tests {
#[test]
fn test() {}
}
In the main crate:
use macros_derive::NoDerive;
fn main() {
_ = S;
}
#[derive(NoDerive)]
struct S;
I expected to see this happen: cargo test runs to completion.
Instead, compilation of the test target fails:
Compiling macros v0.1.0 (…\proc-macro failure\macros)
Compiling macros-derive v0.1.0 (…\proc-macro failure\macros\derive)
error: Error calling dlltool 'dlltool.exe': program not founderror: could not compile
macros-derive(lib test) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
If I add dlltool from self-contained folder (from inside the toolchain folder) to PATH, the compilation fails with:
error: Dlltool could not create import library
Stable version:
rustc 1.80.0 (051478957 2024-07-21)
binary: rustc
commit-hash: 051478957371ee0084a7c0913941d2a8c4757bb9
commit-date: 2024-07-21
host: x86_64-pc-windows-gnu
release: 1.80.0
LLVM version: 18.1.7
Nightly version (same result):
rustc 1.82.0-nightly (ca5d25e2c 2024-08-09)
binary: rustc
commit-hash: ca5d25e2c41f5a6b4ce65c681bf2f94c7ead1f14
commit-date: 2024-08-09
host: x86_64-pc-windows-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the reported proc-macro nested crate macros-derive and cargo test on stable x86_64-pc-windows-gnu. Start by tracing the test-target compilation path that invokes dlltool.exe, including the reported import-library creation failure. Done means the supplied unit test compiles and cargo test completes without requiring an external dlltool workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100