GCC Rust Status Monthly Report #2 – Jan 2021

This month completes the Core Data Structures milestone this provides the base of the compiler pipeline moving forward on time with the target date. An application to https://nlnet.nl/assure/ has been for submitted for a PhD student to create a general Rust language testing framework to automate the compilation of test cases on any Rust compiler. Initially it will target three compilers: rustc LLVM, rustc Cranelift and Rust-GCC. Taking into account a combination of security features such as the stack-protector, strict-aliasing and optimization levels.

Milestone Overview

Within this milestone the pipeline of the compiler has been fleshed out following the pipeline below.

  -> Lex/Parse
    -> Produces: AST
  -> Macro Expansion (TODO)
  -> Name resolver
    -> Warnings: Unused names/types
    -> Validates the LHS of assignments
    -> Name Shadowing rules
    -> Produces: side-table lookups of NodeIds to declaration NodeIds (Ribs)
  -> HIR Lowering
    -> Preserves attributes
    -> Produces: side-table lookups of HirIds
  -> Type Resolver
    -> Type Inference
    -> Validates all types have been resolved
    -> Produces: side-table lookups of HirId's to TyTy types
  -> Gimple Lowering:
    -> reuse the lookups of HirIds to TyTy
    -> Produces Gimple

Using side table lookups of HirId’s is instrumental when it comes to emitting Gimple nodes we can look up the HirId back to the TyTy module what a type of a particular node is instead of maintaining getter/settings on the HIR data structures which is hard to maintain and was buggy in the past implementations of GCCRS. Moreover, it allows static analysis to operate in non-lexical lifetimes which is important in Data Structures 2 and 3 milestones for generics and traits.

Macros have been left as a skeleton expansion pass after parsing, and contributor SimplyTheOther has been making progress on this. Since expansion runs before HIR Lowering, this has minimal impact on the compiler’s work after that point. For me, this year’s focus should be on the Generics and Traits, which are the areas I expect the most complexity to arise from.

Thanks to new contributions from Thomas Schwinge for fixing some compilation warnings.

The next Milestone Control flow 1 builds upon this work to provide Loops, assignable block expressions and methods using Impl blocks which is the building block to start work on Generics.

Please find a folder of example demo applications for this Monthly Report. https://github.com/Rust-GCC/Reporting/tree/main/Jan-2021/monthly-demo

Completed Activities

  • [X] Tuples
  • [X] Tuple Structs
  • [X] TupleIndexAccessExpr
  • [X] Structs
  • [X] FieldAccessExpr
  • [X] CompoundAssignmentExpr
  • [X] NegationExpr
  • [X] Integer and Float Inference Variables
  • [X] UnitType
  • [X] Implicit returns
  • [X] Mutability on builtin types
  • [X] Unused name/type warnings
  • [X] Unreachable code check
  • [X] Shadowing rules
  • [X] Global variables
  • [X] Constants

Overall Task Status

Last MonthThis MonthDelta
In Progress53-2
GitHub Issues

Test Cases

Last MonthThis MonthDelta
make check-rust


Last MonthThis MonthDelta
In Progress000
GitHub Bugs

Milestones Progress

MilestoneLast MonthThis MonthDeltaStart DateCompletion DateTarget
Data Structures 161%100%+39%30th Nov 202027th Jan 202129th Jan 2021
Control Flow 114%33%+19%28th Jan 202126th Feb 2021
Data Structures 20%0%28th May 2021
Data Structures 30%0%27th Aug 2021
Control Flow 20%0%29th Aug 2021
Imports and Visibility0%0%TBD
GitHub Milestones


RiskImpact (1-3)LikelihoodRisk (I * L)Mitigation
Copyright assignments2510Be up front on all PRs that the code is destined to be upstreamed to FSF

Planned Activities

  • Control Flow 1 Milestone
  • Documentation on pipeline

Leave a Reply

Your email address will not be published. Required fields are marked *