tools build: Fix feature test for rust compiler
authorDmitrii Dolgov <9erthalion6@gmail.com>
Wed, 11 Feb 2026 09:58:01 +0000 (10:58 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Thu, 12 Feb 2026 20:45:22 +0000 (17:45 -0300)
commit804490c3eb26098b60c5e858fa20c0e6f2c2c1d8
treef77ff1b27a645ce46e4ac8c58933d69948786790
parent1a6c45969a85d1be43dbbf0705aef4bc8eb515a8
tools build: Fix feature test for rust compiler

Currently a dummy rust code is compiled to detect if the rust feature
could be enabled. It turns out that in this case rust emits a dependency
file without any external references:

    /perf/feature/test-rust.d: test-rust.rs

    /perf/feature/test-rust.bin: test-rust.rs

    test-rust.rs:

This can lead to a situation, when rustc was removed after a successful build,
but the build process still thinks it's there and the feature is enabled on
subsequent runs.

Instead simply check the compiler presence to detect the feature, as
suggested by Arnaldo.

This way no actual test-rust.bin will be created, meaning the feature
check will not be cached and always performed. That's exactly what we
want, and the overhead of doing this every time is minimal.

Tested with multiple rounds of install/remove of the rust package.

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Suggested-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Signed-off-by: Dmitrii Dolgov <9erthalion6@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Miguel Ojeda <ojeda@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/build/feature/Makefile
tools/build/feature/test-rust.rs [deleted file]