GCC Rust Weekly Status Report 38

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

Milestone Progress

Last week’s focus was finishing config expansion as much of this code had already been in place and needed to be tidied together to complete it. We merged support for the predicates of any, not, and all and ensured the rest of the crate strips the nodes accordingly. Now that this is in place, we can move onto macros, which can interact with cfg-expansion for example, derive macros on structures with some fields marked for strip.

The community was busy this week and set up our front-end with the GCC self-test unit-testing framework, which is critical in helping make the front-end code cleaner by decoupling components, making them unit-testable. Sometimes it’s more accessible to unit-test code than make full dejagnu test cases. For example, our HIR graph is missing some location info on some nodes. Thanks to new contributions, this has continued to improve over time; location info is the driving force to enable debugging support for the resultant binaries.

Monthly Community Call

We had our regular community call on Feb 4th 2022 you can find the meeting notes over here: https://github.com/Rust-GCC/Reporting/blob/main/2022-02-04-community-call.md

Completed Activities

  • Bug Fix canonical-path of impl blocks nested under modules PR900
  • Bug Fix enum discriminant values to use constexpr code PR902
  • Apply cfg expansion to the rest of the crate PR904
  • Track canonical-path and location into as part of the type-check pass PR903
  • Apply .c to .cc rename as part of merge from upstream PR906
  • Support any,not,all predicates in cfg-expansion PR907
  • Enable GCC self-test framework PR751
  • Fix diagnostic formatting issues -Wformat-diag PR908
  • Improve location info on match-arms PR888
  • Support key value pairs being passed in -frust-cfg PR909

Contributors this Week

Overall Task Status

CategoryLast WeekThis WeekDelta
TODO100106+6
In Progress1911-8
Completed270279+9
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
Passing56055686+81
Failed
XFAIL2121
XPASS
make check-rust

Bugs

CategoryLast WeekThis WeekDelta
TODO3438+4
In Progress61-5
Completed101105+4
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 202129th Nov 2021
Macros and cfg expansion18%45%+27%1st Dec 202128th Mar 2022
Imports and Visibility0%0%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 dates3515Maintain status reports and issue tracking to stakeholders

Planned Activities

  • Test target host cfg options
  • Begin work on macros
  • Add more good-first-pr issues with guides

Detailed changelog

Canonical-paths

We have improved our canonical-path tracking so that we can build up paths for the legacy mangling scheme. So for example impl blocks nested under modules are given a prefix of impl in their path.

struct Foo(i32);

mod A {
    impl Foo {
        fn test(&self) -> i32 {
            self.0
        }
    }
}

fn test() {
    let a = Foo(123);
    let b:i32 = a.test();
}

As you can see we have the crate-name of example -> structure A -> impl block for example::A -> function name test.

i32 example::A::<impl example::Foo>::test (const struct example::Foo & const self)
{
  i32 D.85;

  D.85 = self->0;
  return D.85;
}


void example::test ()
{
  const struct example::Foo a;
  const i32 b;

  try
    {
      a.0 = 123;
      b = example::A::<impl example::Foo>::test (&a);
    }
  finally
    {
      a = {CLOBBER};
    }
}

see: https://godbolt.org/z/P94an5f5W

cfg expansion with predicates

We added support for any, all and not predicates on cfg expansions so in this example this ensures that both A and B are specified for the all predicate.

struct Foo;
impl Foo {
    #[cfg(all(A, B))]
    fn test(&self) {}
}

fn main() {
    let a = Foo;
    a.test();
}

see: https://godbolt.org/z/sW9K19EqE

Key-value cfg-expansion

Rust allows us to specify key-value pairs for config expansion this is mostly associated with host/os/cpu options such as os = “linux” for example but here is an example below you can try in compiler explorer.

struct Foo;
impl Foo {
    #[cfg(A = "B")]
    fn test(&self) {}
}

fn main() {
    let a = Foo;
    a.test();
}

see: https://godbolt.org/z/7YT1jMMMz

Leave a Reply

Your email address will not be published.