Toward a better list iterator for the kernel
Toward a better list iterator for the kernel
Posted Mar 14, 2022 19:51 UTC (Mon) by jem (subscriber, #24231)In reply to: Toward a better list iterator for the kernel by alonz
Parent article: Toward a better list iterator for the kernel
The scope of a Rust variable variable ends either at the end of the block, or when a new variable with the same name is declared. You can use the old variable when computing the initial value of the new variable, i.e. you can initialize a variable with the value of the variable "itself".
This can be used to change a variable from being mutable to immutable when there is no need to change the value after some point in the program. (Technically there are two separate variables with the same name.)
