@@ -226,7 +226,7 @@ The following snippet compiles, because after printing `x`, it is no longer
226
226
needed, so it doesn't matter if it is dangling or aliased (even though the
227
227
variable ` x ` * technically* exists to the very end of the scope).
228
228
229
- ``` rust,edition2018
229
+ ``` rust
230
230
let mut data = vec! [1 , 2 , 3 ];
231
231
let x = & data [0 ];
232
232
println! (" {}" , x );
@@ -238,7 +238,7 @@ However, if the value has a destructor, the destructor is run at the end of the
238
238
scope. And running the destructor is considered a use ‒ obviously the last one.
239
239
So, this will * not* compile.
240
240
241
- ``` rust,edition2018, compile_fail
241
+ ``` rust,compile_fail
242
242
#[derive(Debug)]
243
243
struct X<'a>(&'a i32);
244
244
@@ -258,7 +258,7 @@ One way to convince the compiler that `x` is no longer valid is by using `drop(x
258
258
Furthermore, there might be multiple possible last uses of the borrow, for
259
259
example in each branch of a condition.
260
260
261
- ``` rust,edition2018
261
+ ``` rust
262
262
# fn some_condition () -> bool { true }
263
263
let mut data = vec! [1 , 2 , 3 ];
264
264
let x = & data [0 ];
@@ -278,7 +278,7 @@ borrows just being tied to the same local variable. This often happens around
278
278
loops (writing a new value of a variable at the end of the loop and using it for
279
279
the last time at the top of the next iteration).
280
280
281
- ``` rust,edition2018
281
+ ``` rust
282
282
let mut data = vec! [1 , 2 , 3 ];
283
283
// This mut allows us to change where the reference points to
284
284
let mut x = & data [0 ];
0 commit comments