+
+(define-public rust-1.29
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.28 "1.29.2"
+ "1jb787080z754caa2w3w1amsygs4qlzj9rs1vy64firfmabfg22h")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (patches (map search-patch '("rust-1.25-accept-more-detailed-gdb-lines.patch"
+ "rust-reproducible-builds.patch"))))))))
+
+(define-public rust-1.30
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.29 "1.30.1"
+ "0aavdc1lqv0cjzbqwl5n59yd0bqdlhn0zas61ljf38yrvc18k8rn")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin
+ (delete-file-recursively "src/jemalloc")
+ (delete-file-recursively "src/llvm")
+ (delete-file-recursively "src/llvm-emscripten")
+ (delete-file-recursively "src/tools/clang")
+ (delete-file-recursively "src/tools/lldb")
+ #t))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'patch-cargo-tests 'patch-cargo-env-shebang
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((coreutils (assoc-ref inputs "coreutils")))
+ (substitute* "src/tools/cargo/tests/testsuite/fix.rs"
+ ;; Cargo has a test which explicitly sets a
+ ;; RUSTC_WRAPPER environment variable which points
+ ;; to /usr/bin/env. Since it's not a shebang, it
+ ;; needs to be manually patched
+ (("\"/usr/bin/env\"")
+ (string-append "\"" coreutils "/bin/env\"")))
+ #t)))
+ (add-after 'patch-cargo-env-shebang 'ignore-cargo-package-tests
+ (lambda* _
+ (substitute* "src/tools/cargo/tests/testsuite/package.rs"
+ ;; These tests largely check that cargo outputs warning/error
+ ;; messages as expected. It seems that cargo outputs an
+ ;; absolute path to something in the store instead of the
+ ;; expected relative path (e.g. `[..]`) so we'll ignore
+ ;; these for now
+ (("fn include") "#[ignore]\nfn include")
+ (("fn exclude") "#[ignore]\nfn exclude"))
+ #t))
+ ;; The test has been moved elsewhere.
+ (replace 'disable-amd64-avx-test
+ (lambda _
+ (substitute* "src/test/ui/run-pass/issues/issue-44056.rs"
+ (("only-x86_64") "ignore-test"))
+ #t)))))))))
+
+(define-public rust-1.31
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.30 "1.31.1"
+ "0sk84ff0cklybcp0jbbxcw7lk7mrm6kb6km5nzd6m64dy0igrlli")))
+ (package
+ (inherit base-rust)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-after 'patch-tests 'patch-command-exec-tests
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((coreutils (assoc-ref inputs "coreutils")))
+ (substitute* "src/test/run-pass/command-exec.rs"
+ ;; This test suite includes some tests that the stdlib's
+ ;; `Command` execution properly handles situations where
+ ;; the environment or PATH variable are empty, but this
+ ;; fails since we don't have `echo` available in the usual
+ ;; Linux directories.
+ ;; NB: the leading space is so we don't fail a tidy check
+ ;; for trailing whitespace, and the newlines are to ensure
+ ;; we don't exceed the 100 chars tidy check as well
+ ((" Command::new\\(\"echo\"\\)")
+ (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n")))
+ #t)))
+ ;; The test has been moved elsewhere.
+ (replace 'disable-amd64-avx-test
+ (lambda _
+ (substitute* "src/test/ui/issues/issue-44056.rs"
+ (("only-x86_64") "ignore-test"))
+ #t))
+ (add-after 'patch-tests 'patch-process-docs-rev-cmd
+ (lambda* _
+ ;; Disable some doc tests which depend on the "rev" command
+ ;; https://github.com/rust-lang/rust/pull/58746
+ (substitute* "src/libstd/process.rs"
+ (("```rust") "```rust,no_run"))
+ #t)))))))))
+
+(define-public rust-1.32
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.31 "1.32.0"
+ "0ji2l9xv53y27xy72qagggvq47gayr5lcv2jwvmfirx029vlqnac")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin (delete-file-recursively "src/llvm")
+ (delete-file-recursively "src/llvm-emscripten")
+ (delete-file-recursively "src/tools/clang")
+ (delete-file-recursively "src/tools/lldb")
+ (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
+ #t))
+ (patches (map search-patch '("rust-reproducible-builds.patch")))
+ ;; the vendor directory has moved to the root of
+ ;; the tarball, so we have to strip an extra prefix
+ (patch-flags '("-p2"))))
+ (inputs
+ ;; Downgrade to LLVM 6, all LTO tests appear to fail with LLVM 7.0.1
+ (alist-replace "llvm" (list llvm-6)
+ (package-inputs base-rust)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ ;; Cargo.lock and the vendor/ directory have been moved to the
+ ;; root of the rust tarball
+ (replace 'patch-cargo-checksums
+ (lambda* _
+ (use-modules (guix build cargo-utils))
+ (substitute* "Cargo.lock"
+ (("(\"checksum .* = )\".*\"" all name)
+ (string-append name "\"" ,%cargo-reference-hash "\"")))
+ (generate-all-checksums "vendor")
+ #t))
+ (add-after 'enable-codegen-tests 'override-jemalloc
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; The compiler is no longer directly built against jemalloc,
+ ;; but rather via the jemalloc-sys crate (which vendors the
+ ;; jemalloc source). To use jemalloc we must enable linking to
+ ;; it (otherwise it would use the system allocator), and set
+ ;; an environment variable pointing to the compiled jemalloc.
+ (substitute* "config.toml"
+ (("^jemalloc =.*$") "")
+ (("[[]rust[]]") "\n[rust]\njemalloc=true\n"))
+ (setenv "JEMALLOC_OVERRIDE" (string-append (assoc-ref inputs "jemalloc")
+ "/lib/libjemalloc_pic.a"))
+ #t))
+ ;; Remove no longer relevant steps
+ (delete 'remove-flaky-test)
+ (delete 'patch-aarch64-test))))))))
+
+(define-public rust-1.33
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.32 "1.33.0"
+ "152x91mg7bz4ygligwjb05fgm1blwy2i70s2j03zc9jiwvbsh0as")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (patches '())
+ (patch-flags '("-p1"))))
+ (inputs
+ ;; Upgrade to jemalloc@5.1.0
+ (alist-replace "jemalloc" (list jemalloc)
+ (package-inputs base-rust)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'ignore-cargo-package-tests)
+ (add-after 'configure 'configure-test-threads
+ ;; Several rustc and cargo tests will fail if run on one core
+ ;; https://github.com/rust-lang/rust/issues/59122
+ ;; https://github.com/rust-lang/cargo/issues/6746
+ ;; https://github.com/rust-lang/rust/issues/58907
+ (lambda* (#:key inputs #:allow-other-keys)
+ (setenv "RUST_TEST_THREADS" "2")
+ #t)))))))))
+
+(define-public rust-1.34
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.33 "1.34.1"
+ "19s09k7y5j6g3y4d2rk6kg9pvq6ml94c49w6b72dmq8p9lk8bixh")))
+ (package
+ (inherit base-rust)
+ (source
+ (origin
+ (inherit (package-source base-rust))
+ (snippet '(begin
+ (delete-file-recursively "src/llvm-emscripten")
+ (delete-file-recursively "src/llvm-project")
+ (delete-file-recursively "vendor/jemalloc-sys/jemalloc")
+ #t)))))))
+
+(define-public rust-1.35
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.34 "1.35.0"
+ "0bbizy6b7002v1rdhrxrf5gijclbyizdhkglhp81ib3bf5x66kas")))
+ (package
+ (inherit base-rust)
+ (inputs
+ (alist-replace "llvm" (list llvm-8)
+ (package-inputs base-rust)))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ ;; The tidy test includes a pass which ensures large binaries
+ ;; don't accidentally get checked into the rust git repo.
+ ;; Unfortunately the test assumes that git is always available,
+ ;; so we'll comment out the invocation of this pass.
+ (add-after 'configure 'disable-tidy-bins-check
+ (lambda* _
+ (substitute* "src/tools/tidy/src/main.rs"
+ (("bins::check") "//bins::check"))
+ #t)))))))))
+
+(define-public rust-1.36
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.35 "1.36.0"
+ "06xv2p6zq03lidr0yaf029ii8wnjjqa894nkmrm6s0rx47by9i04")))
+ (package
+ (inherit base-rust)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'patch-process-docs-rev-cmd))))))))
+
+(define-public rust
+ (let ((base-rust
+ (rust-bootstrapped-package rust-1.36 "1.37.0"
+ "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj")))
+ (package
+ (inherit base-rust)
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (add-before 'configure 'configure-cargo-home
+ (lambda _
+ (let ((cargo-home (string-append (getcwd) "/.cargo")))
+ (mkdir-p cargo-home)
+ (setenv "CARGO_HOME" cargo-home)
+ #t))))))))))