GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
gccrs

gccrs: add missing_abi lint

gccrs now warns about extern blocks without an explicit ABI string, promoting explicit ABI declarations.

The gccrs compiler introduces a new lint to warn developers when an extern block is declared without an explicit ABI string, such as extern { ... }. This silenty defaults to the C ABI, which Rust deprecates in favor of explicit declarations like extern "C". The change ensures the AST’s has_abi flag is preserved through lowering to enable this new warning.

In Details

To address the missing_abi lint in rust-unused-checker.cc, the HIR ExternBlock node in rust-hir-item.h now tracks an explicit_abi boolean flag. This flag is populated by the ASTLoweringBase::lower_extern_block function, which forwards the has_abi boolean from the AST. This allows the compiler to distinguish between a bare extern block and an extern "C" block, which previously collapsed to the same HIR representation.

For Context
gccrs
The Rust front-end for GCC, enabling GCC to compile Rust code.
extern block
In Rust, an extern block is used to declare functions or static variables that are defined in another language, typically C. It specifies the Application Binary Interface (ABI) to use for the foreign functions.
ABI
Application Binary Interface. Defines how functions are called, how arguments are passed, and how data is laid out in memory. This is crucial for interoperability between different languages and operating systems.
lint
A tool or a specific check within a compiler that analyzes code for stylistic errors, potential bugs, or violations of best practices, rather than syntax errors.
AST
Abstract Syntax Tree. A tree representation of the abstract syntactic structure of source code, produced by the parser.
HIR
High-level Intermediate Representation. In gccrs, HIR is a representation of the Rust code after parsing and some initial semantic analysis, used for subsequent compiler passes.
Filed Under: gccrsrustlintabi