Return to search

A Large-Scale Analysis of Borrow Patterns Used Inside Rust's Open-Source Ecosystem / En storskalig analys av lånemönster använda inom Rusts ekosystem av öppen källkod

Rust has gained traction in the technical community as a safe system programming language. A unique feature of Rust is the memory ownership model, which enforces memory safety at compile-time. This project investigated how the memory model is used in practice. This report defines patterns that categorize the usage of variables with owned values in Rust. An automated analysis was used to scan over 3 million function bodies with over 7 million owned variables from 8 951 open-source projects. The analysis indicates that only 18% of all owned variables are borrowed at one point. In fact, only 61% of all analyzed function bodies contained at least one borrow. The data indicates that owned values are either mutable or immutably borrowed, only 0.6% of the analyzed variables had both borrow kinds in the same scope. Another interesting observation is that most values are moved instead of dropped at the end of their scope.

Identiferoai:union.ndltd.org:UPSALLA1/oai:DiVA.org:uu-532329
Date January 2024
CreatorsStoldt, Fridtjof Peer
PublisherUppsala universitet, Institutionen för informationsteknologi
Source SetsDiVA Archive at Upsalla University
LanguageEnglish
Detected LanguageEnglish
TypeStudent thesis, info:eu-repo/semantics/bachelorThesis, text
Formatapplication/pdf
Rightsinfo:eu-repo/semantics/openAccess
RelationIT ; IT mDV 24 011

Page generated in 0.0016 seconds