We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
compile-fail/nll/region-ends-after-if-condition.rs
1 parent f27eb1e commit bf57a23Copy full SHA for bf57a23
src/test/compile-fail/nll/region-ends-after-if-condition.rs
@@ -21,12 +21,26 @@ struct MyStruct {
21
field: String
22
}
23
24
-fn main() {
+fn foo1() {
25
let mut my_struct = MyStruct { field: format!("Hello") };
26
27
let value = &my_struct.field;
28
if value.is_empty() {
29
my_struct.field.push_str("Hello, world!");
30
- //~^ ERROR cannot borrow (Ast)
+ //~^ ERROR (Ast) [E0502]
31
32
33
+
34
+fn foo2() {
35
+ let mut my_struct = MyStruct { field: format!("Hello") };
36
37
+ let value = &my_struct.field;
38
+ if value.is_empty() {
39
+ my_struct.field.push_str("Hello, world!");
40
41
+ //~| ERROR (Mir) [E0502]
42
+ }
43
+ drop(value);
44
+}
45
46
+fn main() { }
0 commit comments