Thanks again to Open Source Security, inc and Embecosm for their ongoing support for this project.
Milestone Progress
This report covers work completed since the 1st of November as I took the last week of the 8th off to use some vacation time. During that week, I cracked the problem of handling/managing rust’s lang-item system within gccrs; this unblocked my branch on operator overloading to demonstrate it; thanks to all the bug fixes last month, this seems to be working smoothly. Before operator overloading can be merged, the PR needs to be split up into smaller commits and rebased on top of the recent changes from the community; the DefId change comes to mind as we use this to differentiate between traits.
The community has made a significant dent into all of the lower hanging fruit of good-first-pr’s; there are many more issues like this one the way soon, so keep your eye out if you wish to find your feet to get involved.
So far, I feel like the pace of this milestone is going well, and I am still on track to be about one week over the target date. This leaves us to close out the year by testing the compiler in anger on Blake3 to see how well we get on. Aside from that, I am working on an upcoming blog post reviewing GCC Rust as a project and visiting the major accomplishments along the way in 2021, so keep your eye out for this one.
Thank you to everyone who continues to support and work on the compiler.
Monthly Community Call
We had our 8th community call on 5th November 2021 you can find the meeting notes over here: https://github.com/Rust-GCC/Reporting/blob/main/2021-11-05-community-call.md
Completed Activities
- Tag ‘rust_fatal_error’ as ‘noreturn’ PR777 PR780
- Add location info in AST::TypeBoundWhereClauseItem and HIR::TypeBoundWhereClauseItem PR778
- Add new rust_internal_error for specific ICE’s PR779
- Merge Type Checking code for enums PR781
- Refactor TyTy::ADTType into one which can contain multiple variants PR781
- Get rid of lambda in AST::TypePath PR783
- Track inline module scopes for path module imports PR785
- Save make check-rust artifacts for GHA PR787
- Add new -frust-crate option to specify crate name PR788
- Get rid of lambda TyTy::TupleType iterate fields PR791
- Change DefId from uint64_t with bitmask into a struct PR792
- Fix unhandled TypeBounds PR794
- Documentation for clang-format usage PR795 PR802 PR803
- Handle forward declared items within blocks PR796
- Fix some missing cases of constant folding PR798
Contributors this month
- Thomas Schwinge
- Arthur Cohen
- Marc Poulhiès
- Ben Boeckel
- Connor Lane Smith (new contributor)
Overall Task Status
Category | Last Week | This Week | Delta |
TODO | 99 | 93 | -6 |
In Progress | 12 | 14 | +2 |
Completed | 234 | 244 | +10 |
Test Cases
Category | Last Week | This Week | Delta |
Passing | 4844 | 4931 | +87 |
XFAIL | 21 | 21 | – |
Bugs
Category | Last Week | This Week | Delta |
TODO | 22 | 23 | +1 |
In Progress | 3 | 4 | +1 |
Completed | 84 | 86 | +2 |
Milestones 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 | 55% | 70% | +15% | 20th Sept 2021 | – | 29th Nov 2021 |
Macros and cfg expansion | 0% | 0% | – | 1st Dec 2021 | – | 28th Mar 2022 |
Imports and Visibility | 0% | 0% | – | 29th Mar 2022 | – | 27th May 2022 |
Const Generics | 0% | 0% | – | 30th May 2022 | – | 25th Jul 2022 |
Intrinsics | 0% | 0% | – | 6th Sept 2021 | – | 30th Sept 2022 |
Risks
Risk | Impact (1-3) | Likelihood (0-10) | Risk (I * L) | Mitigation |
Rust Language Changes | 3 | 7 | 21 | Keep up to date with the Rust language on a regular basis |
Going over target dates | 3 | 5 | 15 | Maintain status reports and issue tracking to stakeholders |
Planned Activities
- Merge lang-items work
- Merge operator overloading work
- Finish work on adding enum support
Detailed changelog
Refactor TyTy::ADTType
In order to support enums, we could have implemented a new TyTy module for this, to then subsequently update the typechecking code. But in a lot of ways enum’s are just another type of algebraic data type which also has the side effect of canonicalizing the flow of how we work with these types instead of inventing new paths in the compiler. The change here was that the ADT Type was originally designed for unit-structs, structs and tuple structs. But really an enum is an ADT with multiple variants and struts, tuple structs are ADT’s with a single variant and finally, a unit-struct is one with no variants. This change was rather large to decouple and refactor ADT’s into variants but has helped tackle some technical debt along the way. Thanks to @flip1995 for pointing us in this direction.
Add new rust_internal_error
This new API is designed to distinguish between internal compiler errors and actual program errors. Assertions are good but somtimes you want to be able to provide extra contextual information.
Handle forward declared items within blocks
Rust allows for Items such as functions to be declared at the bottom of a BlockExpr which can be referenced at any point within that conxtext such as: https://godbolt.org/z/PGqnz1nve
pub fn main() {
let a;
a = foo { a: 123, b: 456f32 };
let mut a = 123;
a = bar(a);
let mut b = 456f32;
b = bar(b);
let aa = X;
let bb:[i32; X];
fn bar<T>(x: T) -> T {
x
}
struct foo {
a: i32,
b: f32,
};
const X:usize = 2;
}
Fix unhandled TypeBounds
This test case qithin the rust testsuite https://github.com/rust-lang/rust/blob/d5a0c7cb036032288a4a5443b54ba061ec12ee26/src/test/ui/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs raised bugs with unhandled type bounds for TypeAlises:
type FnObject<'b> = dyn for<'a> FnLike<&'a isize, &'a isize> + 'b;
The bug here was that we had two ways in HIR to represent bounds here, and we had an opertunity to desugar our AST from two types:
- AST::TraitObjectType
- AST::TraitObjectTypeOneBound
Into a single HIR::TraitObjectType