GCC Rust Weekly Status Report 16

Overview

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

Milestone Progress

Last week we saw that the Generics Milestone was completed, now it’s onto planning Traits. What I have learnt from the previous milestones planning is important and I think spending the time to find the limitations and relevant test cases from the rust test suite helps a lot. In particular expected failure test cases have helped me figure out how things are implemented in the Rustc compiler, as you can find at what point in the compiler pipeline a particular error was caught by searching the source code and trying difficult permutations of the test case.

I don’t expect there to be much if any change in the percentage progress of the milestone this upcoming week as I still want to spend some more time planning and investigating where the limitations in least upper bound coercion’s are.

Welcome Google Summer of Code 2021 Students

As of 17th May 2021 Google Summer of code students have been announced and we are pleased to have two students for GCC Rust:

  • Wenzhang Yang has already started a project called “Static analysis for unreachable functions.”. This allows the GCC Rust compiler to emit warnings for dead code just like Rustc.
  • Arthur Cohen is going to be working on “Cargo tool for Rust-GCC” this is an important milestone for GCC Rust in that we wish to be able to leverage the rust build tools. This means finding the gaps in terms of compiler flags in GCC Rust and finding the correct hook points to reuse cargo.

If you wish to know more about these projects there are threads on our Zulip server.

Detailed changelog

Issue and PR Templates

We now have added issue and PR templates to GitHub which should help guide new contributors in this area.

Raw Identifiers

New contributor Mark Wielaard has posted quite a few fixes for the compiler including fixes for Fedora 33 on x86 but also fixes for aarch64. Here he fixed the parser to handle raw identifiers which in rust allows you to use keywords as names like ‘match’ for example.

fn main() {
    let r#match = 123;
}

Unsupported testsuite

Marc has provided support for an unsupported testsuite section for the compiler allowing us to add test cases for this that we don’t support yet. When we do add/fix the issues these should turn into XPASS which will fail the CI build and require changes to update the test suite accordingly

Fixes for buffered queue on arm64

New contributor Mark Wielaard has also found that on arm64 we were hitting an ICE in the parser queue due to a bad calculation on when to extend the buffer.

Fix bug parsing attributes

Google Summer of Code student Wenzhang Yang has fixed the parser in parsing attributes correctly. Note we still have not implemented any attributes.

Don’t warn unused when the name is prefixed with ‘_’

Google Summer of Code student Arthur Cohen has fixed the scan for unused to only emit a warning if the name is not prefixed with an underscore in line with the official rust behaviour.

Fix ICE on Fedora

We had issues on Fedora where some of the test cases were failing this was due to a bad bitmask. In rust all toplevel items are given a LocalDefId which forms half of the DefId which is the Crate number and LocalDefId. In Rust this is actually achieved via a struct but in GCC Rust this was a uint64 bitmask of the two u32’s. The bug here was that the value was shifted by sizeof(u32) which is bytes and it needed to be shifted by 32 bits in order to correctly format the value correctly. This lead to duplicates being added to the HIR mappings tables causing an ICE.

Completed Activities

  • Add Issue and PR Templates – PR431
  • Allow unused underscore identifiers – PR433
  • Fix parsing of attributes – PR436
  • DefId is a bitmask of CrateNum & LocalDefId – PR438
  • Fix Raw Identifiers – PR443
  • ARM64 Fixes – PR444 PR445 PR446 PR448
  • Add unsupported testsuite – PR393

Overall Task Status

CategoryLast WeekThis WeekDelta
TODO7677+1
In Progress46+2
Completed133138+5
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
Passing23142368+54
XFAIL4226-16
make check-rust

Bugs

CategoryLast WeekThis WeekDelta
TODO1717
In Progress12+1
Completed4244+2
GitHub Bugs

Milestones 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 – Traits0%0%20th May 202127th Aug 2021
Control Flow 2 – Pattern Matching0%0%29th Oct 2021
Imports and Visibility0%0%TBD
GitHub Milestones

Risks

RiskImpact (1-3)Likelihood (0-10)Risk (I * L)Mitigation
Copyright assignments2510Be up front on all PRs that the code is destined to be upstreamed to FSF
Rust Language Changes3721
Keep up to date with the Rust language on a regular basis

Planned Activities

  • Plan out traits milestone
  • Add test cases for traits

Leave a Reply

Your email address will not be published. Required fields are marked *