File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -54,16 +54,17 @@ if [ -z "$NATIVE_BUILD" ]; then
5454 build_flags=" $build_flags --target $TARGET "
5555fi
5656
57-
57+ on_exit= " "
5858
5959# Currently the only way to set Rust codegen LTO type (-C lto, as opposed to
6060# -C compiler-plugin-lto) at build time for a crate with library dependencies
6161# is to patch Cargo.toml before the build. See
6262# https://github.com/rust-lang/cargo/issues/4349 and
6363# https://bugzilla.mozilla.org/show_bug.cgi?id=1386371#c2.
6464if [ -n " $RUST_LTO " ]; then
65+ on_exit=" mv Cargo.toml.orig Cargo.toml; $on_exit "
66+ trap " $on_exit " EXIT
6567 cp Cargo.toml Cargo.toml.orig
66- trap " mv Cargo.toml.orig Cargo.toml" EXIT
6768 case " $RUST_LTO " in
6869 lto) lto_value=" true" ;;
6970 lto=thin) lto_value=" \" thin\" " ;;
7374
7475# Rename the rust-toolchain file so that we can use our custom version of rustc installed
7576# on release containers.
76- trap " mv rust-toolchain.bak rust-toolchain" EXIT
77+ on_exit=" mv rust-toolchain.bak rust-toolchain; $on_exit "
78+ trap " $on_exit " EXIT
7779mv rust-toolchain rust-toolchain.bak
7880
7981if [ " $FEATURES " != " default" ]; then
You can’t perform that action at this time.
0 commit comments