diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-11-17 14:32:45 -0800 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-11-18 10:32:27 -0800 |
| commit | 3feaecd757241b7b5efd742108abe351ff8d497d (patch) | |
| tree | 33c2b15ddf5d4bf1ce236d808adf24697b9a75b8 /src/lib | |
| parent | 44aebb978ca146dad99068412f44aa11c379dc12 (diff) | |
| download | rust-3feaecd757241b7b5efd742108abe351ff8d497d.tar.gz rust-3feaecd757241b7b5efd742108abe351ff8d497d.zip | |
intrinsics: Move the call to upcall_fail out of rust_intrinsic_cast
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/unsafe.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/lib/unsafe.rs b/src/lib/unsafe.rs index 0162c10ea22..22cce495649 100644 --- a/src/lib/unsafe.rs +++ b/src/lib/unsafe.rs @@ -19,7 +19,14 @@ Function: reinterpret_cast Casts the value at `src` to U. The two types must have the same length. */ -unsafe fn reinterpret_cast<T, U>(src: T) -> U { ret rusti::cast(src); } +unsafe fn reinterpret_cast<T, U>(src: T) -> U { + let t1 = sys::get_type_desc::<T>(); + let t2 = sys::get_type_desc::<U>(); + if (*t1).size != (*t2).size { + fail "attempt to cast values of differing sizes"; + } + ret rusti::cast(src); +} /* Function: leak |
