GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gccrs

gccrs: Test alloc crate with Rust edition 2018

Updates gccrs test suite to use Rust edition 2018 for testing the alloc crate.

This commit updates the GCC Rust compiler’s test suite to use Rust edition 2018 when testing the alloc crate. Previously, the mock core crate used did not support edition 2018. This change modifies the alloc.exp test file to use the newer edition and adjusts the mock core.rs to fix its use declarations and use raw identifiers for ‘try’, ensuring compatibility with edition 2018.

In Details

The gccrs test suite's alloc crate tests have been updated to target Rust edition 2018. This was blocked by a mock core crate which did not fully support edition 2018. The change updates alloc.exp to specify edition 2018 and modifies core.rs to resolve import paths and use raw identifiers for 'try', enabling the test to pass under the newer edition.

For Context
Rust edition
A versioning scheme for the Rust language that allows for features to be added without breaking existing code. Editions are opt-in and provide a way to adopt new language changes incrementally. Editions 2015, 2018, and 2021 are common.
alloc crate
A standard Rust library crate that provides memory allocation primitives. It's foundational for many other data structures and collections.
mock crate
A simplified or stubbed version of a real crate used in testing. Mock crates simulate the behavior of dependencies without requiring the full dependency to be present or functional.
raw identifiers
In Rust, raw identifiers (e.g., r#try) are used to avoid conflicts with keywords. They allow the use of a keyword as an identifier by prefixing it with r#.
Filed Under: gccrsrusttestallocedition