Compiling playground v0.0.1 (/playground)
error[E0425]: cannot find value `BORON_BOY` in this scope
--> src/lib.rs:8:25
|
8 | static B: i32 = BORON_BOY;
| ^^^^^^^^^ not found in this scope
For more information about this error, try `rustc --explain E0425`.
error: could not compile `playground` (lib) due to 1 previous error
Looking at the rust doc, super doesn't work because, super is defined as resolving "to the parent of the current module" (Paths - The Rust Reference).
Why does it matter? Sometimes when generating tests for crate with different features, it's helpful to create nested modules in the test function to share common settings but avoid naming collisions for generated code.
super goes up one module, super::super goes up two modules, and so on. crate refers to your root module.
In filesystem terms/analogy, .. is super, crate is /.
Edit: I didn't see that b is a function. That static item is completely private to that function and cannot be observed. A module defined inside that function doesn't get access to items defined in it.
A module defined inside a function doesn't work like you think it does. A module defined inside a function is the same as a same named module outside that function.