Skip to content

swift-testing build fails to load TestingMacros on Windows #1137

@compnerd

Description

@compnerd
Member

Description

When building swift-testing, we fail to load the TestingMacros.dll

S:\SourceCache\swift-project\swift-testing\Sources\Testing\Expectations\Expectation+Macro.swift:239:40: warning: external macro implementation type 'TestingMacros.RequireThrowsMacro' could not be found for macro 'require(throws:_:sourceLocation:performing:)'; failed to load library plugin 'S:\b\x86_64-unknown-windows-msvc\TestingMacros\TestingMacros.dll' in plugin server 'S:\b\5\bin\SwiftInProcPluginServer.dll'; loader error: 127
237 | /// this macro. The test will then fail if an error is thrown.
238 | @discardableResult
239 | @freestanding(expression) public macro require<E, R>(
    |                                        `- warning: external macro implementation type 'TestingMacros.RequireThrowsMacro' could not be found for macro 'require(throws:_:sourceLocation:performing:)'; failed to load library plugin 'S:\b\x86_64-unknown-windows-msvc\TestingMacros\TestingMacros.dll' in plugin server 'S:\b\5\bin\SwiftInProcPluginServer.dll'; loader error: 127
240 |   throws errorType: E.Type,
241 |   _ comment: @autoclosure () -> Comment? = nil,

Reproduction

Build swift-testing as part of the toolchain build

Expected behavior

For the macros to be loaded

Environment

Swift version 6.2-dev (LLVM 78f6e5fce7642cb, Swift 270ffa6855ecd96)
Target: x86_64-unknown-windows-msvc

Additional information

No response

Activity

added
bug🪲 Something isn't working
windows🪟 Windows support
build🧱 Affects the project's build configuration or process
on Jun 4, 2025
grynspan

grynspan commented on Jun 4, 2025

@grynspan
Contributor

This is, as we understand it, expected (and also not specific to Windows.) Nothing in the toolchain needs access to our macros while the toolchain is building.

stmontgomery

stmontgomery commented on Jun 5, 2025

@stmontgomery
Contributor

It's true the macro plugin is not needed at this point during the toolchain build, but it does help if it is present because then, the module which declares the macros which the plugin implements (in our case, the Testing module) can validate that the macro implementation types it expects and references in each macro decl are in fact present in the plugin. That's what those warnings are about, it would like to attempt to perform that validation but can't. I agree this would be a useful thing to fix, even though it's not "needed", strictly speaking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🪲 Something isn't workingbuild🧱 Affects the project's build configuration or processwindows🪟 Windows support

    Type

    No type

    Projects

    Status

    TODO

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @stmontgomery@compnerd@grynspan

        Issue actions

          swift-testing build fails to load TestingMacros on Windows · Issue #1137 · swiftlang/swift-testing