Thanks again to Open Source Security, inc and Embecosm for their ongoing support for this project.
Milestone Progress
This week there has been no progress change for this milestone but that does not mean no work was done. I have opened a new PR that implements the TurboFish which ensure the compiler iterates all segments in the Path and applies the generic arguments if available to find the appropriate path to a function/constant etc, this change involves a few building blocks. For example, in rust, you can create an impl block for multiple concrete versions of a generic algebraic data type ISSUE-325.
struct Foo<T>(T, bool);
impl Foo<i32> {
fn bar(self) -> i32 {
self.0
}
}
impl Foo<f32> {
fn bar(self) -> f32 {
self.0
}
}
fn main() {
let a = Foo(123, true);
let aa = a.bar();
let b = Foo(456f32, true);
let bb = b.bar();
}
This change means we needed to implement Canonical Paths for the name resolver so as we don’t detect duplicate names for the two impl blocks. There are caveats here in that we can end up in a case where we might find multiple applicable items in Path resolution such as ISSUE-355.
The open PR however still does not address the case of overlapping impl items such as: ISSUE-353
Detecting unused code
Recent we have merged PR-365 from a potential Google Summer of code student Thomas who wishes to improve our unused code diagnostic warnings. This includes using liveness variables to follow code paths such as:
fn bar() {
foo();
}
fn foo() {
bar();
}
fn f() {
}
fn main() {
f();
}
../gccrs/gcc/testsuite/rust.test/xfail_compile/unused.rs:2:1: warning: function is never used: `[bar]`
2 | fn bar() {
| ^
../gccrs/gcc/testsuite/rust.test/xfail_compile/unused.rs:6:1: warning: function is never used: `[foo]`
6 | fn foo() {
| ^
Empty Arrays Crash
Another potential Google Summer of code Student Yizhe has also fixed crashes with empty arrays which are valid in rust:
fn main() {
let arr = ["Hello"; 0];
}
Completed Activities
- Raised PR for canonical paths: PR-358
- Raised PR for multiple applicable items in scope: PR-358
- Raised PR to implement TurboFish: PR-358
- Fix crash with zero length arrays: ISSUE-260
- Add initial liveness variables for dead code detection: ISSUE-330 PR-365
Overall Task Status
Category | Last Week | This Week | Delta |
TODO | 57 | 61 | +4 |
In Progress | 6 | 11 | +5 |
Completed | 107 | 110 | +3 |
Test Cases
Category | Last Week | This Week | Delta |
Passing | 838 | 861 | +23 |
XFAIL | 26 | 26 | – |
Failed | 0 | 0 | – |
XPASS | 0 | 0 | – |
Bugs
Category | Last Week | This Week | Delta |
TODO | 12 | 13 | +1 |
In Progress | 2 | 6 | +4 |
Completed | 25 | 26 | +1 |
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 Flor 1 – Core | 100% | 100% | – | 28th Jan 2021 | 10th Feb 2021 | 26th Feb 2021 |
Data Structures 2 – Generics | 72% | 72% | – | 11th Feb 2021 | – | 28th May 2021 |
Data Structures 3 – Traits | 0% | 0% | – | – | – | 27th Aug 2021 |
Control Flow 2 – Pattern Matching | 0% | 0% | — | – | – | 29th Oct 2021 |
Imports and Visibility | 0% | 0% | – | – | – | TBD |
Risks
Risk | Impact | Likelihood | Risk (I * L) | Mitigation |
Copyright assignment | 2 | 5 | 10 | Be up front on all PRs that the code is destined to be upstreamed to FSF |
Rust Language Changes | 3 | 7 | 21 | Keep up to date with the Rust language on a regular basis |