cbindgen icon indicating copy to clipboard operation
cbindgen copied to clipboard

Error: `expand-default-features` test (among others) fail on stable toolchain

Open luketpeterson opened this issue 1 year ago • 3 comments

Pulled current cbindgen master (although the problem can be reproduced quite a ways back) Ran: cargo run -- --config ./tests/rust/expand_default_features/cbindgen.toml ./tests/rust/expand_default_features

Output:

   Compiling cbindgen v0.25.0 (/Users/admin/rustProjects/cbindgen_debug/cbindgen)
    Finished dev [unoptimized + debuginfo] target(s) in 4.42s
     Running `target/debug/cbindgen --config ./tests/rust/expand_default_features/cbindgen.toml ./tests/rust/expand_default_features`
ERROR: Parsing crate `expand-default-features`: couldn't run `cargo rustc -Zunpretty=expanded`: Compile("    Checking expand-default-features v0.1.0 (/Users/admin/rustProjects/cbindgen_debug/cbindgen/tests/rust/expand_default_features)\n     Running `rustc --crate-name expand src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --crate-type dylib --emit=dep-info,metadata -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -Zunpretty=expanded --cfg 'feature=\"default\"' --cfg 'feature=\"extra_headers\"' -C metadata=f3d0676702499c9a -C extra-filename=-f3d0676702499c9a --out-dir /Users/admin/rustProjects/cbindgen_debug/cbindgen/target/debug/build/cbindgen-ebaa33047086c38a/out/expanded/debug/deps -C incremental=/Users/admin/rustProjects/cbindgen_debug/cbindgen/target/debug/build/cbindgen-ebaa33047086c38a/out/expanded/debug/incremental -L dependency=/Users/admin/rustProjects/cbindgen_debug/cbindgen/target/debug/build/cbindgen-ebaa33047086c38a/out/expanded/debug/deps`\nerror: the option `Z` is only accepted on the nightly compiler\n\nerror: could not compile `expand-default-features` (lib)\n\nCaused by:\n  process didn't exit successfully: `rustc --crate-name expand src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --crate-type dylib --emit=dep-info,metadata -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -Zunpretty=expanded --cfg 'feature=\"default\"' --cfg 'feature=\"extra_headers\"' -C metadata=f3d0676702499c9a -C extra-filename=-f3d0676702499c9a --out-dir /Users/admin/rustProjects/cbindgen_debug/cbindgen/target/debug/build/cbindgen-ebaa33047086c38a/out/expanded/debug/deps -C incremental=/Users/admin/rustProjects/cbindgen_debug/cbindgen/target/debug/build/cbindgen-ebaa33047086c38a/out/expanded/debug/incremental -L dependency=/Users/admin/rustProjects/cbindgen_debug/cbindgen/target/debug/build/cbindgen-ebaa33047086c38a/out/expanded/debug/deps` (exit status: 1)\n")
ERROR: Couldn't generate bindings for ./tests/rust/expand_default_features.

Configuration: Current cbindgen master (commit 0b43f0bc6ce8aad77a5d1417657daddd32905853) Rust toolchain: stable-x86_64-apple-darwin unchanged - rustc 1.70.0 (90c541806 2023-05-31) cargo-expand version: cargo-expand-expand 1.0.59 + prettyplease 0.2.10

luketpeterson avatar Jul 11 '23 18:07 luketpeterson

hello, I'm confused. Has this issue been solved already? I can't use expand macro in stable channel still.

Pro-Ly avatar Sep 25 '23 06:09 Pro-Ly

I just checked master top. The failure is now different from when this issue was filed.

The test now outputs:

#include <cstdarg>
#include <cstdint>
#include <cstdlib>
#include <ostream>
#include <new>

struct Foo {

};

extern "C" {

WARN: Missing `[defines]` entry for `feature = "extra_headers"` in cbindgen config.
void extra_debug_fn();

void root(Foo a);

} // extern "C"

This may be simply an issue in the test, however. I haven't debugged it further yet.

luketpeterson avatar Sep 25 '23 06:09 luketpeterson

But in rust-toolchain.toml,channel is still "nightly". If you change to "1.70.0", it will fail to compile.

Pro-Ly avatar Sep 25 '23 06:09 Pro-Ly