Thanks again to Open Source Security, inc and Embecosm for their ongoing support for this project.
Milestone Progress
We are getting closer to the end of this milestone and last week saw my long living branch finally getting merged. This branch has added the relevant code to support type bounds, which is the last building block to implement the remaining tasks of the traits milestone. This means future work to complete traits should be smaller and easier to review. However, two outstanding tasks carry some risk in making my deadline go over: trait objects (dyn keyword), which implements vtable lookups and autodref to resolve paths fully.
BCS and Rust London
I will be attending and speaking at a hybrid conference on the 25th August here is the relevant link if you wish to check in on this.
Monthly Community Call
We had our Monthly community call please find our meeting notes over on: https://github.com/Rust-GCC/Reporting/blob/main/2021-08-06-community-call.md
Detailed changelog
Type Bounds
Last week the goal was to finally merge last big branch which adds the initial type-bounds support such as:
trait Foo {
fn default() -> i32;
fn get(self) -> i32;
}
struct Bar(i32);
impl Foo for Bar {
fn default() -> i32 {
123
}
fn get(self) -> i32 {
self.0
}
}
fn type_bound_test<T: Foo>(a: T) -> i32 {
T::default() + a.get()
}
fn main() {
let a;
a = Bar(456);
let b;
b = type_bound_test(a);
}
This includes checks for when a type does not support the type bound for example:
trait Foo {
fn default() -> i32;
}
trait Bar {
fn not_default() -> i32;
}
trait Baz {
fn cake() -> i32;
}
struct Test(i32);
impl Foo for Test {
fn default() -> i32 {
1234
}
}
fn type_bound_test<T: Foo + Bar + Baz>() -> i32 {
T::default()
}
fn main() {
let a = type_bound_test::<Test>();
}
Will return:
test.rs:26:31: error: bounds not satisfied for Test ‘Bar, Baz’ is not satisfied
21 | fn type_bound_test<T: Foo + Bar + Baz>() -> i32 {
| ~ ~
......
26 | let a = type_bound_test::<Test>();
| ^
You watch some of the development process on my youtube channel for this patch:
Fix ICE when using f64 on 32 bit systems
Thanks to our new contributor Michael Karcher who has fixed an bug with how 64bit floats were handled on 32bit systems. GCC was automatically changing our f64 into float:80 which is the case when we need an excess precision type. The issue was that we were missing a gcc conversion for the new tree so the types are updated correctly.
This means we now have fully passing builds on Marks build farm:
- debian arm64
- fedora ppc64le
- fedora ppc64
- debian i386
- fedora s390x
Thanks to John Paul Adrian Glaubitz who has also completed the manual testing on:
- debian hppa
- debian m68k
- debian s390x
As part of GitHub automation we do not accept any PR which causes any regression to ubuntu-x86_64.
Fix parser bug when using null terminator in strings
With our recent examples showing HelloWorld working via printf, we noticed that the null terminator was not being respected when added to strings, this turned out to be a bug in the parser so we have added a new test case to catch this:
/* { dg-output "bar foo baz foobar\n" } */
extern "C"
{Last Week
fn printf(s: *const i8, ...);
fn memchr(s: *const i8, c: u8, n: usize) -> *const i8;
}
pub fn main ()
{
let f = "%s %s %s %s\n\0";
let s = "bar\0\
foo\
\x00\
baz\u{0000}\
foobar\0";
let cf = f as *const str as *const i8;
let cs = s as *const str as *const i8;
unsafe
{
let cs2 = memchr (cs, b'f', 5);
let cs3 = memchr (cs2, b'b', 5);
let cs4 = memchr (cs3, b'f', 5);
printf (cf, cs, cs2, cs3, cs4);
}
}
Completed Activities
- Typebounds support PR611 PR612
- Fix lexer bug with nul terminated strings PR615
- Union support PR601 PR602
- Handle unsafe in liveness analysis PR604
- Fix floating point issues with f64 on 32 bit systems PR614
- Building blocks for multiple file support PR608 PR605
- Fix ICE in parser when identifier is nullptr PR606
- Cleanup PR612 PR610 PR607
Contributors this week
- Arthur Cohen
- Mark Wielaard
- Thomas Schwinge
- Michael Karcher (new contributor)
Excluding merges, 5 authors have pushed 25 commits to master and 26 commits to all branches. On master, 56 files have changed and there have been 1,799 additions and 775 deletions.
Overall Task Status
Category | Last Week | This Week | Delta |
TODO | 83 | 82 | -1 |
In Progress | 9 | 9 | – |
Completed | 177 | 180 | +3 |
Test Cases
Category | Last Week | This Week | Delta |
Passing | 3629 | 3766 | +137 |
XFAIL | 14 | 21 | +7 |
Bugs
Category | Last Week | This Week | Delta |
TODO | 19 | 17 | -2 |
In Progress | 3 | 4 | +1 |
Completed | 59 | 61 | +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 | 80% | 83% | +3% | 20th May 2021 | – | 27th Aug 2021 |
Control Flow 2 – Pattern Matching | 0% | 0% | – | – | – | 29th Oct 2021 |
Imports and Visibility | 0% | 0% | – | – | – | TBD |
Macros and cfg expansion | 0% | 0% | – | – | – | TBD |
Const Generics | 0% | 0% | – | – | – | TBD |
Intrinsics | 0% | 0% | – | – | – | TBD |
Planned Activities
- Complete TypeBounds checks
- Merge missing test cases for casts and coercions
YouTube
You can also watch me present this on youtube: