--rust-target beta and nightly suffixes · Issue #3152 · rust-lang/rust-bindgen (original) (raw)

#2993 loosened --rust-target parsing to accept "any*" Rust version output.

Unfortunately, this does not include all of the possible rustc --version output varieties. The following apparently-valid version strings result in error: invalid value '...' for '--rust-target <RUST_TARGET>': "..." is not a valid Rust target:

rustc --version        
rustc 1.86.0-beta.1 (f0cb41030 2025-02-17) (gentoo)
rustc --version   
rustc 1.87.0-nightly (gentoo)

Some consumers of Rust / bindgen (e.g. Meson via the Rust module and rust.bindgen()) pass this version info into bindgen as a --rust-target: e.g. as --rust-target=1.87.0-nightly.

How should this be handled?

I see two options:

I'm not sure which option (if either) is desirable, however:

I'll already need to update Meson's Rust module to handle the #2993-changed "invalid Rust target" output; if you have any suggestions on how a build system should use the --rust-target option please let me know.

Downstream bug: https://bugs.gentoo.org/949593