error: linking with `cc` failed: exit status: 1
= note: "cc" "-m64" "/tmp/rustcflOThX/symbols.o" "<257 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "/home/user/.cargo/target/debug/deps/libdevela-c196ee63d71a35ed.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libtest-*,libgetopts-*,libunicode_width-*,librustc_std_workspace_std-*,libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,libcfg_if-*,liblibc-*,librustc_std_workspace_core-*}.rlib" "/home/user/.cargo/target/debug/deps/libdevela_base-2f30b157371083c5.rlib" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/rustcflOThX/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/user/.cargo/target/debug/deps/devela-ed63e5346b66e85e" "-Wl,--gc-sections" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: some arguments are omitted. use `--verbose` to show all linker arguments
rust-lld: error: duplicate symbol: test_no_mangle
>>> defined at lib.rs:238 (src/lib.rs:238)
>>> /home/user/.cargo/target/debug/deps/devela-5c2b9106189a1e66.5rjh5wt2c596w464wpw7eaq0k.1nc9mqr.rcgu.o:(test_no_mangle)
>>> defined at lib.rs:238 (src/lib.rs:238)
>>> devela-fb6a4d7e6cf82649.59cfjdnj2r4set7kaot6bkd9v.1npt1ar.rcgu.o:(.text.test_no_mangle+0x0) in archive /home/user/.cargo/target/debug/deps/libdevela-fb6a4d7e6cf82649.rlib
rust-lld: error: duplicate symbol: wasm_callback
>>> defined at web_api.rs:152 (src/lang/ffi/js/web/web_api.rs:152)
>>> /home/user/.cargo/target/debug/deps/devela-5c2b9106189a1e66.6khk1lajtpiy3q4448ifwrbe2.0n5b0qy.rcgu.o:(wasm_callback)
>>> defined at web_api.rs:152 (src/lang/ffi/js/web/web_api.rs:152)
>>> devela-fb6a4d7e6cf82649.1u0u674ci58js15eh7fqpgz9u.02kvoz4.rcgu.o:(.text.wasm_callback+0x0) in archive /home/user/.cargo/target/debug/deps/libdevela-fb6a4d7e6cf82649.rlib
collect2: error: ld returned 1 exit status
Code
I tried this code (simplified from my library):
I expected to see this happen: Successful compilation during
cargo testInstead, this happened: Linker errors with duplicate symbols for
#[no_mangle]functionsVersion it worked on
It most recently worked on: nightly-2025-08-14
Version with regression
rustc +nightly -vV:Backtrace
Backtrace
Additional Information
cargo testin debug mode,cargo builddoesn't fail.alloc/stdenabled.#[cfg(not(test))]to#[no_mangle]functions