This is currently done for Cargo by distutils-r1.eclass. The next commit will remove that code, leaving cargo_env responsible for it.
Signed-off-by: James Le Cuirot <ch...@gentoo.org> --- eclass/cargo.eclass | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eclass/cargo.eclass b/eclass/cargo.eclass index 84f72168fbb3c..25acf010287d8 100644 --- a/eclass/cargo.eclass +++ b/eclass/cargo.eclass @@ -549,7 +549,16 @@ cargo_env() { [[ ${_CARGO_GEN_CONFIG_HAS_RUN} ]] || \ die "FATAL: please call cargo_gen_config before using ${FUNCNAME}" + # Shadow flag variables so that filtering below remains local. + local flag + for flag in $(all-flag-vars); do + local -x "${flag}=${!flag}" + done + + # Rust extensions are incompatible with C/C++ LTO compiler see e.g. + # https://bugs.gentoo.org/910220 filter-lto + tc-export AR CC CXX PKG_CONFIG # Set vars for cc-rs crate. -- 2.45.2