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
- Rainer Orth (new contributor)
- Andrew Naguib (new contributor)
- Faisal Abbas
- Marc Poulhiès
Overall Task Status
Category | Last Week | This Week | Delta |
TODO | 147 | 153 | +6 |
In Progress | 29 | 26 | -3 |
Completed | 387 | 398 | +6 |
Test Cases
Category | Last Week | This Week | Delta |
Passing | 6353 | 6366 | +13 |
Failed | – | – | – |
XFAIL | 25 | 30 | – |
XPASS | – | – | – |
Bugs
Category | Last Week | This Week | Delta |
TODO | 54 | 56 | +2 |
In Progress | 12 | 11 | -1 |
Completed | 163 | 169 | +2 |
Milestone Progress
Milestone | Last Week | This Week | Delta | Start Date | Completion Date | Target |
Data Structures 1 – Core | 100% | 100% | – | 30th Nov 2020 | 27th Jan 2021 | 29th Jan 2021 |
Control Flow 1 – Core | 100% | 100% | – | 28th Jan 2021 | 10th Feb 2021 | 26th Feb 2021 |
Data Structures 2 – Generics | 100% | 100% | – | 11th Feb 2021 | 14th May 2021 | 28th May 2021 |
Data Structures 3 – Traits | 100% | 100% | – | 20th May 2021 | 17th Sept 2021 | 27th Aug 2021 |
Control Flow 2 – Pattern Matching | 100% | 100% | – | 20th Sept 2021 | 9th Dec 2021 | 29th Nov 2021 |
Macros and cfg expansion | 100 | 100% | – | 1st Dec 2021 | 31st Mar 2022 | 28th Mar 2022 |
Imports and Visibility | 83% | 86% | +3% | 29th Mar 2022 | – | 27th May 2022 |
Const Generics | 0% | 0% | – | 30th May 2022 | – | 29th Aug 2022 |
Intrinsics | 0% | 0% | – | 6th Sept 2022 | – | 30th Sept 2022 |
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!):
api/testsuites
, which returns a list of all available keysapi/testsuites/<key>
to get the list of runs for that specific keyapi/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.