GCC Rust Weekly Status Report 49

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

Milestone Progress

Once again, Philip spent a lot of time this week fixing various bugs in our type-system and generic resolution pass. We now have a cleaner, better interface with more functionality. We also gained back support for 32-bit architectures by being more careful of the various types and print formats used in our middle-end. You can see track builds on various architectures here, and we plan to add these badges to our CI soon. Thanks to bjorn3 trying to compile a version of the core library using gccrs and reporting bugs, we also fixed some nasty bugs caused by undefined behavior. We are currently adding libcore-1.49 as well as the BLAKE3 reference Rust implementation to our testing project and tracking our progress on these test cases. Thanks to our contributors, we are also gaining more pattern matching: David Faust has worked on adding integers and chars, as well as ranges of those values, to the list of supported features, while antego is currently working on supporting if let <pattern> constructs. We also gained our first visibility lint, reporting errors about private functions being used outside of their visibility scope. This gives us a good base on which to add more lints and errors.

Community Call

We had our regular community call on 13th May 2022, please find our meeting notes over on:

https://github.com/Rust-GCC/Reporting/blob/main/2022-05-13-community-call.md

Completed Activities

  • Lowe IfLet expression to HIR PR1218
  • Add optional<T> for development in C++11 PR1219
  • Apply coercion sites on unions PR1220
  • Don’t return error_mark_node on LoopExpr’s PR1221
  • Add destructure for generics on coercion sites PR1222
  • Fix bad type resolution for associated types PR1223
  • Fix macro expansion on repetitions PR1225
  • Fix tests on i386 PR1228
  • Bit shifts need to cast the types PR1240
  • Fix ICE in repition macro PR1242
  • Integers can be casted to pointers PR1243
  • Support match-expr on integers and chars PR1244
  • Add name-resolution on IfLet expression PR1241
  • Support reporting common privacy issues PR1246
  • Support Range expression in match-arms PR1248

Contributors this week

Overall Task Status

CategoryLast WeekThis WeekDelta
TODO133140+7
In Progress2424
Completed373379+6
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
Passing60886174+86
Failed
XFAIL2525
XPASS
make check-rust

Bugs

CategoryLast WeekThis WeekDelta
TODO4950+1
In Progress1313
Completed150156+6
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 – Traits100%100%20th May 202117th Sept 202127th Aug 2021
Control Flow 2 – Pattern Matching100%100%20th Sept 20219th Dec 202129th Nov 2021
Macros and cfg expansion100100%1st Dec 202131st Mar 202228th Mar 2022
Imports and Visibility52%62%+10%29th Mar 202227th May 2022
Const Generics0%0%30th May 202225th Jul 2022
Intrinsics0%0%6th Sept 202130th Sept 2022
GitHub Milestones

Risks

RiskImpact (1-3)Likelihood (0-10)Risk (I * L)Mitigation
Rust Language Changes3721Keep up to date with the Rust language on a regular basis
Going over target dates2510Maintain status reports and issue tracking to stakeholders

Planned Activities

  • Add more linting and restrictions to our privacy pass
  • Continue bugfixing in aim of compiling our goal test case
  • Continue work on metadata exports

Detailed changelog

Match Expression

Thanks to David Faust for adding more support in our Match expression so that we can now support matching integers, chars and reanges.

fn foo_u32 (x: u32) {
    match x {
        15 => {
            let a = "fifteen!\n\0";
            let b = a as *const str;
            let c = b as *const i8;
            printf (c);
        }

        _ => {
            let a = "other!\n\0";
            let b = a as *const str;
            let c = b as *const i8;
            printf (c);
        }
    }
}

const BIG_A: char = 'A';
const BIG_Z: char = 'Z';

fn bar (x: char) {
    match x {

        'a'..='z' => {
            let a = "lowercase\n\0";
            let b = a as *const str;
            let c = b as *const i8;
            printf (c);
        }
        BIG_A..=BIG_Z => {
            let a = "uppercase\n\0";
            let b = a as *const str;
            let c = b as *const i8;
            printf (c);
        }
        _ => {
            let a = "other\n\0";
            let b = a as *const str;
            let c = b as *const i8;
            printf (c);
        }
    }
}

More work is still to be done here to handle matching Tuples and ADT’s.

Bit shift operations cast

In rust arithmetic operations usually unify the types involved to resolve whats going on here. But bit shift operations are a special case where they actually cast their types.

fn foo() -> u8 {
    1u8 << 2u32
}

Support casting integers to pointers

In embeded programming we often need to turn raw addresses into pointers. This required us to update our casting rules to support this.

const TEST: *mut u8 = 123 as *mut u8;

fn test() {
    let a = TEST;
}

Privacy violations

All of the efforts regarding the privacy pass in the recent weeks have allowed us to have a solid privacy-reporting base. This will make it easy to report private items in public contexts, as well as have a variety of hints for good user experience.

This first implementation concerns functions and function calls.

mod orange {
    mod green {
        fn sain() {}
        pub fn doux() {}
    }

    fn brown() {
        green::sain(); // error: The function definition is private in this context
        green::doux();
    }
}

We also support pub(restricted) visibilities seamlessly thanks to the work done in the past few weeks regarding path resolution

mod foo {
    mod bar {
        pub(in foo) fn baz() {}
    }

    fn baz() {
        bar::baz(); // no error, foo::bar::baz is public in foo
    }
}

Leave a Reply

Your email address will not be published.