{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,11,10]],"date-time":"2026-11-10T17:52:51Z","timestamp":1794333171073,"version":"4.9.0"},"reference-count":33,"publisher":"Association for Computing Machinery (ACM)","issue":"POPL","license":[{"start":{"date-parts":[[2019,12,20]],"date-time":"2019-12-20T00:00:00Z","timestamp":1576800000000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"DOI":"10.13039\/501100007601","name":"Horizon 2020 Framework Programme","doi-asserted-by":"publisher","award":["683289"],"award-info":[{"award-number":["683289"]}],"id":[{"id":"10.13039\/501100007601","id-type":"DOI","asserted-by":"publisher"}]}],"content-domain":{"domain":["dl.acm.org"],"crossmark-restriction":true},"short-container-title":["Proc. ACM Program. Lang."],"published-print":{"date-parts":[[2020,1]]},"abstract":"<jats:p>Type systems are useful not just for the safety guarantees they provide, but also for helping compilers generate more efficient code by simplifying important program analyses. In Rust, the type system imposes a strict discipline on pointer aliasing, and it is an express goal of the Rust compiler developers to make use of that alias information for the purpose of program optimizations that reorder memory accesses. The problem is that Rust also supports unsafe code, and programmers can write unsafe code that bypasses the usual compiler checks to violate the aliasing discipline. To strike a balance between optimizations and unsafe code, the language needs to provide a set of rules such that unsafe code authors can be sure, if they are following these rules, that the compiler will preserve the semantics of their code despite all the optimizations it is doing.<\/jats:p>\n                  <jats:p>\n                    In this work, we propose\n                    <jats:italic>Stacked Borrows<\/jats:italic>\n                    , an operational semantics for memory accesses in Rust. Stacked Borrows defines an aliasing discipline and declares programs violating it to have\n                    <jats:italic>undefined behavior<\/jats:italic>\n                    , meaning the compiler does not have to consider such programs when performing optimizations. We give formal proofs (mechanized in Coq) showing that this rules out enough programs to enable optimizations that reorder memory accesses around unknown code and function calls, based solely on intraprocedural reasoning. We also implemented this operational model in an interpreter for Rust and ran large parts of the Rust standard library test suite in the interpreter to validate that the model permits enough real-world unsafe Rust code.\n                  <\/jats:p>","DOI":"10.1145\/3371109","type":"journal-article","created":{"date-parts":[[2019,12,20]],"date-time":"2019-12-20T14:45:25Z","timestamp":1576853125000},"page":"1-32","update-policy":"https:\/\/doi.org\/10.1145\/crossmark-policy","source":"Crossref","is-referenced-by-count":63,"title":["Stacked borrows: an aliasing model for Rust"],"prefix":"10.1145","volume":"4","author":[{"given":"Ralf","family":"Jung","sequence":"first","affiliation":[{"name":"MPI-SWS, Germany \/ Mozilla, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Hoang-Hai","family":"Dang","sequence":"additional","affiliation":[{"name":"MPI-SWS, Germany"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Jeehoon","family":"Kang","sequence":"additional","affiliation":[{"name":"KAIST, South Korea"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Derek","family":"Dreyer","sequence":"additional","affiliation":[{"name":"MPI-SWS, Germany"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2019,12,20]]},"reference":[{"key":"e_1_2_2_1_1","unstructured":"ANSI. 1978. Programming Language FORTRAN. ANSI X3.9-1978.  ANSI. 1978. Programming Language FORTRAN. ANSI X3.9-1978."},{"key":"e_1_2_2_2_1","unstructured":"Ulrich Drepper. 2007. Memory part 5: What programmers can do. LWN article. https:\/\/lwn.net\/Articles\/255364\/ .  Ulrich Drepper. 2007. Memory part 5: What programmers can do. LWN article. https:\/\/lwn.net\/Articles\/255364\/ ."},{"key":"e_1_2_2_3_1","unstructured":"Bruno De Fraine. 2014. Wrong results with union and strict-aliasing. LLVM issue #21725. https:\/\/bugs.llvm.org\/show_bug. cgi?id=21725 .  Bruno De Fraine. 2014. Wrong results with union and strict-aliasing. LLVM issue #21725. https:\/\/bugs.llvm.org\/show_bug. cgi?id=21725 ."},{"key":"e_1_2_2_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/378795.378806"},{"key":"e_1_2_2_5_1","unstructured":"Dan Gohman. 2015. Incorrect liveness in DeadStoreElimination. LLVM issue #25422. https:\/\/bugs.llvm.org\/show_bug.cgi? id=25422 .  Dan Gohman. 2015. Incorrect liveness in DeadStoreElimination. LLVM issue #25422. https:\/\/bugs.llvm.org\/show_bug.cgi? id=25422 ."},{"key":"e_1_2_2_6_1","doi-asserted-by":"publisher","DOI":"10.1145\/2737924.2737979"},{"key":"e_1_2_2_7_1","unstructured":"Dara Hazeghi. 2013. Store motion causes wrong code for union access at -O3. GCC issue #57359. https:\/\/gcc.gnu.org\/ bugzilla\/show_bug.cgi?id=57359 .  Dara Hazeghi. 2013. Store motion causes wrong code for union access at -O3. GCC issue #57359. https:\/\/gcc.gnu.org\/ bugzilla\/show_bug.cgi?id=57359 ."},{"key":"e_1_2_2_8_1","doi-asserted-by":"publisher","DOI":"10.1145\/239912.239913"},{"key":"e_1_2_2_9_1","doi-asserted-by":"publisher","DOI":"10.1145\/2103656.2103666"},{"key":"e_1_2_2_10_1","first-page":"2018","article-title":"C17 Standard","volume":"9899","author":"ISO.","year":"2017","unstructured":"ISO. 2017 . C17 Standard . ISO\/IEC 9899 : 2018 . ISO. 2017. C17 Standard. ISO\/IEC 9899:2018.","journal-title":"ISO\/IEC"},{"key":"e_1_2_2_11_1","unstructured":"Ralf Jung. 2018a. Fix futures creating aliasing mutable and shared ref. Rust pull request #56319. https:\/\/github.com\/rustlang\/rust\/pull\/56319 .  Ralf Jung. 2018a. Fix futures creating aliasing mutable and shared ref. Rust pull request #56319. https:\/\/github.com\/rustlang\/rust\/pull\/56319 ."},{"key":"e_1_2_2_12_1","unstructured":"Ralf Jung. 2018b. VecDeque: fix for stacked borrows. Rust pull request #56161. https:\/\/github.com\/rust-lang\/rust\/pull\/56161 .  Ralf Jung. 2018b. VecDeque: fix for stacked borrows. Rust pull request #56161. https:\/\/github.com\/rust-lang\/rust\/pull\/56161 ."},{"key":"e_1_2_2_13_1","unstructured":"Ralf Jung. 2019a. Fix LinkedList invalidating mutable references. Rust pull request #60072. https:\/\/github.com\/rustlang\/rust\/pull\/60072 .  Ralf Jung. 2019a. Fix LinkedList invalidating mutable references. Rust pull request #60072. https:\/\/github.com\/rustlang\/rust\/pull\/60072 ."},{"key":"e_1_2_2_14_1","unstructured":"Ralf Jung. 2019b. Fix overlapping references in BTree. Rust pull request #58431. https:\/\/github.com\/rust-lang\/rust\/pull\/58431 .  Ralf Jung. 2019b. Fix overlapping references in BTree. Rust pull request #58431. https:\/\/github.com\/rust-lang\/rust\/pull\/58431 ."},{"key":"e_1_2_2_15_1","unstructured":"Ralf Jung. 2019c. Fix str mutating through a ptr derived from &amp;self. Rust pull request #58200. https:\/\/github.com\/rustlang\/rust\/pull\/58200 .  Ralf Jung. 2019c. Fix str mutating through a ptr derived from &amp;self. Rust pull request #58200. https:\/\/github.com\/rustlang\/rust\/pull\/58200 ."},{"key":"e_1_2_2_16_1","unstructured":"Ralf Jung. 2019d. VecDeque\u2019s Drain::drop writes to memory that a shared reference points to. Rust issue #60076. https:\/\/github.com\/rust-lang\/rust\/issues\/60076 .  Ralf Jung. 2019d. VecDeque\u2019s Drain::drop writes to memory that a shared reference points to. Rust issue #60076. https:\/\/github.com\/rust-lang\/rust\/issues\/60076 ."},{"key":"e_1_2_2_17_1","unstructured":"Ralf Jung. 2019e. Vec::push invalidates interior references even when it does not reallocate. Rust issue #60847. https: \/\/github.com\/rust-lang\/rust\/issues\/60847 .  Ralf Jung. 2019e. Vec::push invalidates interior references even when it does not reallocate. Rust issue #60847. https: \/\/github.com\/rust-lang\/rust\/issues\/60847 ."},{"key":"e_1_2_2_18_1","doi-asserted-by":"publisher","DOI":"10.5281\/zenodo.3541779"},{"key":"e_1_2_2_19_1","doi-asserted-by":"publisher","DOI":"10.1145\/3158154"},{"key":"e_1_2_2_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/2737924.2738005"},{"key":"e_1_2_2_21_1","unstructured":"Steve Klabnik and Carol Nichols. 2018. The Rust Programming Language. https:\/\/doc.rust-lang.org\/stable\/book\/2018-edition\/  Steve Klabnik and Carol Nichols. 2018. The Rust Programming Language. https:\/\/doc.rust-lang.org\/stable\/book\/2018-edition\/"},{"key":"e_1_2_2_22_1","unstructured":"Felix S. Klock. 2019. Breaking news: Non-lexical lifetimes arrives for everyone. Blog post. http:\/\/blog.pnkfx.org\/blog\/2019\/ 06\/26\/breaking-news-non-lexical-lifetimes-arrives-for-everyone\/ .  Felix S. Klock. 2019. Breaking news: Non-lexical lifetimes arrives for everyone. Blog post. http:\/\/blog.pnkfx.org\/blog\/2019\/ 06\/26\/breaking-news-non-lexical-lifetimes-arrives-for-everyone\/ ."},{"key":"e_1_2_2_23_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-319-03545-1_4"},{"key":"e_1_2_2_25_1","doi-asserted-by":"publisher","DOI":"10.1145\/3276495"},{"key":"e_1_2_2_27_1","doi-asserted-by":"publisher","DOI":"10.1007\/s10817-008-9099-0"},{"key":"e_1_2_2_28_1","unstructured":"Niko Matsakis. 2018. An alias-based formulation of the borrow checker. Blog post. http:\/\/smallcultfollowing.com\/babysteps\/ blog\/2018\/04\/27\/an-alias-based-formulation-of-the-borrow-checker\/ .  Niko Matsakis. 2018. An alias-based formulation of the borrow checker. Blog post. http:\/\/smallcultfollowing.com\/babysteps\/ blog\/2018\/04\/27\/an-alias-based-formulation-of-the-borrow-checker\/ ."},{"key":"e_1_2_2_29_1","doi-asserted-by":"publisher","DOI":"10.1145\/3290380"},{"key":"e_1_2_2_30_1","volume-title":"N2014: What is C in practice? (Cerberus survey v2): Analysis of Responses. ISO SC22 WG14 N2014","author":"Memarian Kayvan","year":"2016","unstructured":"Kayvan Memarian and Peter Sewell . 2016 . N2014: What is C in practice? (Cerberus survey v2): Analysis of Responses. ISO SC22 WG14 N2014 , http:\/\/www.cl.cam.ac.uk\/~pes20\/cerberus\/notes50-survey-discussion.html . Kayvan Memarian and Peter Sewell. 2016. N2014: What is C in practice? (Cerberus survey v2): Analysis of Responses. ISO SC22 WG14 N2014, http:\/\/www.cl.cam.ac.uk\/~pes20\/cerberus\/notes50-survey-discussion.html ."},{"key":"e_1_2_2_31_1","doi-asserted-by":"publisher","DOI":"10.3217\/jucs-009-03-0270"},{"key":"e_1_2_2_33_1","unstructured":"Nikita Popov. 2018. Loop unrolling incorrectly duplicates noalias metadata. LLVM issue #39282. https:\/\/bugs.llvm.org\/ show_bug.cgi?id=39282 .  Nikita Popov. 2018. Loop unrolling incorrectly duplicates noalias metadata. LLVM issue #39282. https:\/\/bugs.llvm.org\/ show_bug.cgi?id=39282 ."},{"key":"e_1_2_2_34_1","volume-title":"Undefined behavior","author":"Regehr John","year":"2017","unstructured":"John Regehr . 2017. Undefined behavior in 2017 . Blog post. https:\/\/blog.regehr.org\/archives\/1520 . John Regehr. 2017. Undefined behavior in 2017. Blog post. https:\/\/blog.regehr.org\/archives\/1520 ."},{"key":"e_1_2_2_35_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-642-35308-6_5"},{"key":"e_1_2_2_36_1","doi-asserted-by":"publisher","DOI":"10.1145\/207110.207111"}],"container-title":["Proceedings of the ACM on Programming Languages"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3371109","content-type":"unspecified","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3371109","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,6,18]],"date-time":"2025-06-18T15:05:43Z","timestamp":1750259143000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3371109"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2019,12,20]]},"references-count":33,"journal-issue":{"issue":"POPL","published-print":{"date-parts":[[2020,1]]}},"alternative-id":["10.1145\/3371109"],"URL":"https:\/\/doi.org\/10.1145\/3371109","relation":{},"ISSN":["2475-1421"],"issn-type":[{"value":"2475-1421","type":"electronic"}],"subject":[],"published":{"date-parts":[[2019,12,20]]},"assertion":[{"value":"2019-12-20","order":2,"name":"published","label":"Published","group":{"name":"publication_history","label":"Publication History"}}]}}