Skip to content
Snippets Groups Projects
Commit a7fc5d43 authored by Per's avatar Per
Browse files

fix

parent 544fa04a
No related branches found
No related tags found
No related merge requests found
...@@ -4,15 +4,15 @@ The memory model is one unique feature that makes Rust stand out from other simi ...@@ -4,15 +4,15 @@ The memory model is one unique feature that makes Rust stand out from other simi
At heart, is uniqueness of references to mutable resources (memory locations). I.e., in *safe* Rust, one can either have a single mutable reference, or (one or) many immutable references to a resource, but never both (mutable and immutable references at the same time). At heart, is uniqueness of references to mutable resources (memory locations). I.e., in *safe* Rust, one can either have a single mutable reference, or (one or) many immutable references to a resource, but never both (mutable and immutable references at the same time).
This property is enforced by the *borrow checker* in the `rustc` compiler, and code which breaks these properties will be rejected with a compilation error. This property is enforced by the *borrow checker* in the `rustc` compiler, i.e., code which breaks these properties will be rejected with a compilation error.
There are several advantages with the Rust memory model. To name a few: There are several advantages with the Rust memory model. To name a few:
* Foremost the Rust memory model is safe, i.e., for programs (written in *safe Rust) that passes compilation the generated code will be free of unsafe memory accesses (and thus *memory safe*). * Foremost the Rust memory model is safe, i.e., for programs (written in *safe Rust*) that passes compilation the generated code will be free of unsafe memory accesses (and thus *memory safe*);
* The Rust memory model allows for "fearless programming", i.e., as a programmer you don't have to focus efforts on memory safety, the compiler will stop you if you do something potentially dangerous. * The Rust memory model allows for "fearless programming", i.e., as a programmer you don't have to focus efforts on memory safety, the compiler will stop you if you do something potentially dangerous;
* Programming errors that indirectly lead to memory errors can be spoted at compile time. (E.g, attempting to change the lenght of an array `a` inside an iterator over `a` will be spoted by the compiler.) * Programming errors that indirectly lead to memory errors can be spoted at compile time. (E.g, attempting to change the lenght of an array `a` inside an iterator over `a` will be spoted by the compiler.);
* The Rust memory model allows for aggressive optimization, i.e., the compiler will host detailed information regarding the mutability of references and make *safe* assumpitions leading to efficient implementations. * The Rust memory model allows for aggressive optimization, i.e., the compiler will host detailed information regarding the mutability of references and make *safe* assumpitions leading to efficient implementations.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment