GCC Rust Weekly Status Report 53

Thanks again to Open Source Security, inc and Embecosm for their ongoing support for this project.

Milestone Progress

Our work on const generics kicked in this week with work on the parser to handle the new syntax. In the meantime, our GSoC students Andrew and Faisal started each of their project’s work period, which we are very happy about!

As a side note, our dashboard has been released on Github. It’s not yet deployed, but you can play around with it locally and try it out. Since we are far from competent web developers, feedback and contributions are extremely welcome! Both the backend and the frontend were written in Rust. You can find the repository at the following link.

Next week will probably not see much work, as Philip will still be in vacation and Arthur will be presenting the Rust-GCC project at Embedded World 2022 in Nuremberg with Embecosm.

Completed Activities

  • Add rust_sorry_at diagnostic PR1322
  • AST for const generic arguments/const application PR1317
  • Add const generic declaration to AST PR1316
  • Add base for parsing const generic application PR1315
  • Parse const generics properly PR1313
  • Refactor generic parameter parsing and report order errors PR1312
  • Fix formatting error on 32-bits targets PR1308
  • Handle super and crate in path resolution PR1307
  • Ast dump trait impl PR1296
  • gccrs const folding: port over cp_walk_subtrees() PR1286

Contributors this week

Overall Task Status

CategoryLast WeekThis WeekDelta
TODO147153+6
In Progress2926-3
Completed387398+6
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
Passing63536366+13
Failed
XFAIL2530
XPASS
make check-rust

Bugs

CategoryLast WeekThis WeekDelta
TODO5456+2
In Progress1211-1
Completed163169+2
GitHub Bugs

Milestone Progress

MilestoneLast WeekThis WeekDeltaStart DateCompletion DateTarget
Data Structures 1 – Core100%100%30th Nov 202027th Jan 202129th Jan 2021
Control Flow 1 – Core100%100%28th Jan 202110th Feb 202126th Feb 2021
Data Structures 2 – Generics100%100%11th Feb 202114th May 202128th May 2021
Data Structures 3 – Traits100%100%20th May 202117th Sept 202127th Aug 2021
Control Flow 2 – Pattern Matching100%100%20th Sept 20219th Dec 202129th Nov 2021
Macros and cfg expansion100100%1st Dec 202131st Mar 202228th Mar 2022
Imports and Visibility83%86%+3%29th Mar 202227th May 2022
Const Generics0%0%30th May 202229th Aug 2022
Intrinsics0%0%6th Sept 202230th Sept 2022
GitHub Milestones

Planned Activities

  • GSoC: Keep porting more const evaluation functions
  • GSoC: Keep working on improving our HIR dump
  • Start going through the various passes of the compiler to support const generics

Detailed changelog

Const generics parsing

As pointed out earlier, our parser did not support const generic declaration or application up until this week. We added the necessary features and took the time to refactor some parts of the parser, which made for nice little improvements all around.

Here are a few snippets from our testsuite:

// There are errors about unused generic parameters, but we can't handle that yet.
// Still, this code is invalid Rust.

mod sain {
    struct Foo<const N: usize>;
    struct Bar<T, const N: usize>;
    struct Baz<'l, T, const N: usize>;
}

mod doux {
    struct Foo<const N: usize = 15>;
    struct Bar<T, const N: usize = { 14 * 2 }>;

    const N_DEFAULT: usize = 3;

    struct Baz<'l, T, const N: usize = N_DEFAULT>;
}
struct Foo<const N>; // { dg-error "expecting .:. but .>. found" }
struct Bar<const N: >; // { dg-error "unrecognised token .>. in type" }
struct Baz<const N: usize = >; // { dg-error "invalid token for start of default value for const generic parameter" }
const M: usize = 4;

struct Foo<T, const N: usize = 1> {
    value: [i32; N],
}

fn main() {
    let foo = Foo::<i32> { value: [15] };
    let foo = Foo::<i32, 2> { value: [15, 13] };
    let foo: Foo<i32, M> = Foo::<i32, 4> {
        value: [15, 13, 11, 9],
    };

    let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, 3> { value: [15, 13] };
    let invalid_foo: Foo<i32, { 1 + 1 }> = Foo::<i32, M> { value: [15, 13] };
    let invalid_foo: Foo<i32> = Foo::<i32, 2> { value: [15, 13] };
}

Please note that const expressions are not yet handled in later parts of the compiler, hence the lack of typechecking errors.

Dashboard

You can access the dashboard’s repository here! Since we are not web developers, we probably made a bit of a mess, and all contributions are welcome! Furthermore, things like styling are currently absent from the repository as we did not want to embarass ourselves.

The entirety of the dashboard is written in Rust, backend and frontend. It was a really pleasant experience and a joy to work with.

You can run the dashboard locally quite easily, but it will be deployed publicly soon.

Backend

The backend exposes a REST API thanks to the rocket framework.

Our testing project is set-up to run all testsuites nightly and then upload the results as artifacts. Thanks to the octocrab crate, we perform daily requests to the GitHub API and cache these results.

We then serve them on three different endpoints (for now!):

  1. api/testsuites, which returns a list of all available keys
  2. api/testsuites/<key> to get the list of runs for that specific key
  3. api/testsuites/<key>/<date> for the result of that specific nightly run

Frontend

The frontend is a simple combination of Yew and plotters. We perform calls to the API to get a list of testsuites to display, and then fetch each of their results accordingly and graph them. The interface and styling are very basic, and we hope to add more functionality later on – zooming on a specific date range, hovering on points to get the exact data, etc.

Leave a Reply

Your email address will not be published.