mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-21 04:54:26 +00:00
Add regression test for issue #17216
This commit is contained in:
parent
5857ec6d78
commit
f1c4e476e9
32
src/test/run-pass/issue-17216.rs
Normal file
32
src/test/run-pass/issue-17216.rs
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
||||
// file at the top-level directory of this distribution and at
|
||||
// http://rust-lang.org/COPYRIGHT.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
#![feature(unsafe_destructor)]
|
||||
|
||||
struct Leak<'a> {
|
||||
dropped: &'a mut bool
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
impl<'a> Drop for Leak<'a> {
|
||||
fn drop(&mut self) {
|
||||
*self.dropped = true;
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut dropped = false;
|
||||
{
|
||||
let leak = Leak { dropped: &mut dropped };
|
||||
for ((), leaked) in Some(((),leak)).move_iter() {}
|
||||
}
|
||||
|
||||
assert!(dropped);
|
||||
}
|
Loading…
Reference in New Issue
Block a user