-
Notifications
You must be signed in to change notification settings - Fork 11
Description
cargo.toml:
[package]
name = "foo"
version = "0.1.0"
edition = "2024"
[dependencies]
syn = { version = "2.0", features = ["full"] }
[dev-dependencies]
macrotest = "1.2.0"
lib.rs:
#[cfg(test)]
mod tests {
#[test]
fn testa() {
macrotest::expand("tests/expand/a.rs");
}
#[test]
fn testb() {
macrotest::expand("tests/expand/b.rs");
}
}
tests/expand/a.rs && tests/expand/b.rs:
fn main() {
let pkg_name = env!("CARGO_PKG_NAME");
}
cargo clean && cargo test --tests
Removed 408 files, 199.2MiB total
Compiling serde_core v1.0.228
Compiling proc-macro2 v1.0.103
Compiling unicode-ident v1.0.22
Compiling quote v1.0.42
Compiling serde v1.0.228
Compiling prettyplease v0.2.37
Compiling winnow v0.7.13
Compiling serde_json v1.0.145
Compiling ryu v1.0.20
Compiling toml_writer v1.0.4
Compiling memchr v2.7.6
Compiling itoa v1.0.15
Compiling glob v0.3.3
Compiling fastrand v2.3.0
Compiling diff v0.1.13
Compiling syn v2.0.111
Compiling toml_parser v1.0.4
Compiling toml_datetime v0.7.3
Compiling serde_spanned v1.0.3
Compiling toml v0.9.8
Compiling serde_derive v1.0.228
Compiling macrotest v1.2.0
Compiling foo v0.1.0 (D:\git-repos\github\minimal-repros)
Finished `test` profile [unoptimized + debuginfo] target(s) in 9.82s
Running unittests src\lib.rs (target\debug\deps\foo-00342c1b7485fa5a.exe)
running 2 tests
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Compiling proc-macro2 v1.0.103
Compiling quote v1.0.42
Checking unicode-ident v1.0.22
Compiling proc-macro2 v1.0.103
Checking unicode-ident v1.0.22
Compiling quote v1.0.42
error: linking with `link.exe` failed: exit code: 1104
error: linking with `link.exe` failed: exit code: 1104
|
|
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\MELVIN~1\\AppData\\Local\\Temp\\rustcvUWeh2\\symbols.o" "<2 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:D:\\git-repos\\github\\minimal-repros\\target\\tests\\macrotest\\debug\\build\\quote-4e19cce3fccb8eb3\\build_script_build-4e19cce3fccb8eb3.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\MELVIN~1\\AppData\\Local\\Temp\\rustcPDbNlR\\symbols.o" "<3 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:D:\\git-repos\\github\\minimal-repros\\target\\tests\\macrotest\\debug\\build\\proc-macro2-5a2977cd70030fd1\\build_script_build-5a2977cd70030fd1.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: LINK : fatal error LNK1104: cannot open file 'D:\git-repos\github\minimal-repros\target\tests\macrotest\debug\build\quote-4e19cce3fccb8eb3\build_script_build-4e19cce3fccb8eb3.exe'
= note: LINK : fatal error LNK1104: cannot open file 'D:\git-repos\github\minimal-repros\target\tests\macrotest\debug\build\proc-macro2-5a2977cd70030fd1\build_script_build-5a2977cd70030fd1.exe'
error: could not compile `quote` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `proc-macro2` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
test tests::testb ... FAILED
test tests::testa ... FAILED
failures:
---- tests::testb stdout ----
Running 1 macro expansion tests
Expansion error:
Compiling proc-macro2 v1.0.103
Compiling quote v1.0.42
error: linking with `link.exe` failed: exit code: 1104
|
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\MELVIN~1\\AppData\\Local\\Temp\\rustcis8G7l\\symbols.o" "<2 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:D:\\git-repos\\github\\minimal-repros\\target\\tests\\macrotest\\debug\\build\\quote-4e19cce3fccb8eb3\\build_script_build-4e19cce3fccb8eb3.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: LINK : fatal error LNK1104: cannot open file 'D:\git-repos\github\minimal-repros\target\tests\macrotest\debug\build\quote-4e19cce3fccb8eb3\build_script_build-4e19cce3fccb8eb3.build_script_build.8dc8c2b6f552a2ee-cgu.0.rcgu.o'
error: could not compile `quote` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
thread 'tests::testb' (57072) panicked at D:\.tools\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\macrotest-1.2.0\src\expand.rs:174:9:
1 of 1 tests failed
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- tests::testa stdout ----
Running 1 macro expansion tests
Expansion error:
Compiling proc-macro2 v1.0.103
Compiling quote v1.0.42
error: linking with `link.exe` failed: exit code: 1104
|
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\MELVIN~1\\AppData\\Local\\Temp\\rustcsWMIw6\\symbols.o" "<3 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:D:\\git-repos\\github\\minimal-repros\\target\\tests\\macrotest\\debug\\build\\proc-macro2-5a2977cd70030fd1\\build_script_build-5a2977cd70030fd1.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: LINK : fatal error LNK1104: cannot open file 'D:\git-repos\github\minimal-repros\target\tests\macrotest\debug\build\proc-macro2-5a2977cd70030fd1\build_script_build-5a2977cd70030fd1.exe'
error: could not compile `proc-macro2` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
thread 'tests::testa' (34364) panicked at D:\.tools\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\macrotest-1.2.0\src\expand.rs:174:9:
1 of 1 tests failed
failures:
tests::testa
tests::testb
test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.86s
error: test failed, to rerun pass `--lib`
set your default toolchain:
rustup default set nightly-2025-11-21
This seems to have started happening starting at nightly-2025-11-21. nightly-2025-11-20 works, but everything after it doesn't. I also tried with today's nightly (nightly-2025-11-25) and still have the same behavior.
The above minimum reproducible example is available here: https://github.com/wmmc88/minimal-repros/tree/macrotest-nightly-failure
This minimal example almost always fails with 2 failed tests, but sometimes it fails with only 1 and sometimes it actually passes. I'm not sure what changed in recently nightlies to trigger this, but it looks like macrotest's internal synchronization mechanism for running multiple tests in different threads is broken by this change in nightly
The ocassional weird case where there are hard build errors but macrotest still passes:
cargo clean && cargo test --tests
Removed 0 files
Compiling serde_core v1.0.228
Compiling proc-macro2 v1.0.103
Compiling unicode-ident v1.0.22
Compiling quote v1.0.42
Compiling serde v1.0.228
Compiling winnow v0.7.13
Compiling serde_json v1.0.145
Compiling prettyplease v0.2.37
Compiling itoa v1.0.15
Compiling memchr v2.7.6
Compiling ryu v1.0.20
Compiling toml_writer v1.0.4
Compiling diff v0.1.13
Compiling glob v0.3.3
Compiling fastrand v2.3.0
Compiling syn v2.0.111
Compiling toml_parser v1.0.4
Compiling serde_spanned v1.0.3
Compiling toml_datetime v0.7.3
Compiling serde_derive v1.0.228
Compiling toml v0.9.8
Compiling macrotest v1.2.0
Compiling foo v0.1.0 (D:\git-repos\github\minimal-repros)
Finished `test` profile [unoptimized + debuginfo] target(s) in 10.56s
Running unittests src\lib.rs (target\debug\deps\foo-00342c1b7485fa5a.exe)
running 2 tests
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Blocking waiting for file lock on package cache
Compiling proc-macro2 v1.0.103
Compiling quote v1.0.42
Checking unicode-ident v1.0.22
Compiling proc-macro2 v1.0.103
Checking unicode-ident v1.0.22
Compiling quote v1.0.42
error: linking with `link.exe` failed: exit code: 1104
|
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\MELVIN~1\\AppData\\Local\\Temp\\rustcPmrKDn\\symbols.o" "<2 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:D:\\git-repos\\github\\minimal-repros\\target\\tests\\macrotest\\debug\\build\\quote-4e19cce3fccb8eb3\\build_script_build-4e19cce3fccb8eb3.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: LINK : fatal error LNK1104: cannot open file 'D:\git-repos\github\minimal-repros\target\tests\macrotest\debug\build\quote-4e19cce3fccb8eb3\build_script_build-4e19cce3fccb8eb3.exe'
error: could not compile `quote` (build script) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: linking with `link.exe` failed: exit code: 1104
|
= note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Tools\\MSVC\\14.44.35207\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\MELVIN~1\\AppData\\Local\\Temp\\rustcQP0GEJ\\symbols.o" "<3 object files omitted>" "<sysroot>\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib/{libstd-*,libpanic_unwind-*,libcfg_if-*,libwindows_targets-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libunwind-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "kernel32.lib" "kernel32.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "dbghelp.lib" "/defaultlib:msvcrt" "/NXCOMPAT" "/OUT:D:\\git-repos\\github\\minimal-repros\\target\\tests\\macrotest\\debug\\build\\proc-macro2-5a2977cd70030fd1\\build_script_build-5a2977cd70030fd1.exe" "/OPT:REF,NOICF" "/DEBUG" "/PDBALTPATH:%_PDB%" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\intrinsic.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\liballoc.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libcore.natvis" "/NATVIS:<sysroot>\\lib\\rustlib\\etc\\libstd.natvis"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
= note: LINK : fatal error LNK1104: cannot open file 'D:\git-repos\github\minimal-repros\target\tests\macrotest\debug\build\proc-macro2-5a2977cd70030fd1\build_script_build-5a2977cd70030fd1.exe'
error: could not compile `proc-macro2` (build script) due to 1 previous error
Checking syn v2.0.111
Checking foo v0.1.0 (D:\git-repos\github\minimal-repros)
warning: error finalizing incremental compilation session directory `\\?\D:\git-repos\github\minimal-repros\target\tests\macrotest\debug\incremental\foo-1lz2ylynhvb8h\s-hdarx8e893-0447ll8-working`: Access is denied. (os error 5)
Checking foo-tests v0.0.0 (D:\git-repos\github\minimal-repros\target\tests\foo\Gupr4a6wiUOZGhxz0mb00BT7CFI8fNt8fCSLdttjiS)
Finished `dev` profile [unoptimized + debuginfo] target(s) in 3.52s
tests/expand/b.rs - ok
test tests::testb ... ok
tests/expand/a.rs - ok
test tests::testa ... ok
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.81s