summaryrefslogtreecommitdiff
path: root/rust_src.patch
diff options
context:
space:
mode:
Diffstat (limited to 'rust_src.patch')
-rw-r--r--rust_src.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/rust_src.patch b/rust_src.patch
new file mode 100644
index 00000000..d782d16b
--- /dev/null
+++ b/rust_src.patch
@@ -0,0 +1,25 @@
+--- rustc-nightly/src/libcore/intrinsics.rs
++++ rustc-nightly/src/libcore/intrinsics.rs
+@@ -643,5 +643,8 @@
+ pub fn drop_in_place<T: ?Sized>(to_drop: *mut T);
+
++ /// Obtain the length of a slice pointer
++ pub fn mrustc_slice_len<T>(pointer: *const [T]) -> usize;
++
+ /// Gets a static string slice containing the name of a type.
+ pub fn type_name<T: ?Sized>() -> &'static str;
+
+--- rustc-nightly/src/libcore/slice.rs
++++ rustc-nightly/src/libcore/slice.rs
+@@ -340,6 +340,8 @@
+ #[inline]
+ fn len(&self) -> usize {
+- unsafe {
+- mem::transmute::<&[T], Repr<T>>(self).len
+- }
++ #[cfg(not(rust_compiler="mrustc"))]
++ let rv = unsafe { mem::transmute::<&[T], Repr<T>>(self).len };
++ #[cfg(rust_compiler="mrustc")]
++ let rv = unsafe { ::intrinsics::mrustc_slice_len(self) };
++ rv
+ }