Compiling playground v0.0.1 (/playground)
warning: unused variable: `future`
--> src/main.rs:14:9
|
14 | let future = hello_world();
| ^^^^^^ help: if this is intentional, prefix it with an underscore: `_future`
|
= note: `#[warn(unused_variables)]` on by default
warning: `playground` (bin "playground") generated 1 warning
Finished dev [unoptimized + debuginfo] target(s) in 1.36s
Running `target/debug/playground`
Well, first of all, every statement is an expression (which evaluates to ()).
Now, hello_world() is an expression, which is executed by calling the function; since the function is ordinary, this means executing its body immediately, including println!. Then the value of this expression (that is, the return value of function; that is, (), since you don't return anything explicitly) is assigned to future.
When you execute hello_future, however, the logic is different - evaluating an async function call expression means building the future which will execute the function body when polled. Therefore, this future is assigned to future1, and the println is executed when this future is driven by block_on.
It think you have confused yourself by naming variable which is not Future but just an empty type (called () in Rust) future.
But I can assure you: compiler treats all variable names equally! Except for _ (single underscore) which is not, technically, a variable name (it's a placeholder).