A scope is a region of program text that determines where names and declarations are visible. In Rust, curly-braced code blocks create lexical scopes, including the body of main and function bodies. section 2.2.1
Rust uses scope in several closely related ways:
- Variable bindings created with let belong to the surrounding block and can be used while that scope makes them available. section 2.2.1
- Imports can bring traits into local scope, enabling methods such as try_into(); common operations may also arrive through Rust’s implicit prelude. section 2.3.3
- Scope interacts with ownership and lifetimes: passing an owned value from main into a function moves ownership into that function’s parameter scope. section 4.1.1
A scope boundary in practice
In the CubeSat example, sat_a is created in main and passed to check_status(sat_a). After that call, using sat_a again produces an E0382 error because ownership moved into the function. Rebinding a_status is allowed, but reusing an owned value that has moved is not. section 4.1.1
Use the figure to trace how scope, control flow, ownership, and lifetimes relate across Rust code. section 4.2




















