MétaCan
Menu
Back to cohort
Record W3109383821 · doi:10.1145/3428204

How do programmers use unsafe rust?

2020· article· en· W3109383821 on OpenAlexaff
Vytautas Astrauskas, Christoph Matheja, Federico Poli, Péter Müller, Alexander J. Summers

Bibliographic record

VenueProceedings of the ACM on Programming Languages · 2020
Typearticle
Languageen
FieldComputer Science
TopicDistributed systems and fault tolerance
Canadian institutionsUniversity of British Columbia
FundersSchweizerischer Nationalfonds zur Förderung der Wissenschaftlichen ForschungNational Science Foundation
KeywordsRust (programming language)Computer scienceProgrammerCompilerMemory safetyProgramming languageCode (set theory)Source codeAbstraction

Abstract

fetched live from OpenAlex

Rust’s ownership type system enforces a strict discipline on how memory locations are accessed and shared. This discipline allows the compiler to statically prevent memory errors, data races, inadvertent side effects through aliasing, and other errors that frequently occur in conventional imperative programs. However, the restrictions imposed by Rust’s type system make it difficult or impossible to implement certain designs, such as data structures that require aliasing (e.g. doubly-linked lists and shared caches). To work around this limitation, Rust allows code blocks to be declared as unsafe and thereby exempted from certain restrictions of the type system, for instance, to manipulate C-style raw pointers. Ensuring the safety of unsafe code is the responsibility of the programmer. However, an important assumption of the Rust language, which we dub the Rust hypothesis , is that programmers use Rust by following three main principles: use unsafe code sparingly, make it easy to review, and hide it behind a safe abstraction such that client code can be written in safe Rust. Understanding how Rust programmers use unsafe code and, in particular, whether the Rust hypothesis holds is essential for Rust developers and testers, language and library designers, as well as tool developers. This paper studies empirically how unsafe code is used in practice by analysing a large corpus of Rust projects to assess the validity of the Rust hypothesis and to classify the purpose of unsafe code. We identify queries that can be answered by automatically inspecting the program’s source code, its intermediate representation MIR, as well as type information provided by the Rust compiler; we complement the results by manual code inspection. Our study supports the Rust hypothesis partially: While most unsafe code is simple and well-encapsulated, unsafe features are used extensively, especially for interoperability with other languages.

Fetched live from OpenAlex and de-inverted. Abstracts are not stored in this database: the inverted indexes are 8.6 GB of the frame’s 9.3 GB of text, and the host has 13 GB free.

How this classification was reachedexpand

Full frame machine prediction

Teacher imitation

Not calibrated prevalence, not ground truth. Human validation pending. The Gemma side is a direct model label for every work in the frame, read from the title-only record. The Codex side is a classifier learned from the 10,348 direct Codex labels and calibrated to design-weighted sample rates; fields without enough sample support carry no Codex call. Candidate is the union of the two sides; consensus is their intersection. These outputs are machine_predicted_unvalidated and are not human labels.

metaresearch head score (Codex)0.011
metaresearch head score (Gemma)0.107
Version: metacan-v3-hybrid-931329e0061cValidation status: machine_predicted_unvalidated
Candidate categoriesnone
Consensus categoriesnone
DomainCandidate signal: none · Consensus signal: none
Study designCandidate signal: Observational · Consensus signal: none
GenreCandidate signal: Empirical · Consensus signal: Empirical
Teacher disagreement score0.011
Threshold uncertainty score0.056

Distilled classifier scores by category (both heads)

CategoryCodexGemma
Metaresearch0.0110.107
Meta-epidemiology (narrow)0.0000.001
Meta-epidemiology (broad)0.0000.000
Bibliometrics0.0040.004
Science and technology studies0.0020.006
Scholarly communication0.0040.010
Open science0.0010.003
Research integrity0.0020.002
Insufficient payload (model declined to judge)0.0020.002

Machine scores (provisional)

The two teacher heads of the student model, read on this work. A score orders the frame for review; it never asserts a category, and the validation status ships verbatim with every row.

Baseline scores from an immature model (maturity gate not passed, 7 training rounds). Scores rank; they never assert a category.

Opus teacher head0.028
GPT teacher head0.246
Teacher spread0.218 · how far apart the two teachers sit on this one work
Validation statusscore_only:v0-immature-baseline · verbatim from the scoring run: score_only means the number may rank works, and no category label ships from it

Classification

machine, unvalidated

Machine predicted; a candidate call from one source (direct Gemma or distilled Codex), not a consensus.

The models applied no category: nothing in the taxonomy fit this work.
Study designObservational
Domainnot available
GenreEmpirical

How this classification was reached, model by model and score by score, is at the end of the page under "How this classification was reached".

Quick stats

Citations75
Published2020
Admission routes1
Has abstractyes

Explore more

Same venueProceedings of the ACM on Programming LanguagesSame topicDistributed systems and fault toleranceFrench-language works237,207