unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
blob 261162172e4bc6d4ac7f3a718a20fa784237e1ac 1001 bytes (raw)
name: patches/rust-1.19-mrustc.patch 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
See https://github.com/thepowersgang/mrustc/archive/v0.8.0.tar.gz

--- rustc-1.19.0-src-orig/src/libcore/intrinsics.rs
+++ rustc-1.19.0-src/src/libcore/intrinsics.rs
@@ -678,5 +678,9 @@
     pub fn min_align_of_val<T: ?Sized>(_: &T) -> usize;
 
+    /// Obtain the length of a slice pointer
+    #[cfg(rust_compiler="mrustc")]
+    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-1.19.0-src-orig/src/libcore/slice/mod.rs
+++ rustc-1.19.0-src/src/libcore/slice/mod.rs
@@ -413,6 +413,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
     }

debug log:

solving 261162172e4bc6d4ac7f3a718a20fa784237e1ac ...
found 261162172e4bc6d4ac7f3a718a20fa784237e1ac in https://git.savannah.gnu.org/cgit/guix.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).