GCC Rust Monthly Report #4 March 2021

Google Summer of Code 2021

With GCC kindly making GCC Rust part of the mentoring organisation we have attracted several students from around the world interested in compiler development. Many proposals are based on the example projects outlined in our wiki but some have also suggested their own. It’s very humbling to see how talented students are out there, and that they are interested in GCC Rust. I thank you all for your work so far, good luck to each of you.

Please see our wiki for more information: https://github.com/Rust-GCC/gccrs/wiki/Google-Summer-of-Code

Automation

Recently Philipp Krones has suggested that we investigate BORS which is an automation bot for CI/CD and common in Rust projects. This in this zulip discussion has more context for those interested in why this came around. Marc has already proposed a PR and discussion is flowing on how best to move forward this in terms of GCC copyright assignment and automated PRs in Github. Personally, I really like automation and modern practices but as this project is destined to be upstream with GCC lets take our time to get this right; in relation to this a long term goal for this compiler is that the front-end could be separated from GCC, and become its own project (while maintaining GCC copyright assignments), this is why we are using the rust-gcc.cc fork of go-gcc.cc GENERIC abstractions.

Testsuite

Recently the testsuite has been updated to be inline with other gcc testsuites with thanks to Marc Poulhies, who recently completed this GCC copyright assignment and with feedback from GCC developer Thomas Schwinge. This creates proper support for expected failures and takes advantage of the dejagnu annotations to look for the errors with associated location info to mark the test as passed or not. For example:

fn main() {
    let logical: bool = 123; // { dg-error "expected .bool. got .<integer>." }
}

Milestone Progress

The current Milestone is Data Structures 2 which focus on extending the type system for generics. This is a critical step forward ensuring our type system is capable of handling generic functions, methods and types. A lot of the building blocks are already in place namely templated ADT and template functions. These building blocks have implemented the core of Generics but there are remaining tasks in ensuring we support generic argument bindings where template parameters can have defaults, which means when we try to infer the substitutions we must take this into account and recursively. The other missing piece is when we define an impl block for example with an already substituted type we must ensure that no substitution occurs. This leaves a final task to ensure symbols are mangled correctly to avoid duplicate functions being generated and managled with the correct name of the substituted types involved.

See below for an example test case which should test each of these remaining pieces of work in terms of multiple impl blocks and defaults for generic parameters:

struct Foo<A = (isize, char)> {
    a: A,
}

impl Foo<isize> {
    fn bar(self) -> isize {
        self.a
    }
}

impl Foo<char> {
    fn bar(self) -> char {
        self.a
    }
}

impl Foo {
    fn bar(self) {
        let a: (isize, char) = self.a;
        let b = a.0;
        let c = a.1;

        let aa: Foo<isize> = Foo { a: b };
        let bb: isize = aa.bar();
    }
}

fn main() {
    let a = Foo { a: (123, 'a') };
    a.bar();
} 

Completed Activities

  • Initial TypeAlias support – PR322
  • Fix bugs with substitution types bool need_substitution() const – PR326
  • Fix infinite loop in cfg expansion – PR319
  • Add more dg-error annotations to XFAIL tests – PR329 PR315

Overall Task Status

CategoryLast MonthThis MonthDelta
TODO5357+4
In Progress36+3
Completed78107+29
GitHub Issues

Test Cases

CategoryLast MonthThis MonthDelta
Passing1008838-170
XFAIL026+26
Failed0
make check-rust

Bugs

CategoryLast MonthThis MonthDelta
TODO612+6
In Progress12+1
Completed1725+8
GitHub Bugs

Milestones Progress

MilestoneLast MonthThis MonthDeltaStart DateCompletion DateTarget
Data Structures 1 – Core100%100%30th Nov 202127th Jan 202129th Jan 2021
Control Flow 1 – Core100%100%28th Jan 202110th Feb 202126th Feb 2021
Data Structures 2 – Generics41%72%+31%11th Feb 202128th May 2021
Data Structures 3 – Traits0%0%27th Aug 2021
Control Flow 2 – Pattern Matching0%0%29th Oct 2021
Imports and Visibility0%0%TBD
GitHub Milestones

Risks

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

Planned Activities

Leave a Reply

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