2013-11-01 06:31:11 +00:00
|
|
|
// Copyright 2013 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.
|
|
|
|
|
2018-08-30 12:18:55 +00:00
|
|
|
// run-pass
|
2018-08-31 13:02:01 +00:00
|
|
|
#![allow(non_upper_case_globals)]
|
|
|
|
|
2016-02-11 11:34:41 +00:00
|
|
|
// ignore-emscripten no threads support
|
2015-03-22 20:13:15 +00:00
|
|
|
|
2015-02-17 23:24:34 +00:00
|
|
|
use std::thread;
|
2013-11-01 06:31:11 +00:00
|
|
|
|
|
|
|
static mut dropped: bool = false;
|
|
|
|
|
|
|
|
struct A {
|
|
|
|
b: B,
|
|
|
|
}
|
|
|
|
|
|
|
|
struct B {
|
2015-03-26 00:06:52 +00:00
|
|
|
foo: isize,
|
2013-11-01 06:31:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for A {
|
|
|
|
fn drop(&mut self) {
|
2014-10-09 19:17:22 +00:00
|
|
|
panic!()
|
2013-11-01 06:31:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Drop for B {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
unsafe { dropped = true; }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn main() {
|
2015-02-17 23:24:34 +00:00
|
|
|
let ret = thread::spawn(move|| {
|
2013-11-01 06:31:11 +00:00
|
|
|
let _a = A { b: B { foo: 3 } };
|
2015-01-02 07:53:35 +00:00
|
|
|
}).join();
|
2013-11-01 06:31:11 +00:00
|
|
|
assert!(ret.is_err());
|
|
|
|
unsafe { assert!(dropped); }
|
|
|
|
}
|