GSoC 2017 Project Summary

Summary

The goal of this project was to research the use of the Rust programming language in GJS to help reduce or eliminate memory leaks and increase memory safety, and where possible, implement it to do so.

What was Achieved?

A lot! However, this is subjective. In relation to actual code in GJS it was slow going - I did contribute some code, and have further contributions in the works (or done now), but the majority of my time was spent laying the groundwork for using Rust in GJS. This was certainly not wasted effort by any means, I ended up generating a fair amount of code (for other projects however), and gaining a much better understanding of GJS, Rust, C++, and how I could possibly rewrite from scratch, and introduce Rust-like safety in to GJS by use of unique_ptr and references. In this regard, the project was a success, and has gained a dedicated new contributor.

What I achieved:

  • working knowledge of how to use Cargo and the Rust compiler + options in Autotools
    • how to optimize Rust compilation (Federico Mena-Quintero found this helpful for librsvg)
  • contribution of code to gir to enable untagged Union support for using C unions
  • rewrite of gi-ffi code from the Gnome introspection library in Rust - this was required as the GIR for use with gir to generate the unsafe code did not have this exported
  • a back-port of some patches from my update of GJS to mozjs-55+
  • further use of GjsAutoChar in GJS (a wrapper for gchar to use unique_ptr) TODO submit patch
    • in progress - further expansion of use of unique_ptr to introduce rust-like safety

Results

Code

Blog

  1. Google Summer of Code 2017
  2. Autotools and Rust
  3. Goals and Update
  4. Rust, C, and Binding
  5. GSoC Update
  6. Shooting Your Foot in Rust
  7. Report 1
  8. Report 2
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################
###########################################################################################################################################################################