forked from thepowersgang/mrustc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrustc-1.29.0-src.patch
271 lines (248 loc) · 12.3 KB
/
rustc-1.29.0-src.patch
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# 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
+}
# macOS on Apple Silicon support
--- src/liblibc/src/unix/bsd/apple/mod.rs
+++ src/liblibc/src/unix/bsd/apple/mod.rs
@@ -2388,9 +2388,9 @@ extern {
pub fn __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "statfs$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "statfs$INODE64")]
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstatfs$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "fstatfs$INODE64")]
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
pub fn kevent(kq: ::c_int,
changelist: *const ::kevent,
--- src/liblibc/src/unix/bsd/mod.rs
+++ src/liblibc/src/unix/bsd/mod.rs
@@ -402,7 +402,7 @@ extern {
euid: *mut ::uid_t,
egid: *mut ::gid_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "glob$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "glob$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__glob30")]
#[cfg_attr(target_os = "freebsd", link_name = "glob@FBSD_1.0")]
pub fn glob(pattern: *const ::c_char,
--- src/liblibc/src/unix/mod.rs
+++ src/liblibc/src/unix/mod.rs
@@ -390,14 +390,14 @@ extern {
link_name = "fchmod$UNIX2003")]
pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "fstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
#[cfg_attr(target_os = "freebsd", link_name = "fstat@FBSD_1.0")]
pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "stat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
#[cfg_attr(target_os = "freebsd", link_name = "stat@FBSD_1.0")]
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
@@ -431,11 +431,11 @@ extern {
link_name = "fdopendir$INODE64$UNIX2003")]
pub fn fdopendir(fd: ::c_int) -> *mut ::DIR;
- #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "readdir$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
#[cfg_attr(target_os = "freebsd", link_name = "readdir@FBSD_1.0")]
pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
- #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "readdir_r$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_readdir_r")]
#[cfg_attr(target_os = "freebsd", link_name = "readdir_r@FBSD_1.0")]
@@ -460,7 +460,7 @@ extern {
pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
owner: ::uid_t, group: ::gid_t,
flags: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "fstatat$INODE64")]
#[cfg_attr(target_os = "freebsd", link_name = "fstatat@FBSD_1.1")]
pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
buf: *mut stat, flags: ::c_int) -> ::c_int;
@@ -613,7 +613,7 @@ extern {
pub fn if_indextoname(ifindex: ::c_uint,
ifname: *mut ::c_char) -> *mut ::c_char;
- #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "lstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
#[cfg_attr(target_os = "freebsd", link_name = "lstat@FBSD_1.0")]
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
--- src/vendor/libc/src/unix/bsd/apple/mod.rs
+++ src/vendor/libc/src/unix/bsd/apple/mod.rs
@@ -2376,9 +2376,9 @@ extern {
pub fn __error() -> *mut ::c_int;
pub fn backtrace(buf: *mut *mut ::c_void,
sz: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "statfs$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "statfs$INODE64")]
pub fn statfs(path: *const ::c_char, buf: *mut statfs) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstatfs$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "fstatfs$INODE64")]
pub fn fstatfs(fd: ::c_int, buf: *mut statfs) -> ::c_int;
pub fn kevent(kq: ::c_int,
changelist: *const ::kevent,
--- src/vendor/libc/src/unix/mod.rs
+++ src/vendor/libc/src/unix/mod.rs
@@ -382,14 +382,14 @@ extern {
link_name = "fchmod$UNIX2003")]
pub fn fchmod(fd: ::c_int, mode: mode_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "fstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__fstat50")]
#[cfg_attr(target_os = "freebsd", link_name = "fstat@FBSD_1.0")]
pub fn fstat(fildes: ::c_int, buf: *mut stat) -> ::c_int;
pub fn mkdir(path: *const c_char, mode: mode_t) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "stat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__stat50")]
#[cfg_attr(target_os = "freebsd", link_name = "stat@FBSD_1.0")]
pub fn stat(path: *const c_char, buf: *mut stat) -> ::c_int;
@@ -416,11 +416,11 @@ extern {
link_name = "opendir$INODE64$UNIX2003")]
#[cfg_attr(target_os = "netbsd", link_name = "__opendir30")]
pub fn opendir(dirname: *const c_char) -> *mut ::DIR;
- #[cfg_attr(target_os = "macos", link_name = "readdir$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "readdir$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir30")]
#[cfg_attr(target_os = "freebsd", link_name = "readdir@FBSD_1.0")]
pub fn readdir(dirp: *mut ::DIR) -> *mut ::dirent;
- #[cfg_attr(target_os = "macos", link_name = "readdir_r$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "readdir_r$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__readdir_r30")]
#[cfg_attr(target_os = "solaris", link_name = "__posix_readdir_r")]
#[cfg_attr(target_os = "freebsd", link_name = "readdir_r@FBSD_1.0")]
@@ -445,7 +445,7 @@ extern {
pub fn fchownat(dirfd: ::c_int, pathname: *const ::c_char,
owner: ::uid_t, group: ::gid_t,
flags: ::c_int) -> ::c_int;
- #[cfg_attr(target_os = "macos", link_name = "fstatat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "fstatat$INODE64")]
#[cfg_attr(target_os = "freebsd", link_name = "fstatat@FBSD_1.1")]
pub fn fstatat(dirfd: ::c_int, pathname: *const ::c_char,
buf: *mut stat, flags: ::c_int) -> ::c_int;
@@ -598,7 +598,7 @@ extern {
pub fn if_indextoname(ifindex: ::c_uint,
ifname: *mut ::c_char) -> *mut ::c_char;
- #[cfg_attr(target_os = "macos", link_name = "lstat$INODE64")]
+ #[cfg_attr(all(target_os = "macos", target_arch = "x86_64"), link_name = "lstat$INODE64")]
#[cfg_attr(target_os = "netbsd", link_name = "__lstat50")]
#[cfg_attr(target_os = "freebsd", link_name = "lstat@FBSD_1.0")]
pub fn lstat(path: *const c_char, buf: *mut stat) -> ::c_int;
# Backport of https://github.com/servo/core-foundation-rs/commit/aa6d1cd4c15561b48c24322527e3d9e60f603db4
--- src/vendor/core-foundation-sys/src/attributed_string.rs
+++ src/vendor/core-foundation-sys/src/attributed_string.rs
@@ -52,5 +52,4 @@ extern {
value: CFTypeRef,
);
- pub fn CFMutableAttributedStringGetTypeID() -> CFTypeID;
}
diff --git a/core-foundation/src/attributed_string.rs b/core-foundation/src/attributed_string.rs
index e0fa576..c99775d 100644
--- src/vendor/core-foundation/src/attributed_string.rs
+++ src/vendor/core-foundation/src/attributed_string.rs
@@ -41,7 +41,7 @@ impl CFAttributedString {
declare_TCFType!{
CFMutableAttributedString, CFMutableAttributedStringRef
}
-impl_TCFType!(CFMutableAttributedString, CFMutableAttributedStringRef, CFMutableAttributedStringGetTypeID);
+impl_TCFType!(CFMutableAttributedString, CFMutableAttributedStringRef, CFAttributedStringGetTypeID);
impl CFMutableAttributedString {
#[inline]
@@ -83,3 +83,16 @@ impl Default for CFMutableAttributedString {
Self::new()
}
}
+
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn attributed_string_type_id_comparison() {
+ // CFMutableAttributedString TypeID must be equal to CFAttributedString TypeID.
+ // Compilation must not fail.
+ assert_eq!(<CFAttributedString as TCFType>::type_id(), <CFMutableAttributedString as TCFType>::type_id());
+ }
+}