summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/rustc-1.29.0-src.patch
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/patches/rustc-1.29.0-src.patch')
-rw-r--r--gnu/packages/patches/rustc-1.29.0-src.patch86
1 files changed, 86 insertions, 0 deletions
diff --git a/gnu/packages/patches/rustc-1.29.0-src.patch b/gnu/packages/patches/rustc-1.29.0-src.patch
new file mode 100644
index 0000000000..feeb7e71cf
--- /dev/null
+++ b/gnu/packages/patches/rustc-1.29.0-src.patch
@@ -0,0 +1,86 @@
+From mrustc 0.9.
+# Add mrustc slice length intrinsics
+--- rustc-1.29.0-src/src/libcore/intrinsics.rs
++++ rustc-1.29.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.29.0-src/src/libcore/slice/mod.rs
++++ rustc-1.29.0-src/src/libcore/slice/mod.rs
+@@ -413,5 +413,7 @@
+ pub const fn len(&self) -> usize {
+- unsafe {
+- Repr { rust: self }.raw.len
+- }
++ #[cfg(not(rust_compiler="mrustc"))]
++ const fn len_inner<T>(s: &[T]) -> usize { unsafe { Repr { rust: s }.raw.len } };
++ #[cfg(rust_compiler="mrustc")]
++ const fn len_inner<T>(s: &[T]) -> usize { unsafe { ::intrinsics::mrustc_slice_len(s) } }
++ len_inner(self)
+ }
+# Static-link rustc_codegen_llvm because mrustc doesn't have dylib support
+--- rustc-1.29.0-src/src/librustc_driver/Cargo.toml
++++ rustc-1.29.0-src/src/librustc_driver/Cargo.toml
+@@ -39,1 +39,2 @@
+ syntax_pos = { path = "../libsyntax_pos" }
++rustc_codegen_llvm = { path = "../librustc_codegen_llvm" }
+--- rustc-1.29.0-src/src/librustc_driver/lib.rs
++++ rustc-1.29.0-src/src/librustc_driver/lib.rs
+@@ -63,2 +63,3 @@
+ extern crate syntax_pos;
++extern crate rustc_codegen_llvm;
+
+@@ -296,3 +296,7 @@
+ }
+
++ if backend_name == "llvm" {
++ return rustc_codegen_llvm::__rustc_codegen_backend;
++ }
++
+ let target = session::config::host_triple();
+# No workspace support in minicargo, patch cargo's Cargo.toml
+--- rustc-1.29.0-src/src/tools/cargo/Cargo.toml
++++ rustc-1.29.0-src/src/tools/cargo/Cargo.toml
+@@ -60,5 +60,5 @@
+ # A noop dependency that changes in the Rust repository, it's a bit of a hack.
+ # See the `src/tools/rustc-workspace-hack/README.md` file in `rust-lang/rust`
+ # for more information.
+-rustc-workspace-hack = "1.0.0"
++rustc-workspace-hack = { path = "../rustc-workspace-hack" }
+
+# mrustc can't represent a 24 byte version of this enum (no way of storing the
+# tag in padding)
+--- rustc-1.29.0-src/src/librustc/ty/context.rs
++++ rustc-1.29.0-src/src/librustc/ty/context.rs
+@@ -805,5 +805,5 @@
+ // Ensure our type representation does not grow
+- #[cfg(target_pointer_width = "64")]
+- assert!(mem::size_of::<ty::TypeVariants>() <= 24);
+- #[cfg(target_pointer_width = "64")]
+- assert!(mem::size_of::<ty::TyS>() <= 32);
++ //#[cfg(target_pointer_width = "64")]
++ //assert!(mem::size_of::<ty::TypeVariants>() <= 24);
++ //#[cfg(target_pointer_width = "64")]
++ //assert!(mem::size_of::<ty::TyS>() <= 32);
+
+--- rustc-1.29.0-src/src/stdsimd/stdsimd/arch/detect/os/x86.rs
++++ rustc-1.29.0-src/src/stdsimd/stdsimd/arch/detect/os/x86.rs
+@@ -14,5 +14,11 @@
+ /// Performs run-time feature detection.
+ #[inline]
++#[cfg(not(rust_compiler="mrustc"))]
+ pub fn check_for(x: Feature) -> bool {
+ cache::test(x as u32, detect_features)
+ }
++#[inline]
++#[cfg(rust_compiler="mrustc")]
++pub fn check_for(x: Feature) -> bool {
++ false
++}