GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Recognizes Rust 1.55 features and #[used] attribute.

Rust frontend now supports Rust 1.55 features and the #[used] attribute, affecting static variable handling.

The GCC Rust frontend now handles Rust 1.55’s “active” features, which can be “incomplete” and use a __status_to_bool mechanism. Additionally, it fully supports the #[used] attribute, including the #[used(linker)] variant, ensuring static variables are not unexpectedly removed by the compiler or linker, similar to C’s used and retain attributes.

In Details

gccrs: This commit updates the Rust frontend to support Rust 1.55's feature gate mechanism, specifically handling "incomplete" features and the __status_to_bool conversion. It also implements the #[used] attribute, which controls the visibility of static items to the linker. The #[used(linker)] variant allows explicit retention by the linker, mirroring C's retain functionality. This impacts how static variables, especially those used in kernel contexts, are preserved.

For Context
Rust feature gate
A mechanism in Rust to control the availability of unstable or experimental language features. Features can be "active" or "incomplete," affecting how they are processed by the compiler.
#[used] attribute
A Rust attribute that prevents the compiler or linker from removing a static variable, even if it appears unused. This is crucial for embedded systems and kernel development where such variables might be accessed indirectly or by external tools.
static variable
A variable with static storage duration, meaning it exists for the entire lifetime of the program. In Rust, these are often declared using static or static mut.
Filed Under: gccrsrustattribute