BorrowCheck › Rust language core
Syntax, variables, types
Language basics: bindings, mutability, shadowing, scalar and compound types, integer overflow.
The topic introduces basic syntax: declaring variables with let, mutability (mut), shadowing, and how const differs from let. The questions check how shadowing differs from mutating a value, why mut cannot change a variable's type, and why a variable cannot be read before it is initialized. The subtopic on scalar types covers default literal types, usize and isize, the 'a', b'a' and "a" literals, the ban on mixing integers of different types, integer division, and comparisons with NaN. A separate subtopic is devoted to integer overflow: its behavior in debug and release builds, the overflow-checks setting, the explicit methods wrapping_add, checked_add and saturating_add, and the case of i8::MIN / -1. The subtopics on tuples, arrays and control flow show that an array's length is part of its type, that a block, if and loop are expressions with a value, how loop labels and break with a value work, and why the ! type coerces to any type.
38 questions: 22 basic, 14 intermediate, 2 advanced. 6 info pages, 13 sources.
Subtopics
let,mut, shadowing- Scalar types and literals
- Integer overflow
- Tuples and arrays
- Expressions vs statements
- Control flow