We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ca4980a commit b79f9afCopy full SHA for b79f9af
1 file changed
rust/src/main.rs
@@ -259,11 +259,15 @@ fn scope() {
259
if false {
260
delete(a); // the value is moved here even under the "if false"
261
}
262
- // value of a is unusable here
263
- a = "1".to_string();
+ // value of a is undefined here
+ a = "1".to_string(); // reusing a
264
let c = a;
265
// value of a is unusable here
266
- assert_eq!(c, "1")
+ assert_eq!(c, "1");
267
+ a = c;
268
+ // c is unusable because is unmutable
269
+ //c = a; // error: cannot assign twice to immutable variable
270
+ assert_eq!(a, "1");
271
272
273
#[test]
0 commit comments