You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem
When building with RUSTFLAGS="-C opt-level=1" cargo build --release or cargo rustc --release -- -C opt-level=1, while the compilation will happen with opt-level 1 instead of the default 3 for the release profile, the build script will still get OPT_LEVEL set to 3, not 1.
Generally flags driven by cargo (such as profile settings) shouldn't be passed in manually. That could maybe be documented more clearly, though it may be difficult because there are a large number of flags that shouldn't be used.
Problem
When building with
RUSTFLAGS="-C opt-level=1" cargo build --release
orcargo rustc --release -- -C opt-level=1
, while the compilation will happen with opt-level 1 instead of the default 3 for the release profile, the build script will still getOPT_LEVEL
set to 3, not 1.Steps
cargo new foo
cd foo
echo 'fn main() { panic!("{:?}", std::env::var("OPT_LEVEL")); }' > build.rs
RUSTFLAGS="-C opt-level=1" cargo build --release
orcargo rustc --release -- -C opt-level=1
output:Output of
cargo version
:cargo 1.51.0 (43b129a20 2021-03-16)
The text was updated successfully, but these errors were encountered: