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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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
+}
|