I've been learning Rust for a couple of months now. Before that, as many other people, I had a sense of strong curiosity for Rust. Now, I read most of the posts in this forum just for the sake of learning new things even when I'm not actually coding myself.
A problem I encountered as a new Rustacean is that a lot of people in this community uses a lot of what I call "Rust lingo" to talk about things that are not necessarily obvious to a person new to Rust. Things that you don't necessarily learn by reading the book, or doing some tutorials.
I decided I wanted to start documenting my journey into Rust, and one of the things I want to do is to create a Rust glossary, something that I (or anyone for that matter) can refer to when these things pop up.
Some examples of Rust lingo (in my opinion) are:
- RIIR: Rewrite It In Rust
- UB: Undefined Behavior
- WG: Working Group
- TWIR: This Week In Rust
- URLO: users.rust-lang.org
- IRLO: internals.rust-lang.org
- ZST: Zero-Sized Type
- AST: Abstract Syntax Tree
- Servo: Research-oriented web browser implemented in Rust
- AreWe...Yet: Set of Rust resources for a given field
- RLS: Rust Language Server
- FFI: Foreign Function Interface
- IR: Intermediate Representation
- MIRI: Mid-Level Intermediate Representation Interpreter
I would appreciate any help to expand this list
These are basic but there seems to be a lot of confusion among beginners about what they actually are and do:
Borrow: taking temporary control of a memory-backed resource in limited fashion.
Mutable borrow: a borrow that enforces uniqueness i.e. no other borrows can co-exist with a mutable borrow.
Shared borrow: a borrow that allows the borrowed resource to be borrowed again by other shared borrows. Often, though not definitionally, enforces read-only access.
SSA: Static Single Assignment representation
Subsets of IR:
- HIR: High-level IR, derived from AST
- MIR: Mid-level IR, desugared form of HIR
- LLIR: SSA-based low-level IR, used by LLVM
I would prefer that the UB entry read
- UB: Undefined Behavior, which always enables unpredictable miscompilation
- Uninhabited types: Types which can have no values (i.e. values of such types cannot exist at runtime).
! type (never type) and
std::convert::Infallible are examples of such types.
Nonexhaustive: When a type is nonexhaustive, downstream users cannot list all possible values of the type.
In old days, types are made nonexhaustive by adding hidden fields or variants (such as
#[non_exhaustive] attribute is stable since Rust 1.40.
cf. Never patterns, exhaustive matching, and uninhabited types (oh my!)
Oddly enough most of the above has never bothered me in the few months I have been getting into Rust. Just more acronyms to get used to. Not even the various "borrows" which are clear enough.
Even if I have an inkling what they are I have no idea how to write the simplest "hello async" program.
All kind of different ways of talking about types, none of which I can remember of hand now.
Then there is talk of:
Even "trait" is an alien concept.
MSRV: Minimum Supported Rust Version*
A slightly more obscure Rust specific one:
Niche: If a type does not use all bit values then the compiler can use those illegal values for something else when optimising. For example a reference can never be null so an
Option type can use that null value instead of needing a separate boolean.
A better explanation is in the unsafe guidelines (and glossary).
Related to RIIR is the so-called Rust Evangelism Task Force.
I feel that is a derogatory term but for completeness and history we should keep it in; perhaps as a subset under RIIR.
For a helpful reflection on the culture around this term, see Jonathan Turner's Rust 2018 post.
I just realized this but "the book" seems like Rust lingo to me as well
You might want to upstream some of these into https://github.com/Enet4/rust-tropes
This type is Copy, that type is Clone.
Having a trait for a type is spoken as being this trait. I would say: this type has the Copy trait. Or implements the Copy trait. But this is to long, so the Rust lingo is : this type "is" Copy.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.