GCC Front-End For Rust

Alternative Rust Compiler for GCC

View the Project on GitHub

August 2023 Monthly report

Overview

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

Milestone Progress

Another very important month in terms of contributions, with 86 pull requests merged. Once again, most of them come from the Google Summer of Code program, which is coming to an end. You can expect more detailed blogposts about our students’ work this summer in the coming weeks, but the short of it is: they have both been hugely successful, and have proved to be amazing contributors to the project. They have both passed the GSoC evaluations brillantly, and we are hoping they will keep working on the project! Thank you Raiki Tamura and Mahad Muhammad! Well done!

On the technical side of things, late name resolution is going swimmingly. We are now in the process of merging it in the compiler, while still keeping it hidden behind a specific command line flag (-frust-name-resolution-2.0). A lot of our existing testsuite passes with that new option enabled, and we are working on fixing the remaining failures. Pierre- Emmanuel has done some really good work on our early name resolution too, taking care of transforming it into a fixed point algorithm which runs until nothing has changed. This enables interesting behaviors, such as a macro invocation expanding to a macro definition, which a later invocation could resolve to. Early name resolution is also responsible for handling imports (use declarations), and we are on track to add the last piece of the puzzle needed for resolving all core 1.49 imports: glob imports (use foo::*). These imports work differently from regular imports, as they only concern public items, and can be shadowed by later declarations, but they are much easier to handle in our new name resolution algorithm and are almost there.

This resolution pass also needs to tie in with the rest of the codebase, namely typechecking and our compilation backend, which rely on it closely. We have spent a long amount of time recreating the missing functions from those new data structures, and making sure the later compilation passes could make use of the new resolution.

On the typechecking side, Philip is also getting infuriatingly close to getting iterators working! Thanks to advice from bjorn3 and Matthew Jasper, we have identified a few bugs in our handling of compiler intrinsics, which are now fixed. The handling of opaque types is one of the last big pieces of iterator support, which Philip is currently working on.

After that work is complete, we will start working on the format_args!() builtin macro, a central component of the widely used println!() macro as well as a lot of print-like macros available in Linux kernel.

macro_rules! print_macro (
    // The non-continuation cases (most of them, e.g. `INFO`).
    ($format_string:path, false, $($arg:tt)+) => (
        // To remain sound, `arg`s must be expanded outside the `unsafe` block.
        // Typically one would use a `let` binding for that; however, `format_args!`
        // takes borrows on the arguments, but does not extend the scope of temporaries.
        // Therefore, a `match` expression is used to keep them around, since
        // the scrutinee is kept until the end of the `match`.
        match format_args!($($arg)+) {
            // SAFETY: This hidden macro should only be called by the documented
            // printing macros which ensure the format string is one of the fixed
            // ones. All `__LOG_PREFIX`s are null-terminated as they are generated
            // by the `module!` proc macro or fixed values defined in a kernel
            // crate.
            args => unsafe {
                $crate::print::call_printk(
                    &$format_string,
                    crate::__LOG_PREFIX,
                    args,
                );
            }
        }
    );

    // The `CONT` case.
    ($format_string:path, true, $($arg:tt)+) => (
        $crate::print::call_printk_cont(
            format_args!($($arg)+),
        );
    );
);

Source: https://github.com/Rust-for-Linux/linux/blob/4af84c6a85c63bec24611e46bb3de2c0a6602a51/rust/kernel/print.rs#L146-L176.

Finally, we are looking forward to meeting with the GCC community once again during GNU Cauldron at the end of September in Cambridge. Philip and Pierre-Emmanuel will be giving a talk about some of the recent changes in the compiler, as well as the inner workings of procedural macros. We will also be talking about the compilation of the core library at EuroRust in Brussels. See you then!

Community call

We will have our next monthly community call on the 11th of September

  1. You can subscribe to our calendar to see when the next one will be held. The call is open to everyone, even if you would just like to sit-in and listen. You can also subscribe to our mailing-list or join our Zulip chat to be notified of upcoming events.

Completed Activities

Contributors this month

Overall Task Status

Category Last Month This Month Delta
TODO 252 257 +5
In Progress 52 54 +2
Completed 721 737 +16

Test Cases

TestCases Last Month This Month Delta
Passing 7974 8148 +174
Failed - - -
XFAIL 53 69 +16
XPASS - - -

Bugs

Category Last Month This Month Delta
TODO 90 93 +3
In Progress 27 28 +1
Completed 354 363 +9

Milestones Progress

Milestone Last Month This Month 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 Sep 2021 27th Aug 2021
Control Flow 2 - Pattern Matching 100% 100% - 20th Sep 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 100% 100% - 29th Mar 2022 13th Jul 2022 27th May 2022
Const Generics 100% 100% - 30th May 2022 10th Oct 2022 17th Oct 2022
Initial upstream patches 100% 100% - 10th Oct 2022 13th Nov 2022 13th Nov 2022
Upstream initial patchset 100% 100% - 13th Nov 2022 13th Dec 2022 19th Dec 2022
Update GCC’s master branch 100% 100% - 1st Jan 2023 21st Feb 2023 3rd Mar 2023
Final set of upstream patches 100% 100% - 16th Nov 2022 1st May 2023 30th Apr 2023
Borrow Checking 1 0% 0% - TBD - 15th Aug 2023
AST Pipeline for libcore 1.49 75% 78% +3% 13th Apr 2023 - 1st Jul 2023
HIR Pipeline for libcore 1.49 67% 67% - 13th Apr 2023 - TBD
Procedural Macros 1 70% 100% +30% 13th Apr 2023 - 6th Aug 2023
GCC 13.2 Release 100% 100% - 13th Apr 2023 22nd Jul 2023 15th Jul 2023
GCC 14 Stage 3 0% 0% - TBD - 1st Nov 2023
core 1.49 functionality [AST] 0% 4% +4% 1st Jul 2023 - 1st Nov 2023
Rustc Testsuite Prerequisistes 0% 0% - TBD - 1st Sep 2023
Intrinsics and builtins 18% 18% - 6th Sep 2022 - TBD
Const Generics 2 0% 0% - TBD - TBD
Rust-for-Linux compilation 0% 0% - TBD - TBD

Testing project

Testsuite Compiler Last month This month Success delta
rustc testsuite gccrs -fsyntax-only 92.6% 92.7% +0.1%
gccrs testsuite rustc stable 59.2% 59.2% -
rustc testsuite passing tests gccrs 14.0% 14.0% -
rustc testsuite (nostd) gccrs 27.5% 27.5% -
rustc testsuite (nocore) gccrs 3.8% 3.8% -
blake3 gccrs 25.0% 25.0% -
libcore gccrs 0% 0% -

Planned Activities

Detailed changelog