We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cfg(debug_assertions)
So I have this ~/.cargo/config.toml file:
~/.cargo/config.toml
# wildcard cfg [target.'cfg(any(test, not(test)))'] linker = "clang" rustflags = ["-Z", "threads=8"] [target.'cfg(all(target_arch = "x86_64", target_os = "linux"))'] rustflags = ["-C", "link-arg=-fuse-ld=mold"] [target.'cfg(debug_assertions)'] rustflags = ["-Z", "codegen-backend=cranelift"] [profile.inst] inherits = "release" codegen-units = 1 strip = true lto = "thin"
According to my understanding, -Z codegen-backend=cranelift should only be set in debug builds. However:
-Z codegen-backend=cranelift
~ ❯ cargo install -fv cargo-info &| grep codegen | head -n 3 Running `/home/flippette/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_script_build --edition=2021 /home/flippette/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.78/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=b37db54dac17ce9f -C extra-filename=-b37db54dac17ce9f --out-dir /tmp/cargo-installOWdvTA/release/build/proc-macro2-b37db54dac17ce9f -C linker=clang -C strip=debuginfo -L dependency=/tmp/cargo-installOWdvTA/release/deps --cap-lints allow -C link-arg=-fuse-ld=mold -Z threads=8 -Z codegen-backend=cranelift` Running `/home/flippette/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name unicode_ident --edition=2018 /home/flippette/.cargo/registry/src/index.crates.io-6f17d22bba15001f/unicode-ident-1.0.12/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C metadata=854e146bbce61056 -C extra-filename=-854e146bbce61056 --out-dir /tmp/cargo-installOWdvTA/release/deps -C linker=clang -C strip=debuginfo -L dependency=/tmp/cargo-installOWdvTA/release/deps --cap-lints allow -C link-arg=-fuse-ld=mold -Z threads=8 -Z codegen-backend=cranelift` Running `/home/flippette/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name pin_project_lite --edition=2018 /home/flippette/.cargo/registry/src/index.crates.io-6f17d22bba15001f/pin-project-lite-0.2.13/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=1c23ed485efa1b06 -C extra-filename=-1c23ed485efa1b06 --out-dir /tmp/cargo-installOWdvTA/release/deps -C linker=clang -C strip=debuginfo -L dependency=/tmp/cargo-installOWdvTA/release/deps --cap-lints allow -C link-arg=-fuse-ld=mold -Z threads=8 -Z codegen-backend=cranelift`
this is not what's happening. Am I missing something or is this a Cargo bug?
[target.'cfg(debug_assertions)'] rustflags = ["-Z", "codegen-backend=cranelift"]
-C debug-assertions=off
cargo -v
readelf -p .comment /path/to/binary | grep -i cranelift
No response
~ ❯ cargo -vV cargo 1.78.0-nightly (f772ec022 2024-03-01) release: 1.78.0-nightly commit-hash: f772ec0224d3755ce52ac5128a80319fb2eb45d0 commit-date: 2024-03-01 host: x86_64-unknown-linux-gnu libgit2: 1.7.2 (sys:0.18.2 vendored) libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:OpenSSL/3.2.1) ssl: OpenSSL 3.2.1 30 Jan 2024 os: Arch Linux Rolling Release [64-bit]
The text was updated successfully, but these errors were encountered:
Thanks for the report! I believe this is a duplicate of #5777 and #8170, so closing in favor of that.
Sorry, something went wrong.
No branches or pull requests
Problem
So I have this
~/.cargo/config.toml
file:According to my understanding,
-Z codegen-backend=cranelift
should only be set in debug builds. However:this is not what's happening. Am I missing something or is this a Cargo bug?
Steps
~/.cargo/config.toml
-C debug-assertions=off
cargo -v
output andreadelf -p .comment /path/to/binary | grep -i cranelift
)Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: