GCC Rust Weekly Status Report 10

Status Report Call

We are going to have our first community status report call this week on Zulip on 2nd April 2021 at 15:30 UTC+1, this is a public holiday for many people but I am going to work these days. Everyone is welcome just join on zulip.

Testsuite changes

Recently we have updated the testsuite 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

Recently I have merged Generics Part three to add templates to Impl blocks such as the following example:

struct GenericStruct<T>(T, usize);

impl<T> GenericStruct<T> {
    fn new(a: T, b: usize) -> Self {
        GenericStruct(a, b)

    fn get(self) -> T {

fn main() {
    let a: GenericStruct<i32> = GenericStruct::<i32>::new(123, 456);
    let aa: i32 = a.get();

    let b: GenericStruct<u32> = GenericStruct::<_>::new(123, 456);
    let bb: u32 = b.get();

    let c: GenericStruct<f32> = GenericStruct::new(123f32, 456);
    let cc: f32 = c.get();

It was satisfying to build since it was incremental work from previous weeks on 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:

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

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

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

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') };

Something that came up during development of generics is that generic parameters are not inherited on HIR Items that support generic parameters such as:

fn foo<T>(x: T) -> T {
    fn bar(y: T) -> T {

fn main() {

It results in E0401, this was not clear that rust does not support this but it does simplify things for compiler development.

Completed Activities

  • Refactor TestSuite to be in line with other GCC testsuites – PR301 PR315
  • Fix hang in parser when we have an unterminated comment – PR302
  • Add location info for TypePaths – PR303
  • Generics on impl blocks – PR304

Overall Task Status

CategoryLast WeekThis WeekDelta
In Progress34+1
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
make check-rust


CategoryLast WeekThis WeekDelta
In Progress02+2
GitHub Bugs

Milestones Progress

MilestoneLast WeekThis WeekDeltaStart DateCompletion DateTarget
Data Structures Core100%100%30th Nov 202027th Jan 202129th Jan 2021
Control Flow Core100%100%28th Jan 202110th Feb 202126th Feb 2021
Data Structures Generics60%69%+9%11th Feb 202128th May 2021
Data Structures Traits0%0%27th Aug 2021
Control Flow Pattern Matching0%0%29th Oct 2021
Imports and Visibility0%0%TBD
GitHub Milestones


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

  • Work on defaults for generic parameters
  • Finish more documentation
  • Help potential google summer of code students with their proposals

Leave a Reply

Your email address will not be published.