swift-testing icon indicating copy to clipboard operation
swift-testing copied to clipboard

swift-testing build fails to load TestingMacros on Windows

Open compnerd opened this issue 9 months ago • 2 comments

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

compnerd avatar Jun 04 '25 23:06 compnerd

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.

grynspan avatar Jun 04 '25 23:06 grynspan

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.

stmontgomery avatar Jun 05 '25 00:06 stmontgomery