GCC Rust Weekly Status Report 21

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

Milestone Progress

This week my focus has been on the trait resolver; this will be the building block for the traits milestone. We can use it when we have a TraitImplBlock to enforce the impl conforms to the trait correctly. Still, more importantly, when we have a TypeBound specified, we can use this to resolve the trait (find it), then we must correctly select the correct one concerning the type we are bounding. There are some more minor things to finish this week before we can close out the relevant tickets the PR affected, so I expect to see more milestone progress over the next two weeks when tickets get closed.

Google Summer of Code

Great progress for both students, thanks for all your hard work.

Cargo Support

Arthur Cohen has continued his focus on making this project highly maintainable which includes full integration testing with Github automation which uses the docker-image from the compiler project to invoke it directly. Aside from project maintainability, he has also extended it to support taking environment variable flags to add extra arguments for AR_EXTRA_ARGS or GCCRS_EXTRA_ARGS.

Static Analysis

Wenzhang Yang has got the DeadCode scan pass to a good level where it can be easily extended now. I have always liked to encourage people to get code in early in small building blocks, but now that this pass is getting more mature its time to focus on documentation, readability and error handling, these concepts will enforce good behaviour going forward since we already have a testing framework in place.

Detailed changelog

Handle doc comments

Our parser failed to handle inner and outer doc comments which is now fixed and example is below.

// comment line not a doc
/* comment block not a doc                   */

//! inner line comment for most outer crate
/*! inner block comment for most outer crate */

// comment line not a doc
/* comment block not a doc                   */

/// outer doc line for module
/** outer doc block for module               */
pub mod module
{
  //!  inner line doc
  //!! inner line doc!
  /*!  inner block doc  */
  /*!! inner block doc! */

  //   line comment
  ///  outer line doc
  //// line comment

  /*   block comment   */
  /**  outer block doc */
  /*** block comment   */

  mod block_doc_comments
  {
    /*   /* */  /** */  /*! */  */
    /*!  /* */  /** */  /*! */  */
    /**  /* */  /** */  /*! */  */
    mod item { }
  }

  pub mod empty
  {
    //!
    /*!*/
    //

    ///
    mod doc { }
    /**/
    /***/
  }
}

Initial support for Associated Types

As mentioned I have been working on the Trait resolver which includes associated types. This is the first-pass of initial support for associated types so we can handle code like this.

trait Foo {
    type A;
    type B;

    fn new(a: Self::A, b: Self::B) -> Self;
}

struct Baz(i32, f32);

impl Foo for Baz {
    type A = i32;
    type B = f32;

    fn new(a: Self::A, b: f32) -> Self {
        Baz(a, b)
    }
}

fn main() {
    Baz::new(123, 456f32);
}

Currently, the associated types are using a placeholder type which must be updated in order to ensure the other trait items fully conform to the trait properly. Such that they definitely reference the Self::A type. In Rust, you can reference the associated type by using the TypePath of Self::A or you can simply use the actual type which complicates ensuring the trait conforms properly, at the moment if you use the wrong type the compiler ignores and thinks its ok, this last piece needs to be done before this ticket can be completed.

Completed Activities

  • Add some documentation to DeadCode scan PR560 PR559
  • Improve error handling in DeadCode scan PR558 PR555
  • Cleanup warning messages in DeadCode scan PR554
  • Support shebang and UTF-8 BOM parsing PR546 PR552
  • Initial building blocks for Associated Types and Constants PR551
  • Fix bug in GIMPLE naming for primitive types PR548
  • Cargo GCCRS cleanup CARGO-PR38 CARGO-PR33
  • Support environment variable flags in cargo CARGO-PR32
  • Support doc comments PR561

Contributors this Week

Overall Task Status

CategoryLast WeekThis WeekDelta
TODO8688+2
In Progress77
Completed157163+6
GitHub Issues

Test Cases

CategoryLast WeekThis WeekDelta
Passing30273202+175
XFAIL1515
make check-rust

Bugs

CategoryLast WeekThis WeekDelta
TODO1920+1
In Progress43-1
Completed5153+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 – Traits40%43%+3%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 assignments224Be up front on all PRs that the code is destined to be upstreamed to FSF
Rust Language Changes3721Keep up to date with the Rust language on a regular basis

Planned Activities

  • Fix enforcement of trait items with associated types
  • Continue TraitBounds work

Leave a Reply

Your email address will not be published.