diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-05-23 18:27:34 -0700 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2013-05-27 17:32:31 -0700 |
| commit | 6c03fbfefd950f5a5d54b3b86f84657f9908f5ff (patch) | |
| tree | 886cfbb7b4353a1d50006d87ba0eee2238c95739 /src | |
| parent | dbc57584bd4e87f0bd3eed6bced8bbd04d99edcf (diff) | |
testsuite: Add passing test for #4735
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/run-pass/issue-4735.rs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-4735.rs b/src/test/run-pass/issue-4735.rs new file mode 100644 index 00000000000..aade0dcdc26 --- /dev/null +++ b/src/test/run-pass/issue-4735.rs @@ -0,0 +1,30 @@ +// 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. + + +use core::cast::transmute; +use core::libc::c_void; + +struct NonCopyable(*c_void); + +impl Drop for NonCopyable { + fn finalize(&self) { + let p = **self; + let v = unsafe { transmute::<*c_void, ~int>(p) }; + } +} + +fn main() { + let t = ~0; + let p = unsafe { transmute::<~int, *c_void>(t) }; + let z = NonCopyable(p); +} + + |
