Rust community lingo basics

Hi,

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 :slight_smile:

18 Likes

Not Rust-specific

Maybe Rust-specific

6 Likes

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.

1 Like

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
2 Likes
  • TT muncher: design pattern for macros. Such macros match argument by pattern followed by $($rest:tt)*, and pass $($rest)* to the macro itself to process the rest part recursively.
2 Likes

Not Rust-specific

1 Like
  • Cell: Wrapper types to make values mutable through immutable reference.
    Standard library has std::cell::{Cell, RefCell, UnsafeCell} for such purpose, and there are many third-party cell types for various uses.
2 Likes
  • 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 #[doc(hidden)] __Nonexhaustive.
    #[non_exhaustive] attribute is stable since Rust 1.40.

cf. Never patterns, exhaustive matching, and uninhabited types (oh my!)

2 Likes

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.

But:

"Executor"
"Async"
"Await"
"Future"

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:

"varadict generics"
"associated type"

Even "trait" is an alien concept.

None of these things have existed in my programming world, which spans from Algol to Javascript.

2 Likes

MSRV: Minimum Supported Rust Version*

6 Likes

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).

5 Likes

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 :smile:

4 Likes

You might want to upstream some of these into https://github.com/Enet4/rust-tropes

7 Likes

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.

2 Likes