File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2+ // file at the top-level directory of this distribution and at
3+ // http://rust-lang.org/COPYRIGHT.
4+ //
5+ // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+ // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+ // option. This file may not be copied, modified, or distributed
9+ // except according to those terms.
10+
111use std:: cell:: Cell ;
212
313struct Flag < ' a > ( & ' a Cell < bool > ) ;
414
515impl < ' a > Drop for Flag < ' a > {
6- fn drop ( & mut self ) {
7- self . 0 . set ( false )
8- }
16+ fn drop ( & mut self ) {
17+ self . 0 . set ( false )
18+ }
919}
1020
1121fn main ( ) {
@@ -16,7 +26,7 @@ fn main() {
1626 }
1727 // The Flag value should be dead outside of the loop
1828 assert_eq ! ( alive2. get( ) , false ) ;
19-
29+
2030 let alive = Cell :: new ( true ) ;
2131 for _ in std:: iter:: once ( Flag ( & alive) ) {
2232 // The Flag value should be alive in the for loop body even if it wasn't
You can’t perform that action at this time.
0 commit comments