GCC Rust Weekly Status Report 8 – Return of the Generics

Google Summer of Code 2021

With the recent announcement of Google Summer of Code 2021 GCC Rust has received a lot of interest from many different students. All of whom are getting up and running with the compiler and trying to figure out what their project proposal will be. This year google summer of code is shorter than the previous, and projects must be achievable within the available time. This is why the two suggested projects are in relation to the GCC Rust AST and HIR outputs which are critical for debugging the compiler down the line; the other project which will be more challenging is adding more static analysis, which is another open project to find missing static analysis warnings missing in GCC rust that are present in Rustc, this project is more free form and will need more feedback from the community as to its achievability within the time frame.

Community Monthly Open Status Report Call

In other news, I am trying to schedule a monthly status report call with the community on Zulip, and I am aiming for the first one to be on the 2nd of April 2021. The time is being narrowed down roughly to 1530 UTC, which is subject to some change as I want to find an appropriate time to maximize availability. I am aiming to record this and upload it to YouTube for those who cannot attend. A blog post detailing this will be released when it is finalized.

Compiler Development

My focus for this milestone has been generics; with the first part being merged into the compiler, it implemented the TurboFish and basic generics on Algebraic Data Types; my current branch is implementing Generics arguments on Functions and allowing recursive generic argument substitution such as:

 struct Foo<T>(T);
 struct Bar<T> {      
     a: Foo<T>,   
     b: bool,        
 }                      
 fn test<T>(a: Bar<T>) -> Foo<T> {           
     a.a
 }                          
 fn main() {                                                                                                                
     let a: Bar<i32> = Bar::<i32> {                                                                                         
         a: Foo::<i32>(123),                                                                                                                                                                                                                            
         b: true,                                                                                                                                                                                                                                       
     };                                                                                                                     
     let b: Foo<i32> = test(a);
 } 

This was a fairly difficult piece of work and requires name mangling to avoid duplicate symbols linker error. The other piece is if you are compiling the usage of a generic function, this means you are creating a concrete implementation of that function, but this means there is a chance to create duplicate functions if you call the same generic function with the same types which require analysis to cancel out any duplicates here.

S-Expressions

Recently a prospective Google summer of code student Yizhe has attempted to format the AST into S-epxressions this is a brilliant format for the AST and HIR outputs which can have extra metadata such as the NodeMappings. See his open PR for more information: https://github.com/Rust-GCC/gccrs/pull/276

Vacation

Small note that I am taking the 16th and 17th off for St Patrick’s Day. So I will pick up any missed messages on Thursday the 18th.

Completed Activities

  • CI Workflow to use make -j which cuts 20 min off each build – PR277
  • Refactor TyCtx – PR278
  • Fix warnings in build – PR273 PR271

Overall Task Status

Last WeekThis WeekDelta
TODO5457+3
In Progress34+1
Completed8187+6
GitHub Issues

Test Cases

Last WeekThis WeekDelta
Passing10161032+16
Failed00
make check-rust

Bugs

Last WeekThis WeekDelta
TODO770
In Progress10-1
Completed1820+2
GitHub Bugs

Milestones Progress

MilestoneLast WeekThis WeekDeltaStart DateCompletion DateTarget
Data Structures 1100%100%30th Nov 202127th Jan 202129th Jan 2021
Control Flow 1100%100%28th Jan 202110th Feb 202126th Feb 2021
Data Structures 248%55%+7%11th Feb 202128th May 2021
Data Structures 30%0%27th Aug 2021
Control Flow 20%0%29th Oct 2021
Imports and Visibility0%0%TBD
GitHub Milestones

Risks

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

Planned Activities

  • Raise PR for Generics part 2
  • Type Resolution documentation
  • Println and assert_eq macro interception

Leave a Reply

Your email address will not be published.