-
Notifications
You must be signed in to change notification settings - Fork 110
/
rustc-1.29.0-src.patch
322 lines (287 loc) · 14.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
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
# Add mrustc slice length intrinsics
--- src/libcore/intrinsics.rs
+++ src/libcore/intrinsics.rs
@@ -689,6 +689,10 @@ extern "rust-intrinsic" {
pub fn size_of_val<T: ?Sized>(_: &T) -> usize;
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
@@ -128,9 +128,11 @@ impl<T> [T] {
#[inline]
#[rustc_const_unstable(feature = "const_slice_len")]
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)
}
/// Returns `true` if the slice has a length of 0.
# 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;
# 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
@@ -802,10 +802,10 @@ impl<'a, 'gcx> HashStable<StableHashingContext<'a>> for TypeckTables<'gcx> {
impl<'tcx> CommonTypes<'tcx> {
fn new(interners: &CtxtInterners<'tcx>) -> CommonTypes<'tcx> {
// 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);
let mk = |sty| CtxtInterners::intern_ty(interners, interners, sty);
let mk_region = |r| {
# Static-link rustc_codegen_llvm because mrustc doesn't have dylib support
--- src/librustc_driver/Cargo.toml
+++ src/librustc_driver/Cargo.toml
@@ -37,3 +37,4 @@ serialize = { path = "../libserialize" }
syntax = { path = "../libsyntax" }
syntax_ext = { path = "../libsyntax_ext" }
syntax_pos = { path = "../libsyntax_pos" }
+rustc_codegen_llvm = { path = "../librustc_codegen_llvm" }
--- src/librustc_driver/lib.rs
+++ src/librustc_driver/lib.rs
@@ -61,6 +61,7 @@ extern crate log;
extern crate syntax;
extern crate syntax_ext;
extern crate syntax_pos;
+extern crate rustc_codegen_llvm;
use driver::CompileController;
use pretty::{PpMode, UserIdentifiedItem};
@@ -294,6 +295,10 @@ fn get_codegen_sysroot(backend_name: &str) -> fn() -> Box<dyn CodegenBackend> {
return rustc_codegen_utils::codegen_backend::MetadataOnlyCodegenBackend::new
}
+ if backend_name == "llvm" {
+ return rustc_codegen_llvm::__rustc_codegen_backend;
+ }
+
let target = session::config::host_triple();
let mut sysroot_candidates = vec![filesearch::get_or_default_sysroot()];
let path = current_dll_path()
# A strange bug in `librustc_mir`
# - The signature of the impl block is `impl<'cg, 'cx, 'tcx, 'gcx> InvalidationGenerator<'cg, 'cx, 'tcx, 'gcx>`
# - But the closure argument uses `'gcx, 'tcx` (switching the order of the two args)
# MIGHT BE A RUSTC BUG?
--- src/librustc_mir/borrow_check/nll/invalidation.rs
+++ src/librustc_mir/borrow_check/nll/invalidation.rs
@@ -298,4 +298,4 @@ fn visit_terminator_drop(
let drop_field = |
- ig: &mut InvalidationGenerator<'cg, 'cx, 'gcx, 'tcx>,
+ ig: &mut InvalidationGenerator<'cg, 'cx, 'tcx, 'gcx>,
(index, field): (usize, ty::Ty<'gcx>),
| {
--- src/stdsimd/stdsimd/arch/detect/os/x86.rs
+++ src/stdsimd/stdsimd/arch/detect/os/x86.rs
@@ -13,9 +13,15 @@ use arch::detect::bit;
/// 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
+}
/// Run-time feature detection on x86 works by using the CPUID instruction.
///
# No workspace support in minicargo, patch cargo's Cargo.toml
--- src/tools/cargo/Cargo.toml
+++ src/tools/cargo/Cargo.toml
@@ -60,7 +60,7 @@ openssl = { version = '0.10.11', optional = true }
# 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" }
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = { version = "0.6.0", features = ["mac_os_10_7_support"] }
--- 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;
}
# Backport of https://github.com/servo/core-foundation-rs/commit/aa6d1cd4c15561b48c24322527e3d9e60f603db4
--- 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]
@@ -77,3 +77,15 @@ impl CFMutableAttributedString {
}
}
}
+
+#[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());
+ }
+}
--- 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;
--- src/llvm/lib/Demangle/ItaniumDemangle.cpp
+++ src/llvm/lib/Demangle/ItaniumDemangle.cpp
@@ -19,6 +19,7 @@
#include <cstdio>
#include <cstdlib>
#include <cstring>
+#include <limits>
#include <numeric>
#include <vector>