1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Craven <david@craven.ch>
3 ;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr>
4 ;;; Copyright © 2016 Nikita <nikita@n0.is>
5 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
6 ;;; Copyright © 2017, 2018 Nikolai Merinov <nikolai.merinov@member.fsf.org>
7 ;;; Copyright © 2017, 2019, 2020 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org>
10 ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com>
11 ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages rust)
29 #:use-module (gnu packages base)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages bootstrap)
32 #:use-module (gnu packages cmake)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages curl)
35 #:use-module (gnu packages elf)
36 #:use-module (gnu packages flex)
37 #:use-module (gnu packages gcc)
38 #:use-module (gnu packages gdb)
39 #:use-module (gnu packages jemalloc)
40 #:use-module (gnu packages linux)
41 #:use-module (gnu packages llvm)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages ssh)
45 #:use-module (gnu packages tls)
46 #:use-module (gnu packages)
47 #:use-module (guix build-system cargo)
48 #:use-module (guix build-system gnu)
49 #:use-module (guix build-system trivial)
50 #:use-module (guix download)
51 #:use-module (guix git-download)
52 #:use-module ((guix licenses) #:prefix license:)
53 #:use-module (guix packages)
54 #:use-module ((guix build utils) #:select (alist-replace))
55 #:use-module (guix utils)
56 #:use-module (ice-9 match)
57 #:use-module (srfi srfi-26))
59 ;; This is the hash for the empty file, and the reason it's relevant is not
62 ;; The root of the problem is that Cargo keeps track of a file called
63 ;; Cargo.lock, that contains the hash of the tarball source of each dependency.
65 ;; However, tarball sources aren't handled well by Guix because of the need to
66 ;; patch shebangs in any helper scripts. This is why we use Cargo's vendoring
67 ;; capabilities, where instead of the tarball, a directory is provided in its
68 ;; place. (In the case of rustc, the source code already ships with vendored
69 ;; dependencies, but crates built with cargo-build-system undergo vendoring
72 ;; To preserve the advantages of checksumming, vendored dependencies contain
73 ;; a file called .cargo-checksum.json, which contains the hash of the tarball,
74 ;; as well as the list of files in it, with the hash of each file.
76 ;; The patch-cargo-checksums phase of cargo-build-system runs after
77 ;; any Guix-specific patches to the vendored dependencies and regenerates the
78 ;; .cargo-checksum.json files, but it's hard to know the tarball checksum that
79 ;; should be written to the file - and taking care of any unhandled edge case
80 ;; would require rebuilding everything that depends on rust. This is why we lie,
81 ;; and say that the tarball has the hash of an empty file. It's not a problem
82 ;; because cargo-build-system removes the Cargo.lock file. We can't do that
83 ;; for rustc because of a quirk of its build system, so we modify the lock file
84 ;; to substitute the hash.
85 (define %cargo-reference-hash
86 "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
88 (define* (nix-system->gnu-triplet-for-rust
89 #:optional (system (%current-system)))
91 ("x86_64-linux" "x86_64-unknown-linux-gnu")
92 ("i686-linux" "i686-unknown-linux-gnu")
93 ("armhf-linux" "armv7-unknown-linux-gnueabihf")
94 ("aarch64-linux" "aarch64-unknown-linux-gnu")
95 ("mips64el-linux" "mips64el-unknown-linux-gnuabi64")
96 (_ (nix-system->gnu-triplet system))))
98 (define* (rust-uri version #:key (dist "static"))
99 (string-append "https://" dist ".rust-lang.org/dist/"
100 "rustc-" version "-src.tar.gz"))
102 (define* (rust-bootstrapped-package base-rust version checksum)
103 "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST."
109 (inherit (package-source base-rust))
110 (uri (rust-uri version))
111 (sha256 (base32 checksum))))
113 (alist-replace "cargo-bootstrap" (list base-rust "cargo")
114 (alist-replace "rustc-bootstrap" (list base-rust)
115 (package-native-inputs base-rust))))))
117 (define-public mrustc
118 (let ((rustc-version "1.19.0"))
125 (url "https://github.com/thepowersgang/mrustc")
126 (commit (string-append "v" version))))
127 (file-name (git-file-name name version))
130 "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2"))))
131 (outputs '("out" "cargo"))
132 (build-system gnu-build-system)
138 ;; Required for the libstd sources.
139 ("rustc" ,(package-source rust-1.19))))
141 `(#:test-target "test"
143 (list ,(string-append "RUSTC_TARGET="
144 (or (%current-target-system)
145 (nix-system->gnu-triplet-for-rust))))
147 (modify-phases %standard-phases
148 (add-after 'unpack 'patch-date
150 (substitute* "Makefile"
151 (("shell date") "shell date -d @1"))
152 (substitute* "run_rustc/Makefile"
153 (("[$]Vtime ") "$V "))
155 (add-after 'patch-date 'unpack-target-compiler
156 (lambda* (#:key inputs outputs #:allow-other-keys)
157 (invoke "tar" "xf" (assoc-ref inputs "rustc"))
158 (chdir ,(string-append "rustc-" rustc-version "-src"))
159 (invoke "patch" "-p0" ,(string-append "../rustc-" rustc-version
162 (setenv "RUSTC_VERSION" ,rustc-version)
163 (setenv "MRUSTC_TARGET_VER"
164 ,(version-major+minor rustc-version))
165 (setenv "OUTDIR_SUF" "")
168 (lambda* (#:key inputs #:allow-other-keys)
169 (setenv "CC" (string-append (assoc-ref inputs "gcc")
171 (setenv "CXX" (string-append (assoc-ref inputs "gcc")
174 (add-after 'build 'build-minicargo
175 (lambda* (#:key make-flags #:allow-other-keys)
176 ;; TODO: minicargo.mk: RUSTC_VERSION=$(RUSTC_VERSION) RUSTC_CHANNEL=$(RUSTC_SRC_TY) OUTDIR_SUF=$(OUTDIR_SUF)
177 (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
178 (apply invoke "make" "-C" "tools/minicargo" make-flags)))
179 ;(add-after 'check 'check-locally
180 ; (lambda* (#:key make-flags #:allow-other-keys)
181 ; ;; The enum test wouldn't work otherwise.
182 ; ;; See <https://github.com/thepowersgang/mrustc/issues/137>.
183 ; (setenv "MRUSTC_TARGET_VER" ,(version-major+minor rustc-version))
184 ; (apply invoke "make" "local_tests" make-flags)))
186 (lambda* (#:key inputs outputs #:allow-other-keys)
187 (let* ((out (assoc-ref outputs "out"))
188 (bin (string-append out "/bin"))
189 (tools-bin (string-append out "/tools/bin"))
190 (cargo-out (assoc-ref outputs "cargo"))
191 (cargo-bin (string-append cargo-out "/bin"))
192 (lib (string-append out "/lib"))
193 (lib/rust (string-append lib "/mrust"))
194 (gcc (assoc-ref inputs "gcc"))
195 (run_rustc (string-append out
196 "/share/mrustc/run_rustc")))
197 ;; These files are not reproducible.
198 (for-each delete-file (find-files "output" "\\.txt$"))
199 ;(delete-file-recursively "output/local_tests")
200 (mkdir-p (dirname lib/rust))
201 (copy-recursively "output" lib/rust)
204 (install-file "bin/mrustc" bin)
205 ;; minicargo uses relative paths to resolve mrustc.
206 (install-file "tools/bin/minicargo" tools-bin)
207 (install-file "tools/bin/minicargo" cargo-bin)
209 (copy-file "run_rustc/Makefile"
210 (string-append run_rustc "/Makefile"))
212 (synopsis "Compiler for the Rust programming language")
213 (description "Rust is a systems programming language that provides memory
214 safety and thread safety guarantees.")
215 (home-page "https://github.com/thepowersgang/mrustc")
217 (license (list license:asl2.0 license:expat)))))
226 (uri (rust-uri "1.19.0"))
227 (sha256 (base32 "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1aswpvad81y8qm"))
228 (modules '((guix build utils)))
229 (snippet '(begin (delete-file-recursively "src/llvm") #t))
230 (patches (search-patches "rust-1.19-mrustc.patch"))))
231 (outputs '("out" "cargo"))
232 (properties '((timeout . 72000) ;20 hours
233 (max-silent-time . 18000))) ;5 hours (for armel)
235 `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
236 #:modules ((guix build utils) (ice-9 match) (guix build gnu-build-system))
238 (modify-phases %standard-phases
239 (add-after 'unpack 'set-env
240 (lambda* (#:key inputs #:allow-other-keys)
241 ;; Disable test for cross compilation support.
242 (setenv "CFG_DISABLE_CROSS_TESTS" "1")
243 (setenv "SHELL" (which "sh"))
244 (setenv "CONFIG_SHELL" (which "sh"))
245 (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc"))
246 ;; guix llvm-3.9.1 package installs only shared libraries
247 (setenv "LLVM_LINK_SHARED" "1")
249 (add-after 'unpack 'patch-cargo-tomls
250 (lambda* (#:key inputs outputs #:allow-other-keys)
251 (substitute* "src/librustc_errors/Cargo.toml"
252 (("[[]dependencies[]]") "
256 (substitute* "src/librustc/Cargo.toml"
257 (("[[]dependencies[]]") "
259 getopts = { path = \"../libgetopts\" }
261 (substitute* "src/librustdoc/Cargo.toml"
262 (("[[]dependencies[]]") "
264 test = { path = \"../libtest\" }
267 (add-after 'unpack 'patch-tests
268 (lambda* (#:key inputs #:allow-other-keys)
269 (let ((bash (assoc-ref inputs "bash")))
270 (substitute* "src/libstd/process.rs"
271 ;; The newline is intentional.
272 ;; There's a line length "tidy" check in Rust which would
274 (("\"/bin/sh\"") (string-append "\n\"" bash "/bin/sh\"")))
275 (substitute* "src/libstd/net/tcp.rs"
276 ;; There is no network in build environment
277 (("fn connect_timeout_unroutable")
278 "#[ignore]\nfn connect_timeout_unroutable"))
279 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00222.html>
280 (substitute* "src/libstd/sys/unix/process/process_common.rs"
281 (("fn test_process_mask") "#[allow(unused_attributes)]
283 fn test_process_mask"))
285 (add-after 'patch-tests 'patch-aarch64-test
287 (substitute* "src/librustc_back/dynamic_lib.rs"
288 ;; This test is known to fail on aarch64 and powerpc64le:
289 ;; https://github.com/rust-lang/rust/issues/45410
290 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
292 (add-after 'patch-tests 'use-readelf-for-tests
294 ;; nm doesn't recognize the file format because of the
295 ;; nonstandard sections used by the Rust compiler, but readelf
297 (substitute* "src/test/run-make/atomic-lock-free/Makefile"
301 (add-after 'patch-tests 'remove-unsupported-tests
303 ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
304 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
305 (delete-file-recursively "src/test/run-make/linker-output-non-utf8")
307 (add-after 'patch-source-shebangs 'patch-cargo-checksums
309 (use-modules (guix build cargo-utils))
310 (substitute* "src/Cargo.lock"
311 (("(\"checksum .* = )\".*\"" all name)
312 (string-append name "\"" ,%cargo-reference-hash "\"")))
313 (generate-all-checksums "src/vendor")
315 ;; This phase is overridden by newer versions.
318 ;; This phase is overridden by newer versions.
320 (lambda* (#:key inputs outputs #:allow-other-keys)
321 (let ((rustc-bootstrap (assoc-ref inputs "rustc-bootstrap")))
322 (setenv "CFG_COMPILER_HOST_TRIPLE"
323 ,(nix-system->gnu-triplet (%current-system)))
324 (setenv "CFG_RELEASE" "")
325 (setenv "CFG_RELEASE_CHANNEL" "stable")
326 (setenv "CFG_LIBDIR_RELATIVE" "lib")
327 (setenv "CFG_VERSION" "1.19.0-stable-mrustc")
328 (setenv "MRUSTC_TARGET_VER" ,(version-major+minor version))
329 ; bad: (setenv "CFG_PREFIX" "mrustc") ; FIXME output path.
331 ;; mrustc 0.9 doesn't check the search paths for crates anymore.
332 (copy-recursively (string-append rustc-bootstrap "/lib/mrust")
334 (invoke (string-append rustc-bootstrap "/tools/bin/minicargo")
335 "src/rustc" "--vendor-dir" "src/vendor"
336 "--output-dir" "output/rustc-build"
337 "-L" (string-append rustc-bootstrap "/lib/mrust")
339 (setenv "CFG_COMPILER_HOST_TRIPLE" #f)
340 (setenv "CFG_RELEASE" #f)
341 (setenv "CFG_RELEASE_CHANNEL" #f)
342 (setenv "CFG_VERSION" #f)
343 (setenv "CFG_PREFIX" #f)
344 (setenv "CFG_LIBDIR_RELATIVE" #f)
345 (invoke (string-append rustc-bootstrap "/tools/bin/minicargo")
346 "src/tools/cargo" "--vendor-dir" "src/vendor"
347 "--output-dir" "output/cargo-build"
349 "-L" (string-append rustc-bootstrap "/lib/mrust")
351 ;; Now use the newly-built rustc to build the libraries.
352 ;; One day that could be replaced by:
353 ;; (invoke "output/cargo-build/cargo" "build"
354 ;; "--manifest-path" "src/bootstrap/Cargo.toml"
355 ;; "--verbose") ; "--locked" "--frozen"
356 ;; but right now, Cargo has problems with libstd's circular
358 (mkdir-p "output/target-libs")
359 (for-each (match-lambda
364 "output/rustc-build/rustc"
365 "-C" (string-append "linker="
367 ;; Required for libterm.
368 "-Z" "force-unstable-if-unmarked"
369 "-L" "output/target-libs"
370 (string-append "src/" name "/lib.rs")
372 (string-append "output/target-libs/"
373 (car (string-split name #\/))
381 ("liblibc/src" "--cfg" "stdbuild")
382 ("libunwind" "-l" "gcc_s")
383 ("libcompiler_builtins")
386 ;; Uses "cc" to link.
387 ("libstd" "-l" "dl" "-l" "rt" "-l" "pthread")
390 ;; Test dependencies:
396 ;; This phase is overridden by newer versions.
399 ;; This phase is overridden by newer versions.
401 (lambda* (#:key inputs outputs #:allow-other-keys)
402 (let* ((out (assoc-ref outputs "out"))
403 (target-system ,(or (%current-target-system)
404 (nix-system->gnu-triplet
406 (out-libs (string-append out "/lib/rustlib/"
407 target-system "/lib")))
408 ;(setenv "CFG_PREFIX" out)
410 (copy-recursively "output/target-libs" out-libs)
411 (install-file "output/rustc-build/rustc"
412 (string-append out "/bin"))
413 (install-file "output/rustc-build/rustdoc"
414 (string-append out "/bin"))
415 (install-file "output/cargo-build/cargo"
416 (string-append (assoc-ref outputs "cargo")
419 (build-system gnu-build-system)
421 `(("bison" ,bison) ; For the tests
422 ("cmake" ,cmake-minimal)
423 ("flex" ,flex) ; For the tests
424 ;; FIXME: Rust 1.27 and some later versions require GDB 8.2 specifically.
425 ;; See <https://bugs.gnu.org/37810>. Use it on all Rusts for simplicity.
426 ("gdb" ,gdb-8.2) ; For the tests
427 ("procps" ,procps) ; For the tests
428 ("python-2" ,python-2)
429 ("rustc-bootstrap" ,mrustc)
430 ("cargo-bootstrap" ,mrustc "cargo")
431 ("pkg-config" ,pkg-config) ; For "cargo"
434 `(("jemalloc" ,jemalloc-4.5.0)
436 ("openssl" ,openssl-1.0)
437 ("libssh2" ,libssh2) ; For "cargo"
438 ("libcurl" ,curl))) ; For "cargo"
440 ;; rustc invokes gcc, so we need to set its search paths accordingly.
441 ;; Note: duplicate its value here to cope with circular dependencies among
442 ;; modules (see <https://bugs.gnu.org/31392>).
444 (list (search-path-specification
445 (variable "C_INCLUDE_PATH")
446 (files '("include")))
447 (search-path-specification
448 (variable "CPLUS_INCLUDE_PATH")
449 (files '("include/c++" "include")))
450 (search-path-specification
451 (variable "LIBRARY_PATH")
452 (files '("lib" "lib64")))))
454 (synopsis "Compiler for the Rust progamming language")
455 (description "Rust is a systems programming language that provides memory
456 safety and thread safety guarantees.")
457 (home-page "https://www.rust-lang.org")
459 (license (list license:asl2.0 license:expat))))
461 (define-public rust-1.20
463 (rust-bootstrapped-package rust-1.19 "1.20.0"
464 "0542y4rnzlsrricai130mqyxl8r6rd991frb4qsnwb27yigqg91a")))
469 (inherit (package-source base-rust))
471 (delete-file-recursively "src/jemalloc")
472 (delete-file-recursively "src/llvm")
476 `(;; The tests fail with newer versions of GNU Make.
477 ("make" ,gnu-make-4.2)
478 ,@(package-native-inputs base-rust)))
479 (outputs '("out" "doc" "cargo"))
480 ;; Since rust-1.19 is local, it's quite probable that Hydra
481 ;; will build rust-1.19 only as a dependency of rust-1.20.
482 ;; But then Hydra will use the wrong properties, the ones here,
483 ;; for rust-1.19. Therefore, we copied the properties of
485 (properties '((timeout . 72000) ;20 hours
486 (max-silent-time . 18000))) ;5 hours (for armel)
488 (substitute-keyword-arguments (package-arguments rust-1.19)
490 `(modify-phases ,phases
491 (add-after 'patch-tests 'patch-cargo-tests
493 (substitute* "src/tools/cargo/tests/build.rs"
494 (("/usr/bin/env") (which "env"))
495 ;; Guix llvm is compiled without asmjs-unknown-emscripten.
496 (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs"))
497 (substitute* "src/tools/cargo/tests/death.rs"
498 ;; This is stuck when built in container.
499 (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
500 ;; Prints test output in the wrong order when built on
502 (substitute* "src/tools/cargo/tests/test.rs"
503 (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
505 ;; These tests pull in a dependency on "git", which changes
506 ;; too frequently take part in the Rust toolchain.
507 (substitute* "src/tools/cargo/tests/new.rs"
508 (("fn author_prefers_cargo") "#[ignore]\nfn author_prefers_cargo")
509 (("fn finds_author_git") "#[ignore]\nfn finds_author_git")
510 (("fn finds_local_author_git") "#[ignore]\nfn finds_local_author_git"))
512 (add-after 'patch-cargo-tests 'ignore-glibc-2.27-incompatible-test
513 ;; https://github.com/rust-lang/rust/issues/47863
515 (substitute* "src/test/run-pass/out-of-stack.rs"
516 (("// ignore-android") "// ignore-test\n// ignore-android"))
519 (lambda* (#:key inputs outputs #:allow-other-keys)
520 (let* ((out (assoc-ref outputs "out"))
521 (doc (assoc-ref outputs "doc"))
522 (gcc (assoc-ref inputs "gcc"))
523 (gdb (assoc-ref inputs "gdb"))
524 (binutils (assoc-ref inputs "binutils"))
525 (python (assoc-ref inputs "python-2"))
526 (rustc (assoc-ref inputs "rustc-bootstrap"))
527 (cargo (assoc-ref inputs "cargo-bootstrap"))
528 (llvm (assoc-ref inputs "llvm"))
529 (jemalloc (assoc-ref inputs "jemalloc")))
530 (call-with-output-file "config.toml"
532 (display (string-append "
535 cargo = \"" cargo "/bin/cargo" "\"
536 rustc = \"" rustc "/bin/rustc" "\"
538 python = \"" python "/bin/python2" "\"
539 gdb = \"" gdb "/bin/gdb" "\"
544 docdir = \"" doc "/share/doc/rust" "\"
547 default-linker = \"" gcc "/bin/gcc" "\"
550 " ;; There are 2 failed codegen tests:
551 ;; codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs
552 ;; These tests require a patched LLVM
553 "codegen-tests = false
554 [target." ,(nix-system->gnu-triplet-for-rust) "]
555 llvm-config = \"" llvm "/bin/llvm-config" "\"
556 cc = \"" gcc "/bin/gcc" "\"
557 cxx = \"" gcc "/bin/g++" "\"
558 ar = \"" binutils "/bin/ar" "\"
559 jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\"
563 (add-after 'configure 'provide-cc
564 (lambda* (#:key inputs #:allow-other-keys)
565 (symlink (string-append (assoc-ref inputs "gcc") "/bin/gcc")
567 (setenv "PATH" (string-append "/tmp:" (getenv "PATH")))
569 (add-after 'provide-cc 'configure-archiver
570 (lambda* (#:key inputs #:allow-other-keys)
571 (substitute* "src/build_helper/lib.rs"
572 ;; Make sure "ar" is always used as the archiver.
573 (("\"musl\"") "\"\"")
574 ;; Then substitute "ar" by our name.
575 (("\"ar\"") (string-append "\""
576 (assoc-ref inputs "binutils")
579 (delete 'patch-cargo-tomls)
580 (add-before 'build 'reset-timestamps-after-changes
584 ;; Rust 1.20.0 treats timestamp 0 as "file doesn't exist".
585 ;; Therefore, use timestamp 1.
586 (utime filename 1 1 1 1))
587 (find-files "." #:directories? #t))
591 (invoke "./x.py" "build")
592 (invoke "./x.py" "build" "src/tools/cargo")))
595 ;; Disable parallel execution to prevent EAGAIN errors when
597 (invoke "./x.py" "-j1" "test" "-vv")
598 (invoke "./x.py" "-j1" "test" "src/tools/cargo")
601 (lambda* (#:key outputs #:allow-other-keys)
602 (invoke "./x.py" "install")
603 (substitute* "config.toml"
604 ;; replace prefix to specific output
605 (("prefix = \"[^\"]*\"")
606 (string-append "prefix = \"" (assoc-ref outputs "cargo") "\"")))
607 (invoke "./x.py" "install" "cargo")))
608 (add-after 'install 'delete-install-logs
609 (lambda* (#:key outputs #:allow-other-keys)
610 (define (delete-manifest-file out-path file)
611 (delete-file (string-append out-path "/lib/rustlib/" file)))
613 (let ((out (assoc-ref outputs "out"))
614 (cargo-out (assoc-ref outputs "cargo")))
616 (lambda (file) (delete-manifest-file out file))
619 "manifest-rust-std-x86_64-unknown-linux-gnu"
622 (lambda (file) (delete-manifest-file cargo-out file))
626 (add-after 'install 'wrap-rustc
627 (lambda* (#:key inputs outputs #:allow-other-keys)
628 (let ((out (assoc-ref outputs "out"))
629 (libc (assoc-ref inputs "libc"))
630 (ld-wrapper (assoc-ref inputs "ld-wrapper")))
631 ;; Let gcc find ld and libc startup files.
632 (wrap-program (string-append out "/bin/rustc")
633 `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
634 `("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
637 (define-public rust-1.21
638 (let ((base-rust (rust-bootstrapped-package rust-1.20 "1.21.0"
639 "1yj8lnxybjrybp00fqhxw8fpr641dh8wcn9mk44xjnsb4i1c21qp")))
643 (substitute-keyword-arguments (package-arguments base-rust)
645 `(modify-phases ,phases
646 (add-after 'configure 'remove-ar
647 (lambda* (#:key inputs #:allow-other-keys)
648 ;; Remove because toml complains about "unknown field".
649 (substitute* "config.toml"
653 (define-public rust-1.22
654 (let ((base-rust (rust-bootstrapped-package rust-1.21 "1.22.1"
655 "1lrzzp0nh7s61wgfs2h6ilaqi6iq89f1pd1yaf65l87bssyl4ylb")))
659 (substitute-keyword-arguments (package-arguments base-rust)
661 `(modify-phases ,phases
662 (add-after 'unpack 'remove-flaky-test
664 ;; See <https://github.com/rust-lang/rust/issues/43402>.
665 (when (file-exists? "src/test/run-make/issue-26092")
666 (delete-file-recursively "src/test/run-make/issue-26092"))
669 (define-public rust-1.23
670 (let ((base-rust (rust-bootstrapped-package rust-1.22 "1.23.0"
671 "14fb8vhjzsxlbi6yrn1r6fl5dlbdd1m92dn5zj5gmzfwf4w9ar3l")))
675 (substitute-keyword-arguments (package-arguments base-rust)
677 `(modify-phases ,phases
678 (delete 'configure-archiver)
680 (add-after 'unpack 'dont-build-native
682 ;; XXX: Revisit this when we use gcc 6.
683 (substitute* "src/binaryen/CMakeLists.txt"
684 (("ADD_COMPILE_FLAG\\(\\\"-march=native\\\"\\)") ""))
687 (define-public rust-1.24
689 (rust-bootstrapped-package rust-1.23 "1.24.1"
690 "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y")))
694 (substitute-keyword-arguments (package-arguments base-rust)
696 `(modify-phases ,phases
697 (delete 'use-readelf-for-tests)
698 (replace 'patch-aarch64-test
700 (substitute* "src/librustc_metadata/dynamic_lib.rs"
701 ;; This test is known to fail on aarch64 and powerpc64le:
702 ;; https://github.com/rust-lang/rust/issues/45410
703 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
706 ;;; Rust 1.25 release support work with llvm 6--but build with llvm 6 is
707 ;;; not determenistic due to <https://github.com/rust-lang/rust/issues/50556>.
708 ;;; Keep using llvm 3.9.1 until builds become determenistic
709 (define-public rust-1.25
711 (rust-bootstrapped-package rust-1.24 "1.25.0"
712 "0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf")))
717 (inherit (package-source base-rust))
719 (delete-file-recursively "src/jemalloc")
720 (delete-file-recursively "src/llvm")
721 (delete-file-recursively "src/llvm-emscripten")
723 (patches (search-patches
724 "rust-1.25-accept-more-detailed-gdb-lines.patch"))))
726 (substitute-keyword-arguments (package-arguments base-rust)
728 `(modify-phases ,phases
729 (add-after 'patch-cargo-tests 'patch-cargo-index-update
731 (substitute* "src/tools/cargo/tests/generate-lockfile.rs"
732 ;; This test wants to update the crate index.
733 (("fn no_index_update") "#[ignore]\nfn no_index_update"))
735 (replace 'patch-aarch64-test
737 (substitute* "src/librustc_metadata/dynamic_lib.rs"
738 ;; This test is known to fail on aarch64 and powerpc64le:
739 ;; https://github.com/rust-lang/rust/issues/45410
740 (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine"))
741 ;; This test fails on aarch64 with llvm@6.0:
742 ;; https://github.com/rust-lang/rust/issues/49807
743 ;; other possible solution:
744 ;; https://github.com/rust-lang/rust/pull/47688
745 (delete-file "src/test/debuginfo/by-value-self-argument-in-trait-impl.rs")
747 (delete 'ignore-glibc-2.27-incompatible-test))))))))
749 (define-public rust-1.26
751 (rust-bootstrapped-package rust-1.25 "1.26.2"
752 "0047ais0fvmqvngqkdsxgrzhb0kljg8wy85b01kbbjc88hqcz7pv")))
757 (inherit (package-source base-rust))
758 (patches (search-patches
759 "rust-coresimd-doctest.patch"
760 "rust-1.25-accept-more-detailed-gdb-lines.patch"))))
762 (alist-replace "openssl" (list openssl)
763 (package-inputs base-rust)))
765 (substitute-keyword-arguments (package-arguments base-rust)
767 `(modify-phases ,phases
768 ;; binaryen was replaced with LLD project from LLVM
769 (delete 'dont-build-native)
772 ;; Enable parallel execution.
773 (let ((parallel-job-spec
774 (string-append "-j" (number->string
776 (parallel-job-count))))))
777 (invoke "./x.py" parallel-job-spec "test" "-vv")
778 (invoke "./x.py" parallel-job-spec "test"
779 "src/tools/cargo"))))
780 (replace 'remove-unsupported-tests
782 ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH.
783 ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html>
784 (delete-file-recursively "src/test/run-make-fulldeps/linker-output-non-utf8")
786 (replace 'patch-cargo-tests
788 (substitute* "src/tools/cargo/tests/testsuite/build.rs"
789 (("/usr/bin/env") (which "env"))
790 ;; Guix llvm is compiled without asmjs-unknown-emscripten.
791 (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs"))
792 (substitute* "src/tools/cargo/tests/testsuite/death.rs"
793 ;; This is stuck when built in container.
794 (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone"))
795 ;; Prints test output in the wrong order when built on
797 (substitute* "src/tools/cargo/tests/testsuite/test.rs"
798 (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env"))
800 ;; Avoid dependency on "git".
801 (substitute* "src/tools/cargo/tests/testsuite/new.rs"
802 (("fn author_prefers_cargo") "#[ignore]\nfn author_prefers_cargo")
803 (("fn finds_author_git") "#[ignore]\nfn finds_author_git")
804 (("fn finds_local_author_git") "#[ignore]\nfn finds_local_author_git"))
806 (add-after 'patch-cargo-tests 'disable-cargo-test-for-nightly-channel
808 ;; This test failed to work on "nightly" channel builds
809 ;; https://github.com/rust-lang/cargo/issues/5648
810 (substitute* "src/tools/cargo/tests/testsuite/resolve.rs"
811 (("fn test_resolving_minimum_version_with_transitive_deps")
812 "#[ignore]\nfn test_resolving_minimum_version_with_transitive_deps"))
814 (replace 'patch-cargo-index-update
816 (substitute* "src/tools/cargo/tests/testsuite/generate_lockfile.rs"
817 ;; This test wants to update the crate index.
818 (("fn no_index_update") "#[ignore]\nfn no_index_update"))
821 (define-public rust-1.27
823 (rust-bootstrapped-package rust-1.26 "1.27.2"
824 "0pg1s37bhx9zqbynxyydq5j6q7kij9vxkcv8maz0m25prm88r0cs")))
829 (inherit (package-source base-rust))
830 (patches (search-patches "rust-coresimd-doctest.patch"
831 "rust-bootstrap-stage0-test.patch"
832 "rust-1.25-accept-more-detailed-gdb-lines.patch"
833 "rust-reproducible-builds.patch"))))
835 (substitute-keyword-arguments (package-arguments base-rust)
837 `(modify-phases ,phases
838 (add-before 'install 'mkdir-prefix-paths
839 (lambda* (#:key outputs #:allow-other-keys)
840 ;; As result of https://github.com/rust-lang/rust/issues/36989
841 ;; `prefix' directory should exist before `install' call
842 (mkdir-p (assoc-ref outputs "out"))
843 (mkdir-p (assoc-ref outputs "cargo"))
845 (add-after 'patch-cargo-tests 'disable-thinlto-test
847 ;; thinlto required llvm 6.0 for work
848 (substitute* "src/tools/cargo/tests/testsuite/path.rs"
849 (("fn thin_lto_works") "#[ignore]\nfn thin_lto_works"))
852 (define-public rust-1.28
854 (rust-bootstrapped-package rust-1.27 "1.28.0"
855 "11k4rn77bca2rikykkk9fmprrgjswd4x4kaq7fia08vgkir82nhx")))
860 (inherit (package-source base-rust))
861 (patches (search-patches "rust-coresimd-doctest.patch"
862 "rust-bootstrap-stage0-test.patch"
863 "rust-1.25-accept-more-detailed-gdb-lines.patch"
864 "rust-reproducible-builds.patch"))))
867 (alist-replace "llvm" (list llvm-6)
868 (package-inputs base-rust)))
870 (substitute-keyword-arguments (package-arguments base-rust)
872 `(modify-phases ,phases
873 (add-after 'configure 'enable-codegen-tests
874 ;; Codegen tests should pass with llvm 6, so enable them.
876 (substitute* "config.toml"
877 (("codegen-tests = false") ""))
879 (add-after 'patch-tests 'disable-amd64-avx-test
880 ;; That test would fail on x86_64 machines without avx.
882 (substitute* "src/test/run-pass/issue-44056.rs"
883 (("only-x86_64") "ignore-test"))
885 ;; This is no longer needed as of 1.28
886 (delete 'disable-cargo-test-for-nightly-channel)
887 ;; The thinlto test should pass with llvm 6.
888 (delete 'disable-thinlto-test))))))))
890 (define-public rust-1.29
892 (rust-bootstrapped-package rust-1.28 "1.29.2"
893 "1jb787080z754caa2w3w1amsygs4qlzj9rs1vy64firfmabfg22h")))
898 (inherit (package-source base-rust))
899 (patches (search-patches "rust-1.25-accept-more-detailed-gdb-lines.patch"
900 "rust-reproducible-builds.patch")))))))
902 (define-public rust-1.30
904 (rust-bootstrapped-package rust-1.29 "1.30.1"
905 "0aavdc1lqv0cjzbqwl5n59yd0bqdlhn0zas61ljf38yrvc18k8rn")))
910 (inherit (package-source base-rust))
912 (delete-file-recursively "src/jemalloc")
913 (delete-file-recursively "src/llvm")
914 (delete-file-recursively "src/llvm-emscripten")
915 (delete-file-recursively "src/tools/clang")
916 (delete-file-recursively "src/tools/lldb")
919 (substitute-keyword-arguments (package-arguments base-rust)
921 `(modify-phases ,phases
922 (add-after 'patch-cargo-tests 'patch-cargo-env-shebang
923 (lambda* (#:key inputs #:allow-other-keys)
924 (let ((coreutils (assoc-ref inputs "coreutils")))
925 (substitute* "src/tools/cargo/tests/testsuite/fix.rs"
926 ;; Cargo has a test which explicitly sets a
927 ;; RUSTC_WRAPPER environment variable which points
928 ;; to /usr/bin/env. Since it's not a shebang, it
929 ;; needs to be manually patched
930 (("\"/usr/bin/env\"")
931 (string-append "\"" coreutils "/bin/env\"")))
933 (add-after 'patch-cargo-env-shebang 'ignore-cargo-package-tests
935 (substitute* "src/tools/cargo/tests/testsuite/package.rs"
936 ;; These tests largely check that cargo outputs warning/error
937 ;; messages as expected. It seems that cargo outputs an
938 ;; absolute path to something in the store instead of the
939 ;; expected relative path (e.g. `[..]`) so we'll ignore
941 (("fn include") "#[ignore]\nfn include")
942 (("fn exclude") "#[ignore]\nfn exclude"))
944 ;; The test has been moved elsewhere.
945 (replace 'disable-amd64-avx-test
947 (substitute* "src/test/ui/run-pass/issues/issue-44056.rs"
948 (("only-x86_64") "ignore-test"))
951 (define (patch-command-exec-tests-phase test-path)
952 "The command-exec.rs test moves around between releases. We need to apply
953 a Guix-specific patch to it for each release. This function generates the phase
954 that applies said patch, parametrized by the test-path. This is done this way
955 because the phase is more complex than the equivalents for other tests that
957 `(lambda* (#:key inputs #:allow-other-keys)
958 (let ((coreutils (assoc-ref inputs "coreutils")))
959 (substitute* ,test-path
960 ;; This test suite includes some tests that the stdlib's
961 ;; `Command` execution properly handles situations where
962 ;; the environment or PATH variable are empty, but this
963 ;; fails since we don't have `echo` available in the usual
964 ;; Linux directories.
965 ;; NB: the leading space is so we don't fail a tidy check
966 ;; for trailing whitespace, and the newlines are to ensure
967 ;; we don't exceed the 100 chars tidy check as well
968 ((" Command::new\\(\"echo\"\\)")
969 (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n")))
972 (define-public rust-1.31
974 (rust-bootstrapped-package rust-1.30 "1.31.1"
975 "0sk84ff0cklybcp0jbbxcw7lk7mrm6kb6km5nzd6m64dy0igrlli")))
979 (substitute-keyword-arguments (package-arguments base-rust)
981 `(modify-phases ,phases
982 (add-after 'patch-tests 'patch-command-exec-tests
983 ,(patch-command-exec-tests-phase
984 "src/test/run-pass/command-exec.rs"))
985 ;; The test has been moved elsewhere.
986 (replace 'disable-amd64-avx-test
988 (substitute* "src/test/ui/issues/issue-44056.rs"
989 (("only-x86_64") "ignore-test"))
991 (add-after 'patch-tests 'patch-process-docs-rev-cmd
993 ;; Disable some doc tests which depend on the "rev" command
994 ;; https://github.com/rust-lang/rust/pull/58746
995 (substitute* "src/libstd/process.rs"
996 (("```rust") "```rust,no_run"))
999 (define-public rust-1.32
1001 (rust-bootstrapped-package rust-1.31 "1.32.0"
1002 "0ji2l9xv53y27xy72qagggvq47gayr5lcv2jwvmfirx029vlqnac")))
1007 (inherit (package-source base-rust))
1008 (snippet '(begin (delete-file-recursively "src/llvm")
1009 (delete-file-recursively "src/llvm-emscripten")
1010 (delete-file-recursively "src/tools/clang")
1011 (delete-file-recursively "src/tools/lldb")
1012 (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
1014 (patches (search-patches "rust-reproducible-builds.patch"))
1015 ;; the vendor directory has moved to the root of
1016 ;; the tarball, so we have to strip an extra prefix
1017 (patch-flags '("-p2"))))
1019 ;; Downgrade to LLVM 6, all LTO tests appear to fail with LLVM 7.0.1
1020 (alist-replace "llvm" (list llvm-6)
1021 (package-inputs base-rust)))
1023 (substitute-keyword-arguments (package-arguments base-rust)
1025 `(modify-phases ,phases
1026 ;; Cargo.lock and the vendor/ directory have been moved to the
1027 ;; root of the rust tarball
1028 (replace 'patch-cargo-checksums
1030 (use-modules (guix build cargo-utils))
1031 (substitute* "Cargo.lock"
1032 (("(\"checksum .* = )\".*\"" all name)
1033 (string-append name "\"" ,%cargo-reference-hash "\"")))
1034 (generate-all-checksums "vendor")
1036 (add-after 'enable-codegen-tests 'override-jemalloc
1037 (lambda* (#:key inputs #:allow-other-keys)
1038 ;; The compiler is no longer directly built against jemalloc,
1039 ;; but rather via the jemalloc-sys crate (which vendors the
1040 ;; jemalloc source). To use jemalloc we must enable linking to
1041 ;; it (otherwise it would use the system allocator), and set
1042 ;; an environment variable pointing to the compiled jemalloc.
1043 (substitute* "config.toml"
1044 (("^jemalloc =.*$") "")
1045 (("[[]rust[]]") "\n[rust]\njemalloc=true\n"))
1046 (setenv "JEMALLOC_OVERRIDE" (string-append (assoc-ref inputs "jemalloc")
1047 "/lib/libjemalloc_pic.a"))
1049 ;; Remove no longer relevant steps
1050 (delete 'remove-flaky-test)
1051 (delete 'patch-aarch64-test))))))))
1053 (define-public rust-1.33
1055 (rust-bootstrapped-package rust-1.32 "1.33.0"
1056 "152x91mg7bz4ygligwjb05fgm1blwy2i70s2j03zc9jiwvbsh0as")))
1061 (inherit (package-source base-rust))
1063 (patch-flags '("-p1"))))
1065 ;; Upgrade to jemalloc@5.1.0
1066 (alist-replace "jemalloc" (list jemalloc)
1067 (package-inputs base-rust)))
1069 (substitute-keyword-arguments (package-arguments base-rust)
1071 `(modify-phases ,phases
1072 (delete 'ignore-cargo-package-tests)
1073 (add-after 'configure 'configure-test-threads
1074 ;; Several rustc and cargo tests will fail if run on one core
1075 ;; https://github.com/rust-lang/rust/issues/59122
1076 ;; https://github.com/rust-lang/cargo/issues/6746
1077 ;; https://github.com/rust-lang/rust/issues/58907
1078 (lambda* (#:key inputs #:allow-other-keys)
1079 (setenv "RUST_TEST_THREADS" "2")
1082 (define-public rust-1.34
1084 (rust-bootstrapped-package rust-1.33 "1.34.1"
1085 "19s09k7y5j6g3y4d2rk6kg9pvq6ml94c49w6b72dmq8p9lk8bixh")))
1090 (inherit (package-source base-rust))
1092 (delete-file-recursively "src/llvm-emscripten")
1093 (delete-file-recursively "src/llvm-project")
1094 (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
1097 (define-public rust-1.35
1099 (rust-bootstrapped-package rust-1.34 "1.35.0"
1100 "0bbizy6b7002v1rdhrxrf5gijclbyizdhkglhp81ib3bf5x66kas")))
1104 (alist-replace "llvm" (list llvm-8)
1105 (package-inputs base-rust)))
1107 (substitute-keyword-arguments (package-arguments base-rust)
1109 `(modify-phases ,phases
1110 ;; The tidy test includes a pass which ensures large binaries
1111 ;; don't accidentally get checked into the rust git repo.
1112 ;; Unfortunately the test assumes that git is always available,
1113 ;; so we'll comment out the invocation of this pass.
1114 (add-after 'configure 'disable-tidy-bins-check
1116 (substitute* "src/tools/tidy/src/main.rs"
1117 (("bins::check") "//bins::check"))
1120 (define-public rust-1.36
1122 (rust-bootstrapped-package rust-1.35 "1.36.0"
1123 "06xv2p6zq03lidr0yaf029ii8wnjjqa894nkmrm6s0rx47by9i04")))
1127 (substitute-keyword-arguments (package-arguments base-rust)
1129 `(modify-phases ,phases
1130 (delete 'patch-process-docs-rev-cmd))))))))
1132 (define-public rust-1.37
1134 (rust-bootstrapped-package rust-1.36 "1.37.0"
1135 "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj")))
1139 (substitute-keyword-arguments (package-arguments base-rust)
1141 `(modify-phases ,phases
1142 (add-before 'configure 'configure-cargo-home
1144 (let ((cargo-home (string-append (getcwd) "/.cargo")))
1145 (mkdir-p cargo-home)
1146 (setenv "CARGO_HOME" cargo-home)
1149 (define-public rust-1.38
1151 (rust-bootstrapped-package rust-1.37 "1.38.0"
1152 "101dlpsfkq67p0hbwx4acqq6n90dj4bbprndizpgh1kigk566hk4")))
1156 (alist-replace "llvm" (list llvm-9)
1157 (package-inputs base-rust)))
1159 (substitute-keyword-arguments (package-arguments base-rust)
1161 `(modify-phases ,phases
1162 (replace 'patch-command-exec-tests
1163 ,(patch-command-exec-tests-phase
1164 "src/test/ui/command-exec.rs"))
1165 (add-after 'patch-tests 'patch-command-uid-gid-test
1167 (substitute* "src/test/ui/command-uid-gid.rs"
1168 (("/bin/sh") (which "sh"))
1169 (("ignore-sgx") "ignore-sgx\n// ignore-tidy-linelength"))
1172 (define-public rust-1.39
1174 (rust-bootstrapped-package rust-1.38 "1.39.0"
1175 "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl")))
1179 (substitute-keyword-arguments (package-arguments base-rust)
1181 `(modify-phases ,phases
1182 (replace 'patch-cargo-checksums
1183 ;; The Cargo.lock format changed.
1185 (use-modules (guix build cargo-utils))
1186 (substitute* "Cargo.lock"
1187 (("(checksum = )\".*\"" all name)
1188 (string-append name "\"" ,%cargo-reference-hash "\"")))
1189 (generate-all-checksums "vendor")
1192 (define-public rust-1.40
1194 (rust-bootstrapped-package rust-1.39 "1.40.0"
1195 "1ba9llwhqm49w7sz3z0gqscj039m53ky9wxzhaj11z6yg1ah15yx")))
1200 (inherit (package-source base-rust))
1201 ;; llvm-emscripten is no longer bundled, as that codegen backend
1204 (delete-file-recursively "src/llvm-project")
1205 (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
1208 ;; Rust 1.40 does not ship rustc-internal libraries by default
1209 ;; (see rustc-dev-split). This means that librustc_driver.so is no
1210 ;; longer available in lib/rustlib/$target/lib, which is the directory
1211 ;; included in the runpath of librustc_codegen_llvm-llvm.so.
1212 ;; This is detected by our validate-runpath phase as an error, but it
1213 ;; is harmless as the codegen backend is loaded by librustc_driver.so
1214 ;; itself, which must at that point have been already loaded.
1215 ;; As such, we skip validating the runpath for Rust 1.40.
1216 ;; Rust 1.41 stopped putting the codegen backend in a separate library,
1217 ;; which makes this workaround only necessary for this release.
1218 (cons* #:validate-runpath? #f
1219 (substitute-keyword-arguments (package-arguments base-rust)
1221 `(modify-phases ,phases
1222 ;; We often need to patch tests with various Guix-specific paths.
1223 ;; This often increases the line length and makes tidy, rustc's
1224 ;; style checker, complain. We could insert additional newlines
1225 ;; or add an "// ignore-tidy-linelength" comment, but as an
1226 ;; ignore comment must be used, both approaches are fragile due
1227 ;; to upstream formatting changes. As such, disable running the
1228 ;; linter during tests, since it's intended for rustc developers
1231 ;; TODO(rebuild-rust): This phase could be added earlier to
1232 ;; simplify a significant amount of code, but it would require
1233 ;; rebuilding the entire rusty universe.
1234 (add-after 'patch-tests 'neuter-tidy
1236 (substitute* "src/bootstrap/builder.rs"
1237 (("^.*::Tidy,") ""))
1239 ;; TODO(rebuild-rust): Adapt the find-files approach for
1240 ;; earlier testsuite patches.
1241 (replace 'patch-command-uid-gid-test
1243 (match (find-files "src/test" "command-uid-gid\\.rs")
1246 (("/bin/sh") (which "sh")))))
1248 (replace 'patch-command-exec-tests
1249 ,(patch-command-exec-tests-phase
1250 '(match (find-files "src/test" "command-exec\\.rs")
1252 ;; The test got removed in commit 000fe63b6fc57b09828930cacbab20c2ee6e6d15
1253 ;; "Remove painful test that is not pulling its weight"
1254 (delete 'remove-unsupported-tests)))))))))
1256 (define-public rust-1.41
1258 (rust-bootstrapped-package rust-1.40 "1.41.1"
1259 "0ws5x0fxv57fyllsa6025h3q6j9v3m8nb3syl4x0hgkddq0kvj9q")))
1263 (substitute-keyword-arguments (package-arguments base-rust)
1264 ((#:validate-runpath? _) #t))))))
1266 (define-public rust-1.42
1267 (rust-bootstrapped-package rust-1.41 "1.42.0"
1268 "0x9lxs82may6c0iln0b908cxyn1cv7h03n5cmbx3j1bas4qzks6j"))
1270 (define-public rust-1.43
1271 (rust-bootstrapped-package rust-1.42 "1.43.0"
1272 "18akhk0wz1my6y9vhardriy2ysc482z0fnjdcgs9gy59kmnarxkm"))
1274 (define-public rust-1.44
1275 (rust-bootstrapped-package rust-1.43 "1.44.1"
1276 "0ww4z2v3gxgn3zddqzwqya1gln04p91ykbrflnpdbmcd575n8bky"))
1278 (define-public rust-1.45
1280 (rust-bootstrapped-package rust-1.44 "1.45.0"
1281 "0z6dh0yd3fcm3qh960wi4s6fa6pxz9mh77psycsqfkkx5kqra15s")))
1286 (inherit (package-source base-rust))
1287 (patches (search-patches "rust-1.45-linker-locale.patch"))))
1289 (alist-replace "llvm" (list llvm-10)
1290 (package-inputs base-rust)))
1292 (substitute-keyword-arguments (package-arguments base-rust)
1294 `(modify-phases ,phases
1295 ;; These tests make sure that the parser behaves properly when
1296 ;; a source file starts with a shebang. Unfortunately,
1297 ;; the patch-shebangs phase changes the meaning of these edge-cases.
1298 ;; We skip the test since it's drastically unlikely Guix's packaging
1299 ;; will introduce a bug here.
1300 (add-after 'patch-tests 'skip-shebang-tests
1302 (with-directory-excursion "src/test/ui/parser/shebang"
1303 (delete-file "shebang-doc-comment.rs")
1304 (delete-file "sneaky-attrib.rs")
1306 ;; This test case synchronizes itself by starting a localhost TCP
1307 ;; server. This doesn't work as networking is not available.
1308 (add-after 'patch-tests 'skip-networking-test
1310 (substitute* "src/tools/cargo/tests/testsuite/freshness.rs"
1311 (("fn linking_interrupted" all)
1312 (string-append "#[ignore] " all)))
1315 ;; TODO(staging): Bump this variable to the latest packaged rust.
1316 (define-public rust rust-1.45)