diff options
author | John Hodge <tpg@ucc.asn.au> | 2019-11-02 11:07:23 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2019-11-02 11:07:23 +0800 |
commit | 1d02810c3cf908bfba7c15ae50eb5314603b9d85 (patch) | |
tree | 79dd5e4ef4c3ff79db0912ba546f08e61a7a8c10 /rustc-1.29.0-src.patch | |
parent | 7111acba04d72fe4084b1a1f3209ff83efe8614d (diff) | |
parent | 8b53b38f40625ab0510f541d69db3f83332a830a (diff) | |
download | mrust-1d02810c3cf908bfba7c15ae50eb5314603b9d85.tar.gz |
Merge branch 'nightly-1.29' - #95 Working support for rustc 1.29
Diffstat (limited to 'rustc-1.29.0-src.patch')
-rw-r--r-- | rustc-1.29.0-src.patch | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/rustc-1.29.0-src.patch b/rustc-1.29.0-src.patch new file mode 100644 index 00000000..fb47520c --- /dev/null +++ b/rustc-1.29.0-src.patch @@ -0,0 +1,85 @@ +# Add mrustc slice length intrinsics +--- src/libcore/intrinsics.rs ++++ 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; + +--- src/libcore/slice/mod.rs ++++ 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 +--- src/librustc_driver/Cargo.toml ++++ src/librustc_driver/Cargo.toml +@@ -39,1 +39,2 @@ + syntax_pos = { path = "../libsyntax_pos" } ++rustc_codegen_llvm = { path = "../librustc_codegen_llvm" } +--- src/librustc_driver/lib.rs ++++ 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 +--- src/tools/cargo/Cargo.toml ++++ 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) +--- src/librustc/ty/context.rs ++++ 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); + +--- src/stdsimd/stdsimd/arch/detect/os/x86.rs ++++ 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 ++} |