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

gccrs: typecheck: Add auto-trait field propagation and negative impl checks

gccrs type-checker now propagates auto-trait information across struct fields and correctly handles negative trait implementations.

This commit enhances gccrs’s type-checking capabilities by introducing support for propagating auto-trait information through struct fields. It also refines the handling of negative trait implementations, ensuring that a type does not satisfy a bound if a negative implementation exists for it. These changes improve the compiler’s accuracy in verifying type constraints and trait bounds.

In Details

The TypeBoundsProbe::add_trait_bound function in rust-tyty-bounds.cc is updated to iterate over and check all fields of an ADT when evaluating trait bounds. Additionally, BaseType::satisfies_bound in rust-tyty.cc is modified to reject a trait bound if any negative implementation (impl !Trait for Type) is found. This ensures that structural auto-trait properties (like Send, Sync) are correctly determined based on the constituent fields, and that explicit negative trait bounds are respected.

For Context
auto-trait
A special kind of trait in Rust (e.g., Send, Sync, Copy) whose implementation is automatically inferred by the compiler based on the structure of a type. For example, a struct is Send if all of its fields are Send.
trait bound
A constraint on a generic type parameter, specifying that the type must implement a certain trait. For example, <T: Display> means T must implement the Display trait.
negative impl
A Rust construct that explicitly states a type does *not* implement a certain trait. This is typically used in sophisticated trait implementations or coherence rules to prevent certain types from satisfying specific bounds.
struct
A composite data type in Rust that groups together fields (variables) under a single name. Structs are used to create custom data structures.
field propagation
The process where properties or characteristics of a larger structure (like auto-trait status) are determined by examining the properties of its individual components (fields).
Filed Under: gccrsrusttype-checkingauto-traittraits