## Overview
Thanks again to [Open Source Security, inc](https://opensrcsec.com/) and [Embecosm](https://www.embecosm.com/) for their ongoing support for this project. ### Project update Our two GSoC students are progressing nicely on their projects and are both ahead of schedule. Zhi Heng's work is allowing us to handle some complex pattern matches present in `core`, which the compiler would previously ignore - while Ryutaro's contributions are adding more complex warning checkers while removing previous false positives. Thanks to them, the compiler is getting more correct, and gets closer and closer to real Rust code. Speaking of this, this month marks an important milestone for `gccrs`: One of our earliest "real-code" milestone was an implementation of `SipHash` as is present in `core`: [Link](https://github.com/rust-lang/rust/blob/1.60.0/library/core/src/hash/sip.rs). This algorithm relies on an important amount of code from `core`, and we have been trying to compile it for [multiple years](https://github.com/Rust-GCC/gccrs/issues/1247). With Philip's recent work on fixing typechecker issues, the module now works and is being compiled properly. Overall, our progress on `core` is great and things are moving fast. We have completed the two milestones mentioned in last month's report, `try` blocks and `while-let` loops, which allows us to continue moving forward with `core`. We have also completed the work package on the `offset_of!()` builtin macro, which marks our first Rust-for-Linux specific feature - as the macro does not exist in the Rust 1.49 standard library. This means that our goal of experimenting with compiling the kernel at the end of the summer is on track. 1. try blocks The desugar for `try` blocks is interesting as it ties in with the desugar for the `?` operator to prevent an early return from the enclosing function instead of the current block. In Rust 1.49, the common desugar for the `?` operator is as follows: ``` rust fn foo() -> Result<i32, ()> { let a = bar()?; Ok(15i32); } // becomes fn foo() -> Result<i32, ()> { let a = match Try::into_result(bar()) { Ok(value) => value, Err(err) => return Try::from_err(From::from(err)), }; Ok(15i32); } ``` As explained in last month's report, the desugar for `try` blocks is as follows: ``` rust try { <stmts>; <expr> } // becomes { <stmts>; ::std::ops::Try::from_ok(<expr>) } ``` However, if we desugar the `?` operator inside of a `try` block… ``` rust fn foo() -> Result<i32, ()> { let a: Result<i32, ()> = try { bar()?; 14i32 }; a } // becomes fn foo() -> Result<i32, ()> { let a: Result<i32, ()> = { match Try::into_result(bar()) { Ok(value) => value, Err(err) => return Try::from_err(From::from(err)), }; Try::from_ok(14i32) } Ok(15i32); } ``` …we can easily see how this would cause an early return from the function instead of the block, should the `bar` function call return an error. This is not the desired behavior, so the desugar must be able to handle short-circuiting from the enclosing `try` block instead. ``` rust // expected desugar fn foo() -> Result<i32, ()> { let a: Result<i32, ()> = 'try_label { match Try::into_result(bar()) { Ok(value) => value, Err(err) => { break 'try_label Try::from_err(From::from(err)); } }; Try::from_ok(14i32) } Ok(15i32); } ``` We cannot yet handle this "complex" desugar, which would require some changes to our desugaring infrastructure to keep some context when desugaring the `?` operator. However, **all** of the `try` blocks in `core` 1.49 only use the simple form of `try { <expr> }`, which makes our job easier! ### Community call We will have our next monthly community call on the 11th of August at 9am UTC. 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](https://gcc.gnu.org/mailman/listinfo/gcc-rust) or join our [Zulip chat](https://gcc-rust.zulipchat.com) to be notified of upcoming events. - [Jitsi link](https://meet.jit.si/gccrs-community-call-august) - Calendar ID:7060a0923ffebd3cb52b1afef35a28ff7b64f05962c9af84c23b1847f1f5f...@group.calendar.google.com
- [Google calendarlink](https://calendar.google.com/calendar/embed?src=7060a0923ffebd3cb52b1afef35a28ff7b64f05962c9af84c23b1847f1f5f894%40group.calendar.google.com)
- [iCallink](https://calendar.google.com/calendar/ical/7060a0923ffebd3cb52b1afef35a28ff7b64f05962c9af84c23b1847f1f5f894%40group.calendar.google.com/public/basic.ics)
## Call for contribution - <https://github.com/Rust-GCC/gccrs/issues/2500> - <https://github.com/Rust-GCC/gccrs/issues/2376> ## Completed Activities - Fix object copying issue causing pointer inconsistency [PR4038](https://github.com/rust-gcc/gccrs/pull/4038) - Avoid including `rust-parse-impl.h` in `rust-parse.h` [PR4037](https://github.com/rust-gcc/gccrs/pull/4037) - Catch parse failure in `parse_path_meta_item` [PR4036](https://github.com/rust-gcc/gccrs/pull/4036) - gccrs: Add test case showing method resolution with const-generics [PR4035](https://github.com/rust-gcc/gccrs/pull/4035) - gccrs: Remove more calls to the old TyTy::BaseType::can_eq interface [PR4034](https://github.com/rust-gcc/gccrs/pull/4034) - gccrs: Ensure we track the const generic substitution on the param mappings [PR4033](https://github.com/rust-gcc/gccrs/pull/4033) - Fix uninitialized data in default constructors [PR4032](https://github.com/rust-gcc/gccrs/pull/4032) - Retrieve token stream before vector move [PR4030](https://github.com/rust-gcc/gccrs/pull/4030) - gccrs: Fix ICE during const eval of const capacity [PR4026](https://github.com/rust-gcc/gccrs/pull/4026) - Add initial support for const generics [PR4025](https://github.com/rust-gcc/gccrs/pull/4025) - Remove warning for unused self parameter [PR4024](https://github.com/rust-gcc/gccrs/pull/4024) - Fix AttrInputMacro operator= overloading. [PR4023](https://github.com/rust-gcc/gccrs/pull/4023) - Add offset_of!() evaluation [PR4021](https://github.com/rust-gcc/gccrs/pull/4021) - Error message field member was not properly updated [PR4019](https://github.com/rust-gcc/gccrs/pull/4019) - gccrs: Add rest pattern support for AST::SlicePattern [PR4017](https://github.com/rust-gcc/gccrs/pull/4017) - Parse expression instead of literal in attributes [PR4016](https://github.com/rust-gcc/gccrs/pull/4016) - Fix infinite loop with missing comma [PR4015](https://github.com/rust-gcc/gccrs/pull/4015) - Fix semicolon after some namespace [PR4013](https://github.com/rust-gcc/gccrs/pull/4013) - Inline assembly expressions [PR4012](https://github.com/rust-gcc/gccrs/pull/4012) - nr1.0: Remove `rust/typecheck` support [PR4011](https://github.com/rust-gcc/gccrs/pull/4011) - Add HIR::OffsetOf node [PR4010](https://github.com/rust-gcc/gccrs/pull/4010) - Add OffsetOf AST node and offset_of!() parsing [PR4005](https://github.com/rust-gcc/gccrs/pull/4005) - Desugar while-let loops [PR4000](https://github.com/rust-gcc/gccrs/pull/4000) - Dispatch for-loop desugar properly [PR3999](https://github.com/rust-gcc/gccrs/pull/3999) - gccrs: Implement compilation for SlicePattern matching against SliceType scrutinee [PR3998](https://github.com/rust-gcc/gccrs/pull/3998) - Handle easy try-block desugar [PR3997](https://github.com/rust-gcc/gccrs/pull/3997) - Handle `IfLetExprConseqElse` in `DefaultResolver` [PR3996](https://github.com/rust-gcc/gccrs/pull/3996) - desugar: Add desugar dispatch for all desugars [PR3994](https://github.com/rust-gcc/gccrs/pull/3994) - ast: Visit block labels if they are present [PR3993](https://github.com/rust-gcc/gccrs/pull/3993) - gccrs: fix bad monomophization of generic paths - GOAL TEST CASE SIP HASHER WORKS! [PR3992](https://github.com/rust-gcc/gccrs/pull/3992) - Specialize `ExpandVisitor::expand_macro_children` [PR3989](https://github.com/rust-gcc/gccrs/pull/3989) - gccrs: return error node when this fails during constexpr case [PR3988](https://github.com/rust-gcc/gccrs/pull/3988) - gccrs: Fix ICE with duplicate root item main function [PR3987](https://github.com/rust-gcc/gccrs/pull/3987) - gccrs: Add test case to show issue is fixed [PR3986](https://github.com/rust-gcc/gccrs/pull/3986) - gccrs: Add initial support for deffered operator overload resolution [PR3985](https://github.com/rust-gcc/gccrs/pull/3985) - gccrs: Implement compilation for SlicePattern matching against ArrayType scrutinee [PR3981](https://github.com/rust-gcc/gccrs/pull/3981) - gccrs: Reject loop in const/static context [PR3980](https://github.com/rust-gcc/gccrs/pull/3980) - Improve parsing of simple paths [PR3979](https://github.com/rust-gcc/gccrs/pull/3979) - gccrs: Add size checking to SlicePattern [PR3913](https://github.com/rust-gcc/gccrs/pull/3913) - gccrs: Add test case showing all derives working on enum [PR3912](https://github.com/rust-gcc/gccrs/pull/3912) - gccrs: Add test case to show issue is fixed [PR3911](https://github.com/rust-gcc/gccrs/pull/3911) - gccrs: Add test case to show we emit better errors now [PR3909](https://github.com/rust-gcc/gccrs/pull/3909) - gccrs: add test case to show issue is fixed [PR3907](https://github.com/rust-gcc/gccrs/pull/3907) - gccrs: Fix ICE when handling bad constructor [PR3901](https://github.com/rust-gcc/gccrs/pull/3901) - gccrs: Fix cast rules logic to try simple casts then fall back to coercions [PR3900](https://github.com/rust-gcc/gccrs/pull/3900) - gccrs: Fix bad bounds checking for PartialOrd [PR3899](https://github.com/rust-gcc/gccrs/pull/3899) - nr2.0: Check before visiting a for-loop's label [PR3895](https://github.com/rust-gcc/gccrs/pull/3895) - Resolve enum glob imports [PR3894](https://github.com/rust-gcc/gccrs/pull/3894) - gccrs: Fix ice with invalid borrow expression [PR3891](https://github.com/rust-gcc/gccrs/pull/3891) - Use `MacroInvocLexer` in `AttributeParser` [PR3890](https://github.com/rust-gcc/gccrs/pull/3890) - gccrs: Do proper const folding during typechecking for array capacities [PR3889](https://github.com/rust-gcc/gccrs/pull/3889) - Fix narrowing of Loan (size_t) into LoanId (uint32) [PR3888](https://github.com/rust-gcc/gccrs/pull/3888) - Basic SlicePattern type checking [PR3887](https://github.com/rust-gcc/gccrs/pull/3887) - Parse deferred const generics [PR3886](https://github.com/rust-gcc/gccrs/pull/3886) - attributes: Add \#\[test\] and \#\[simd_test\] [PR3884](https://github.com/rust-gcc/gccrs/pull/3884) - Change enum to enum class [PR3878](https://github.com/rust-gcc/gccrs/pull/3878) - Remove `Late` visitor override for `StructStruct` [PR3873](https://github.com/rust-gcc/gccrs/pull/3873) - Allow `format_args` to accept a raw string literal [PR3872](https://github.com/rust-gcc/gccrs/pull/3872) - Load modules during `CfgStrip` phase [PR3871](https://github.com/rust-gcc/gccrs/pull/3871) - Parse try expressions [PR3870](https://github.com/rust-gcc/gccrs/pull/3870) - Remove `reinterpret_cast` usages in `DefaultASTVisitor` [PR3869](https://github.com/rust-gcc/gccrs/pull/3869) - Sync with upstream 0d52a736a3856871761c89fefa59c2ff39f3a5f8 [PR3860](https://github.com/rust-gcc/gccrs/pull/3860) - ast: Check before visiting a while-let's label [PR3797](https://github.com/rust-gcc/gccrs/pull/3797) ### Contributors this month - [Zhi Heng](https://github.com/Polygonalr) - [Ryutaro Okada](https://github.com/sakupan102) - [Lishin](https://github.com/Lishin1215) - [Marc Poulhiès](https://github.com/dkm) - [Owen Avery](https://github.com/powerboat9) - [Pierre-Emmanuel Patry](https://github.com/P-E-P) - [Philip Herron](https://github.com/philberty) - [Arthur Cohen](https://github.com/CohenArthur) ### Overall Task Status | Category | Last Month | This Month | Delta | |-------------|------------|------------|-------| | TODO | 469 | 517 | +48 | | In Progress | 112 | 109 | -3 | | Completed | 1077 | 1114 | +37 | ### Bugs | Category | Last Month | This Month | Delta | |-------------|------------|------------|-------| | TODO | 207 | 207 | \- | | In Progress | 54 | 54 | -2 | | Completed | 526 | 526 | +5 | ### Test Cases | TestCases | Last Month | This Month | Delta | |-----------|------------|------------|-------| | Passing | 9949 | 10089 | +140 | | Failed | \- | \- | \- | | XFAIL | 64 | 64 | \- | | XPASS | \- | \- | \- | ### Milestones Progress| Milestone | Last Month | This Month | Delta | Start Date | Completion Date | Target | Target GCC |
|--------------------------------------|------------|------------|-------|---------------|-----------------|---------------|------------|| Explicit generics with impl Trait | 85% | 100% | \- | 28th Feb 2025 | 21st Jul 2025 | 28th Mar 2025 | GCC 16.1 |
| Final Inline assembly fixes | 0% | 65% | +65% | | \- | | GCC 16.1 |
| try blocks | 0% | 100% | +100% | | 30th Jul 2025 | | GCC 16.1 |
| while-let loops | 0% | 100% | +100% | | 30th Jul 2025 | | GCC 16.1 |
| offset_of!() builtin macro | 0% | 100% | +100% | 15th Mar 2025 | 4th Aug 2025 | 15th Aug 2025 | GCC 16.1 |
| Upcoming Milestone | Last Month | This Month | Delta | Start Date | Completion Date | Target | Target GCC |
|-------------------------------|------------|------------|-------|---------------|-----------------|---------------|------------|| Unstable RfL features | 0% | 0% | \- | 7th Jan 2025 | \- | 1st Aug 2025 | GCC 16.1 |
| Generic Associated Types | 0% | 0% | \- | 15th Mar 2025 | \- | 15th Jun 2025 | GCC 16.1 |
| RfL const generics | 0% | 0% | \- | 1st May 2025 | \- | 15th Jun 2025 | GCC 16.1 |
| frontend plugin hooks | 0% | 0% | \- | 15th May 2025 | \- | 7th Jul 2025 | GCC 16.1 |
| Handling the testsuite issues | 0% | 0% | \- | 15th Sep 2024 | \- | 15th Sep 2025 | GCC 16.1 |
| main shim | 0% | 0% | \- | 28th Jul 2025 | \- | 15th Sep 2025 | GCC 16.1 |
| Final core attributes | 0% | 0% | \- | | \- | | GCC 16.1 |
| Core nightly features | 0% | 0% | \- | | \- | | GCC 16.1 |
| Defered inference | 0% | 0% | \- | | \- | | GCC 16.1 |
| Fn traits fixes | 0% | 0% | \- | | \- | | GCC 16.1 |
| Recursive types | 0% | 0% | \- | | \- | | GCC 16.1 |
| Drop | 0% | 0% | \- | | \- | | GCC 16.1 |
| Pin, PinInit | 0% | 0% | \- | | \- | | GCC 16.1 |
| Past Milestone | Last Month | This Month | Delta | Start Date | Completion Date | Target | Target GCC |
|-----------------------------------|------------|------------|-------|---------------|-----------------|---------------|------------|| Data Structures 1 - Core | 100% | 100% | \- | 30th Nov 2020 | 27th Jan 2021 | 29th Jan 2021 | GCC 14.1 |
| Control Flow 1 - Core | 100% | 100% | \- | 28th Jan 2021 | 10th Feb 2021 | 26th Feb 2021 | GCC 14.1 |
| Data Structures 2 - Generics | 100% | 100% | \- | 11th Feb 2021 | 14th May 2021 | 28th May 2021 | GCC 14.1 |
| Data Structures 3 - Traits | 100% | 100% | \- | 20th May 2021 | 17th Sep 2021 | 27th Aug 2021 | GCC 14.1 |
| Control Flow 2 - Pattern Matching | 100% | 100% | \- | 20th Sep 2021 | 9th Dec 2021 | 29th Nov 2021 | GCC 14.1 |
| Macros and cfg expansion | 100% | 100% | \- | 1st Dec 2021 | 31st Mar 2022 | 28th Mar 2022 | GCC 14.1 |
| Imports and Visibility | 100% | 100% | \- | 29th Mar 2022 | 13th Jul 2022 | 27th May 2022 | GCC 14.1 |
| Const Generics | 100% | 100% | \- | 30th May 2022 | 10th Oct 2022 | 17th Oct 2022 | GCC 14.1 |
| Initial upstream patches | 100% | 100% | \- | 10th Oct 2022 | 13th Nov 2022 | 13th Nov 2022 | GCC 14.1 |
| Upstream initial patchset | 100% | 100% | \- | 13th Nov 2022 | 13th Dec 2022 | 19th Dec 2022 | GCC 14.1 |
| Update GCC's master branch | 100% | 100% | \- | 1st Jan 2023 | 21st Feb 2023 | 3rd Mar 2023 | GCC 14.1 |
| Final set of upstream patches | 100% | 100% | \- | 16th Nov 2022 | 1st May 2023 | 30th Apr 2023 | GCC 14.1 |
| Borrow Checking 1 | 100% | 100% | \- | TBD | 8th Jan 2024 | 15th Aug 2023 | GCC 14.1 |
| Procedural Macros 1 | 100% | 100% | \- | 13th Apr 2023 | 6th Aug 2023 | 6th Aug 2023 | GCC 14.1 |
| GCC 13.2 Release | 100% | 100% | \- | 13th Apr 2023 | 22nd Jul 2023 | 15th Jul 2023 | GCC 14.1 |
| GCC 14 Stage 3 | 100% | 100% | \- | 1st Sep 2023 | 20th Sep 2023 | 1st Nov 2023 | GCC 14.1 |
| GCC 14.1 Release | 100% | 100% | \- | 2nd Jan 2024 | 2nd Jun 2024 | 15th Apr 2024 | GCC 14.1 |
| format_args!() support | 100% | 100% | \- | 15th Feb 2024 | \- | 1st Apr 2024 | GCC 14.1 |
| GCC 14.2 | 100% | 100% | \- | 7th Jun 2024 | 15th Jun 2024 | 15th Jun 2024 | GCC 14.2 |
| GCC 15.1 | 100% | 100% | \- | 21st Jun 2024 | 31st Jun 2024 | 1st Jul 2024 | GCC 15.1 |
| Unhandled attributes | 100% | 100% | \- | 1st Jul 2024 | 15th Aug 2024 | 15th Aug 2024 | GCC 15.1 |
| Inline assembly | 100% | 100% | \- | 1st Jun 2024 | 26th Aug 2024 | 15th Sep 2024 | GCC 15.1 |
| Rustc Testsuite Adaptor | 100% | 100% | \- | 1st Jun 2024 | 26th Aug 2024 | 15th Sep 2024 | GCC 15.1 |
| Borrow checker improvements | 100% | 100% | \- | 1st Jun 2024 | 26th Aug 2024 | 15th Sep 2024 | GCC 15.1 |
| Deref and DerefMut improvements | 100% | 100% | \- | 28th Sep 2024 | 25th Oct 2024 | 28th Dec 2024 | GCC 15.1 |
| Indexing fixes | 100% | 100% | \- | 21st Jul 2024 | 25th Dec 2024 | 15th Nov 2024 | GCC 15.1 |
| Iterator fixes | 100% | 100% | \- | 21st Jul 2024 | 25th Dec 2024 | 15th Nov 2024 | GCC 15.1 |
| Auto traits improvements | 100% | 100% | \- | 15th Sep 2024 | 20th Jan 2025 | 21st Dec 2024 | GCC 15.1 |
| Lang items | 100% | 100% | \- | 1st Jul 2024 | 10th Jan 2025 | 21st Nov 2024 | GCC 15.1 |
| alloc parser issues | 100% | 100% | \- | 7th Jan 2025 | 31st Jun 2024 | 28th Jan 2025 | GCC 15.1 |
| std parser issues | 100% | 100% | \- | 7th Jan 2025 | 31st Jun 2024 | 28th Jan 2025 | GCC 16.1 |
| Question mark operator | 100% | 100% | \- | 15th Dec 2024 | 21st Feb 2025 | 21st Feb 2025 | GCC 15.1 |
| Name resolution 2.0 rework | 100% | 100% | \- | 1st Jun 2024 | \- | 1st Apr 2025 | GCC 15.1 |
| Macro expansion | 100% | 100% | \- | 1st Jun 2024 | \- | 1st Jan 2025 | GCC 15.1 |
| Remaining typecheck issues | 100% | 100% | \- | 21st Oct 2024 | \- | 1st Mar 2025 | GCC 15.1 |
| cfg-core | 100% | 100% | \- | 1st Dec 2024 | 24th Mar 2025 | 1st Mar 2025 | GCC 15.1 |
| Codegen fixes | 100% | 100% | \- | 7th Oct 2024 | 1st Apr 2025 | 1st Mar 2025 | GCC 15.1 |
| black_box intrinsic | 100% | 100% | \- | 28th Oct 2024 | \- | 28th Jan 2025 | GCC 15.1 |
| let-else | 100% | 100% | \- | 28th Jan 2025 | \- | 28th Feb 2025 | GCC 15.1 |
| Specialization | 100% | 100% | \- | 1st Jan 2025 | 1st Apr 2025 | 1st Mar 2025 | GCC 15.1 |
| cfg-rfl | 100% | 100% | \- | 7th Jan 2025 | 19th Mar 2025 | 15th Feb 2025 | GCC 15.1 |
| Downgrade to Rust 1.49 | 100% | 100% | \- | 14th Mar 2025 | 26th Mar 2025 | 1st Apr 2025 | GCC 15.1 |
## Planned Activities - Start working on try blocks and while-let loops - Finish name resolution and macro expansion issues ### Risks We must establish the list of GCC-common changes we need, as we will have to send them upstream before the start of Stage 3 around November. This is the only risk which could incur further problems and prevent more gccrs features from landing in 16.1.
OpenPGP_0x1B3465B044AD9C65.asc
Description: OpenPGP public key
OpenPGP_signature.asc
Description: OpenPGP digital signature