#428·evcxr

Mutable variable removed from scope after move.

Author: CL124C41ACreated Nov 6, 2025Updated Nov 6, 2025

The interpreter throws an error or not depending if the code was input together or on different lines. Version of the interpreter is 0.19.0 from Debian 12 stable. Example follows.

Welcome to evcxr. For help, type :help

>> let mut s = String::from("hello");
   let t = s;
   s = String::from("world");
   println!("{}", t); 
   println!("{}", s);

hello
world

>> let mut s = String::from("hello");
>> let t = s;
>> s = String::from("world");
[E0425] Error: cannot find value `s` in this scope
   ╭─[command:1:1]
   │
 1 │ s = String::from("world");
   │ ┬  
   │ ╰── error: cannot find value `s` in this scope
   │ │  
   │ ╰── help: a local variable with a similar name exists: `t`
   │ │  
   │ ╰── help: you might have meant to introduce a new binding: `let `
───╯

>> :version
0.19.0