Skip to content

Failure to compile unit tests for procedural macros on stable-x86_64-pc-windows-gnu #128944

@quixoticaxis

Description

@quixoticaxis

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 found

error: 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 (0514789 2024-07-21)
binary: rustc
commit-hash: 0514789
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 (ca5d25e 2024-08-09)
binary: rustc
commit-hash: ca5d25e
commit-date: 2024-08-09
host: x86_64-pc-windows-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-windows-gnuToolchain: GNU, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions