GNU bug report logs - #64804
[PATCH] gnu: rust: Update to Rust 1.71.0

Previous Next

Package: guix-patches;

Reported by: Fries <fries1234 <at> protonmail.com>

Date: Sun, 23 Jul 2023 11:55:01 UTC

Severity: normal

Tags: patch

Done: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64804 in the body.
You can then email your comments to 64804 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Sun, 23 Jul 2023 11:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Fries <fries1234 <at> protonmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 23 Jul 2023 11:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Fries <fries1234 <at> protonmail.com>
To: guix-patches <at> gnu.org
Cc: Fries <fries1234 <at> protonmail.com>
Subject: [PATCH] gnu: rust: Update to Rust 1.71.0
Date: Sun, 23 Jul 2023 06:38:26 +0000
this one was quite a bit of effort but i seem like i actually got it
working!

the major changes that i've done is for Rust 1.70, i made a patch that
enables the cc feature flag so it would compile the outline asm files
instead of using included binary .a files which were removed by guix.

i also ignored a lot more tests for Rust 1.71, mainly gitoxide tests as
they require the network and the git binary and we don't have that in
the build.

also rustfmt requires rustc's shared libraries so i set the RUSTFLAGS
environment variable to add the "out" outputs lib folder to the RUNPATH
so the rustfmt binary works!
---
 .../patches/rust-1.70-fix-rustix-build.patch  |  20 +++
 gnu/packages/rust.scm                         | 137 ++++++++++++++++--
 2 files changed, 141 insertions(+), 16 deletions(-)
 create mode 100644 gnu/packages/patches/rust-1.70-fix-rustix-build.patch

diff --git a/gnu/packages/patches/rust-1.70-fix-rustix-build.patch b/gnu/packages/patches/rust-1.70-fix-rustix-build.patch
new file mode 100644
index 0000000..a7e2003
--- /dev/null
+++ b/gnu/packages/patches/rust-1.70-fix-rustix-build.patch
@@ -0,0 +1,20 @@
+--- a/vendor/fd-lock/Cargo.toml	2023-05-31 14:44:48.000000000 -0700
++++ b/vendor/fd-lock/Cargo.toml	2023-07-14 21:19:34.637702319 -0700
+@@ -45,7 +45,7 @@
+ 
+ [target."cfg(unix)".dependencies.rustix]
+ version = "0.37.0"
+-features = ["fs"]
++features = ["fs", "cc"]
+ 
+ [target."cfg(windows)".dependencies.windows-sys]
+ version = "0.45.0"
+--- a/src/bootstrap/Cargo.lock	2023-07-11 20:32:40.000000000 -0700
++++ b/src/bootstrap/Cargo.lock	2023-07-14 22:41:53.269284713 -0700
+@@ -618,6 +618,7 @@
+ dependencies = [
+  "bitflags",
++ "cc",
+  "errno",
+  "io-lifetimes",
+  "libc",
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 8e106a9..d489de9 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2022 Zheng Junjie <873216071 <at> qq.com>
 ;;; Copyright © 2022 Jim Newsome <jnewsome <at> torproject.org>
 ;;; Copyright © 2022 Mark H Weaver <mhw <at> netris.org>
+;;; Copyright © 2023 Fries <fries1234 <at> protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -122,6 +123,9 @@ (define* (rust-bootstrapped-package base-rust version checksum)
                     (alist-replace "rustc-bootstrap" (list base-rust)
                                    (package-native-inputs base-rust))))))
 
+
+
+
 ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed
 ;;; to be used in source form.
 (define %mrustc-commit "597593aba86fa2edbea80c6e09f0b1b2a480722d")
@@ -705,6 +709,81 @@ (define rust-1.68
   (rust-bootstrapped-package
    rust-1.67 "1.68.2" "15ifyd5jj8rd979dkakp887hgmhndr68pqaqvd2hqkfdywirqcwk"))
 
+(define rust-1.69
+  (let ((base-rust
+          (rust-bootstrapped-package
+           rust-1.68 "1.69.0" "03zn7kx5bi5mdfsqfccj4h8gd6abm7spj0kjsfxwlv5dcwc9f1gv")))
+    (package
+      (inherit base-rust)
+      (source
+        (origin
+          (inherit (package-source base-rust))
+          (snippet
+           '(begin
+              (for-each delete-file-recursively
+                        '("src/llvm-project"
+                          "vendor/tikv-jemalloc-sys/jemalloc"))
+              ;; Also remove the bundled (mostly Windows) libraries.
+              (for-each delete-file
+                        (find-files "vendor" ".*\\.(a|dll|exe|lib)$")))))))))
+
+(define rust-1.70
+ (let ((base-rust
+         (rust-bootstrapped-package
+          rust-1.69 "1.70.0" "0z6j7d0ni0rmfznv0w3mrf882m11kyh51g2bxkj40l3s1c0axgxj")))
+   (package
+     (inherit base-rust)
+     (source
+      (origin
+        (inherit (package-source base-rust))
+        ;; Rust 1.70 uses the rustix library which on Linux, it defaults to
+        ;; using outline ASM which without the cc cargo feature enabled, it
+        ;; will expect a precompiled binary library. This patch will enable the cargo
+        ;; cc feature flag inside the fd-lock vendored Cargo.toml file, which is the
+        ;; crate that uses rustix.
+        (patches (search-patches "rust-1.70-fix-rustix-build.patch"))
+        (patch-flags '("-p1"))))
+     (arguments
+       (substitute-keyword-arguments (package-arguments base-rust)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'build
+            (lambda* (#:key parallel-build? #:allow-other-keys)
+              (let ((job-spec (string-append
+                               "-j" (if parallel-build?
+                                        (number->string (parallel-job-count))
+                                        "1"))))
+                (invoke "./x.py" job-spec "build" "--stage=1"
+                        "library/std"
+                        "src/tools/cargo")))))))))))
+
+(define rust-1.71
+ (let ((base-rust
+         (rust-bootstrapped-package
+          rust-1.70 "1.71.0" "15jc0d13cmrh2xvpkyyvsbwgn3w4klqiwf2wlgzfp22mvjmy8rx6")))
+   (package
+     (inherit base-rust)
+     (arguments
+       (substitute-keyword-arguments (package-arguments base-rust)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'patch-cargo-checksums
+               (lambda _
+                 (substitute* '("Cargo.lock"
+                                "src/bootstrap/Cargo.lock"
+                                "src/tools/rust-analyzer/Cargo.lock"
+                                "src/tools/cargo/Cargo.lock")
+                   (("(checksum = )\".*\"" all name)
+                    (string-append name "\"" ,%cargo-reference-hash "\"")))
+                 (generate-all-checksums "vendor"))))))))))
+
+;;; Function to make creating a list to ignore tests a bit easier.
+(define (make-ignore-test-list strs)
+  (map (lambda (str)
+    (let ((ignore-string (format #f "#[ignore]\n~a" str)))
+      `((,str) ,ignore-string)))
+    strs))
+
 ;;; Note: Only the latest versions of Rust are supported and tested.  The
 ;;; intermediate rusts are built for bootstrapping purposes and should not
 ;;; be relied upon.  This is to ease maintenance and reduce the time
@@ -713,7 +792,7 @@ (define rust-1.68
 ;;; Here we take the latest included Rust, make it public, and re-enable tests
 ;;; and extra components such as rustfmt.
 (define-public rust
-  (let ((base-rust rust-1.67))
+  (let ((base-rust rust-1.71))
     (package
       (inherit base-rust)
       (outputs (cons "rustfmt" (package-outputs base-rust)))
@@ -748,23 +827,43 @@ (define-public rust
                     (which "env")))))
              (add-after 'unpack 'disable-tests-requiring-git
                (lambda _
-                 (substitute* "src/tools/cargo/tests/testsuite/new.rs"
-                   (("fn author_prefers_cargo")
-                    "#[ignore]\nfn author_prefers_cargo")
-                   (("fn finds_author_git")
-                    "#[ignore]\nfn finds_author_git")
-                   (("fn finds_local_author_git")
-                    "#[ignore]\nfn finds_local_author_git"))))
+                 (substitute* "src/tools/cargo/tests/testsuite/git.rs"
+                    ,@(make-ignore-test-list
+                      '("fn fetch_downloads_with_git2_first_then_with_gitoxide_and_vice_versa"
+                        "fn git_fetch_cli_env_clean"
+                        "fn git_with_cli_force"
+                        "fn use_the_cli")))
+                  ;; Gitoxide tests seem to require the internet to run
+                  ;; and Guix build containers don't have the internet.
+                  (substitute* "src/tools/cargo/tests/testsuite/git_shallow.rs"
+                    ,@(make-ignore-test-list
+                      '("fn gitoxide_clones_git_dependency_with_shallow_protocol_and_git2_is_used_for_followup_fetches"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_shallowness"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_with_git2_fetch"
+                        "fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness"
+                        "fn gitoxide_clones_shallow_two_revs_same_deps"
+                        "fn gitoxide_git_dependencies_switch_from_branch_to_rev"
+                        "fn gitoxide_shallow_clone_followed_by_non_shallow_update"
+                        "fn shallow_deps_work_with_revisions_and_branches_mixed_on_same_dependency")))
+                  (substitute* "src/tools/cargo/tests/testsuite/offline.rs"
+                    ,@(make-ignore-test-list '("fn gitoxide_cargo_compile_offline_with_cached_git_dep_shallow_dep")))
+                  (substitute* "src/tools/cargo/tests/testsuite/patch.rs"
+                    ,@(make-ignore-test-list '("fn gitoxide_clones_shallow_old_git_patch")))))
              (add-after 'unpack 'disable-tests-requiring-mercurial
                (lambda _
-                 (substitute*
-                   "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
-                   (("fn simple_hg_ignore_exists")
-                    "#[ignore]\nfn simple_hg_ignore_exists"))
                  (substitute*
                    "src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs"
-                   (("fn mercurial_autodetect")
-                    "#[ignore]\nfn mercurial_autodetect"))))
+                   ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs"
+                  ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
+                  ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/new.rs"
+                  ,@(make-ignore-test-list '("fn simple_hg")))))
              (add-after 'unpack 'disable-tests-broken-on-aarch64
                (lambda _
                  (with-directory-excursion "src/tools/cargo/tests/testsuite/"
@@ -807,7 +906,7 @@ (define-public rust
                ;; We skip the test since it's drastically unlikely Guix's
                ;; packaging will introduce a bug here.
                (lambda _
-                 (delete-file "src/test/ui/parser/shebang/sneaky-attrib.rs")))
+                 (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs")))
              (add-after 'unpack 'patch-process-tests
                (lambda* (#:key inputs #:allow-other-keys)
                  (let ((bash (assoc-ref inputs "bash")))
@@ -840,11 +939,17 @@ (define-public rust
                                      "gdb = \"" gdb "/bin/gdb\"\n"))))))
              (replace 'build
                ;; Phase overridden to also build rustfmt.
-               (lambda* (#:key parallel-build? #:allow-other-keys)
+               (lambda* (#:key parallel-build? outputs #:allow-other-keys)
                  (let ((job-spec (string-append
                                   "-j" (if parallel-build?
                                            (number->string (parallel-job-count))
                                            "1"))))
+                   ;; Append the default output's lib folder to the RUSTFLAGS
+                   ;; environment variable. this lets programs that depend on
+                   ;; rustc's shared libraries like rustfmt work.
+                   (setenv "RUSTFLAGS"
+                    (format #f "-C link-arg=-Wl,-rpath,~a/lib"
+                      (assoc-ref outputs "out")))
                    (invoke "./x.py" job-spec "build"
                            "library/std" ;rustc
                            "src/tools/cargo"

base-commit: 00ed2901f5171e4f9435641a91678217cae38030
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Sun, 23 Jul 2023 20:39:02 GMT) Full text and rfc822 format available.

Message #8 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Juliana Sims <juli <at> incana.org>
To: 64804 <at> debbugs.gnu.org
Cc: fries1234 <at> protonmail.com
Subject: Re: [PATCH] gnu: rust: Update to Rust 1.71.0
Date: Sun, 23 Jul 2023 16:38:10 -0400
Hi Fries,

While I'm not a Rust packager (and therefore may miss some stuff during 
review), there are a few glaring issues which stand out for me. Also 
forgive the formatting; not having the message proper to reply to 
complicates things.

First and foremost, Rust has 11052 reverse dependencies and this patch 
would rebuild 25834 packages. This should be submitted to the 
core-updates branch. I'm not sure whether this patch should be 
resubmitted for it or if others can just keep this in mind when 
considering merging it.

The next major thing is that this should be split into multiple 
patches. Make each discrete new Rust in its own patch, for example. 
Ideally, each patch would be atomic so that only a subset could be 
applied and packages would still build fine. If I were doing it, I 
would commit each intermediate version of Rust and bump the default 
Rust version with that commit. You may also be able to get away with 
adding each intermediate Rust and only bumping the version of the 
default rust for the last one; others will have to weigh in. See 
Contributing > Submitting Patches > Sending a Patch Series > Multiple 
Patches in the manual for how to submit such a patch series if you need 
it.

Make sure your commit messages match the proper style; see 
https://www.gnu.org/prep/standards/html_node/Change-Logs.html#Change-Logs 
and the commit history.

There's one point where you add three new, empty lines near the 
beginning of the patch. Prune those.

Where you write new modify-phases forms and new snippets, use 
g-expressions.

> + [target."cfg(windows)".dependencies.windows-sys]
> + version = "0.45.0"

Shouldn't we be able to remove this altogether somehow since we're not 
the target operating system?

> + ;; Rust 1.70 uses the rustix library which on Linux, it defaults to
> + ;; using outline ASM which without the cc cargo feature enabled, it
> + ;; will expect a precompiled binary library. This patch will 
enable the cargo
> + ;; cc feature flag inside the fd-lock vendored Cargo.toml file, 
which is the
> + ;; crate that uses rustix.

This comment is difficult to parse. Could it be reworded more clearly? 
Perhaps, "Rust 1.70 adds the rustix library which uses outline ASM. The 
vendored fd-lock crate uses rustix. It expects a precompiled binary 
library without the "cc" Cargo feature enabled. This patch enables the 
"cc" feature flag inside the vendored fd-lock Cargo.toml file."

That said, fd-lock is already packaged in Guix; the vendored version 
should be avoided.

> + (("(checksum = )\".*\"" all name)
> + (string-append name "\"" ,%cargo-reference-hash "\"")))

Clever.

> + ;;; Function to make creating a list to ignore tests a bit easier.

This should probably be a docstring instead of a comment, and it should 
describe what the function does - "Accept a list of strings containing 
test names, and return a list of forms for skipping those tests" maybe.

> + (define (make-ignore-test-list strs)
> +   (map (lambda (str)
> +          (let ((ignore-string (format #f "#[ignore]\n~a" str)))
> +            `((,str) ,ignore-string)))
> +        strs))

A few things here. Firstly, I'm not sure that this procedure should 
exist. Ideally we'd like to fix rather than ignore as many tests as 
possible - although I see you're using this to rewrite existing stuff 
more cleanly. Either way, break this whole function and its usage out 
into a separate patch. Move it to be near other helper functions, not 
in the middle of package definitions. Also perhaps make it a bit 
cleaner like:

> (define (ignore-rust-tests strs)
>   (map (lambda (str)
>          `((,str) ,(string-append "#[ignore]\n" str))
>        strs))

It's worth noting this is essentially a non-hygienic macro; maybe look 
into rewriting it as a macro instead. See 
https://spritely.institute/static/papers/scheme-primer.html#scheme-extensibility 
for an introduction to the ideas behind macros, and 
https://www.gnu.org/software/guile/manual/html_node/Macros.html - 
especially 
https://www.gnu.org/software/guile/manual/html_node/Syntax-Rules.html. 
I've also found the (incorrectly) linked and very excellent 
http://www.phyast.pitt.edu/~micheles/syntax-rules.pdf (WARNING! IS A 
PDF! also available from 
https://gist.github.com/jgarte/beb03e000943b7426f00b3d04ed01262 
(WARNING! IS GITHUB!)) to be incredibly helpful. Ideally instead of 
using `(substitutes* <file> ...)` you'd simply have some thing like 
`(ignore-rust-tests <file> '(<str> <strs> ...))` which produces the 
right code. Note that if you rewrite this as a macro, you won't be able 
to use docstrings.

> + ;; Gitoxide tests seem to require the internet to run
> + ;; and Guix build containers don't have the internet.

You can just say, "Gitoxide tests require the network" or similar.

> - (substitute*
> - 
"src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
> - (("fn simple_hg_ignore_exists")
> - "#[ignore]\nfn simple_hg_ignore_exists"))
>                   (substitute*
>                     
"src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs"
> - (("fn mercurial_autodetect")
> - "#[ignore]\nfn mercurial_autodetect"))))
> + ,@(make-ignore-test-list '("fn case")))
> + (substitute*
> + "src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs"
> + ,@(make-ignore-test-list '("fn case")))
> + (substitute*
> + 
"src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
> + ,@(make-ignore-test-list '("fn case")))

In this code, you move down the substitute* call on 
simple_hg_ignore_exists/mod.rs and add code above it. This produces a 
larger diff than necessary. Avoid changing code order like this without 
a good reason.

> + ;; Append the default output's lib folder to the RUSTFLAGS
> + ;; environment variable. this lets programs that depend on
> + ;; rustc's shared libraries like rustfmt work.

Minor writing stuff. Capitalize the 't' in "this;" move "like rustfmt" 
to after "programs."

> + (setenv "RUSTFLAGS"
> +   (format #f "-C link-arg=-Wl,-rpath,~a/lib"
> +     (assoc-ref outputs "out")))

I'm not sure that this is the best way to do this. Setting build flags 
in an environment variable just feels wrong. I'll let someone with more 
knowledge of the domain weigh in, but I do want to mention it.

I don't think any of the rest of this review is blocking, but you may 
want to consider it anyway.

I don't see "format" used in package definitions very often; I don't 
know if there's some reason to oppose it, but it's worth considering 
just using "string-append" instead.

Make sure this builds on architectures besides x86_64 if you can. I see 
in the commit history for Rust there seem to be some issues around 
aarch64 and riscv64 support in particular, so testing for those 
platforms may reveal more issues.

Make sure to run "guix style" and "guix lint".

You may want to have a separate patch, either before or after your 
changes, to port all of the default rust package's modify-phases to 
g-expressions; "guix style -S arguments" should help there.

You'll need to wait for review from experts on the subject, and 
obviously someone with commit, but this is very impressive for a first 
patch. Rust has been languishing for a while and it's clearly not just 
because it's not used. Well done.

- Juli






Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Mon, 24 Jul 2023 07:31:04 GMT) Full text and rfc822 format available.

Message #11 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Fries <fries1234 <at> protonmail.com>
To: 64804 <at> debbugs.gnu.org
Cc: Fries <fries1234 <at> protonmail.com>, efraim <at> flashner.co.il, juli <at> incana.org
Subject: [PATCH 1/5] gnu: rust: Add rust-1.69.
Date: Mon, 24 Jul 2023 05:36:30 +0000
* gnu/packages/rust.scm (rust-1.69): New variable.
---
 gnu/packages/rust.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 8e106a9927..c0738a6064 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -16,6 +16,7 @@
 ;;; Copyright © 2022 Zheng Junjie <873216071 <at> qq.com>
 ;;; Copyright © 2022 Jim Newsome <jnewsome <at> torproject.org>
 ;;; Copyright © 2022 Mark H Weaver <mhw <at> netris.org>
+;;; Copyright © 2023 Fries <fries1234 <at> protonmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -705,6 +706,24 @@ (define rust-1.68
   (rust-bootstrapped-package
    rust-1.67 "1.68.2" "15ifyd5jj8rd979dkakp887hgmhndr68pqaqvd2hqkfdywirqcwk"))
 
+(define rust-1.69
+  (let ((base-rust
+          (rust-bootstrapped-package
+           rust-1.68 "1.69.0" "03zn7kx5bi5mdfsqfccj4h8gd6abm7spj0kjsfxwlv5dcwc9f1gv")))
+    (package
+      (inherit base-rust)
+      (source
+        (origin
+          (inherit (package-source base-rust))
+          (snippet
+           '(begin
+              (for-each delete-file-recursively
+                        '("src/llvm-project"
+                          "vendor/tikv-jemalloc-sys/jemalloc"))
+              ;; Also remove the bundled (mostly Windows) libraries.
+              (for-each delete-file
+                        (find-files "vendor" ".*\\.(a|dll|exe|lib)$")))))))))
+
 ;;; Note: Only the latest versions of Rust are supported and tested.  The
 ;;; intermediate rusts are built for bootstrapping purposes and should not
 ;;; be relied upon.  This is to ease maintenance and reduce the time

base-commit: b5af0b9c016a65bf32b06a4f118c2ed48f3a80b3
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Mon, 24 Jul 2023 07:31:04 GMT) Full text and rfc822 format available.

Message #14 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Fries <fries1234 <at> protonmail.com>
To: 64804 <at> debbugs.gnu.org
Cc: Fries <fries1234 <at> protonmail.com>, efraim <at> flashner.co.il, juli <at> incana.org
Subject: [PATCH 2/5] gnu: rust: Add rust-1.70.
Date: Mon, 24 Jul 2023 05:36:36 +0000
* gnu/packages/rust.scm (rust-1.70): New variable.
---
 .../patches/rust-1.70-fix-rustix-build.patch  | 20 +++++++++++++++++++
 gnu/packages/rust.scm                         | 16 +++++++++++++++
 2 files changed, 36 insertions(+)
 create mode 100644 gnu/packages/patches/rust-1.70-fix-rustix-build.patch

diff --git a/gnu/packages/patches/rust-1.70-fix-rustix-build.patch b/gnu/packages/patches/rust-1.70-fix-rustix-build.patch
new file mode 100644
index 0000000000..a7e2003aff
--- /dev/null
+++ b/gnu/packages/patches/rust-1.70-fix-rustix-build.patch
@@ -0,0 +1,20 @@
+--- a/vendor/fd-lock/Cargo.toml	2023-05-31 14:44:48.000000000 -0700
++++ b/vendor/fd-lock/Cargo.toml	2023-07-14 21:19:34.637702319 -0700
+@@ -45,7 +45,7 @@
+ 
+ [target."cfg(unix)".dependencies.rustix]
+ version = "0.37.0"
+-features = ["fs"]
++features = ["fs", "cc"]
+ 
+ [target."cfg(windows)".dependencies.windows-sys]
+ version = "0.45.0"
+--- a/src/bootstrap/Cargo.lock	2023-07-11 20:32:40.000000000 -0700
++++ b/src/bootstrap/Cargo.lock	2023-07-14 22:41:53.269284713 -0700
+@@ -618,6 +618,7 @@
+ dependencies = [
+  "bitflags",
++ "cc",
+  "errno",
+  "io-lifetimes",
+  "libc",
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index c0738a6064..0b9afd3ea9 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -724,6 +724,22 @@ (define rust-1.69
               (for-each delete-file
                         (find-files "vendor" ".*\\.(a|dll|exe|lib)$")))))))))
 
+(define rust-1.70
+ (let ((base-rust
+         (rust-bootstrapped-package
+          rust-1.69 "1.70.0" "0z6j7d0ni0rmfznv0w3mrf882m11kyh51g2bxkj40l3s1c0axgxj")))
+   (package
+     (inherit base-rust)
+     (source
+      (origin
+        (inherit (package-source base-rust))
+        ;; Rust 1.70 adds the rustix library which depends on the vendored fd-lock
+        ;; crate. The fd-lock crate uses Outline assembly which expects a precompiled
+        ;; static library. Enabling the "cc" feature tells the build.rs script to
+        ;; compile the assembly files instead of searching for a precompiled library.
+        (patches (search-patches "rust-1.70-fix-rustix-build.patch"))
+        (patch-flags '("-p1")))))))
+
 ;;; Note: Only the latest versions of Rust are supported and tested.  The
 ;;; intermediate rusts are built for bootstrapping purposes and should not
 ;;; be relied upon.  This is to ease maintenance and reduce the time
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Mon, 24 Jul 2023 07:31:05 GMT) Full text and rfc822 format available.

Message #17 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Fries <fries1234 <at> protonmail.com>
To: 64804 <at> debbugs.gnu.org
Cc: Fries <fries1234 <at> protonmail.com>, efraim <at> flashner.co.il, juli <at> incana.org
Subject: [PATCH 3/5] gnu: rust: Add rust-1.71.
Date: Mon, 24 Jul 2023 05:36:41 +0000
* gnu/packages/rust.scm (rust-1.71): New variable.
---
 gnu/packages/rust.scm | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 0b9afd3ea9..b65390c97c 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -740,6 +740,28 @@ (define rust-1.70
         (patches (search-patches "rust-1.70-fix-rustix-build.patch"))
         (patch-flags '("-p1")))))))
 
+(define rust-1.71
+ (let ((base-rust
+         (rust-bootstrapped-package
+          rust-1.70 "1.71.0" "15jc0d13cmrh2xvpkyyvsbwgn3w4klqiwf2wlgzfp22mvjmy8rx6")))
+   (package
+     (inherit base-rust)
+     (arguments
+       (substitute-keyword-arguments (package-arguments base-rust)
+        ((#:phases phases)
+         `(modify-phases ,phases
+            (replace 'patch-cargo-checksums
+               (lambda _
+                 ;; Cargo's Cargo.lock file needs to have its checksums replaced so
+                 ;; the Cargo build doesn't fail.
+                 (substitute* '("Cargo.lock"
+                                "src/bootstrap/Cargo.lock"
+                                "src/tools/rust-analyzer/Cargo.lock"
+                                "src/tools/cargo/Cargo.lock")
+                   (("(checksum = )\".*\"" all name)
+                    (string-append name "\"" ,%cargo-reference-hash "\"")))
+                 (generate-all-checksums "vendor"))))))))))
+
 ;;; Note: Only the latest versions of Rust are supported and tested.  The
 ;;; intermediate rusts are built for bootstrapping purposes and should not
 ;;; be relied upon.  This is to ease maintenance and reduce the time
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Mon, 24 Jul 2023 07:31:05 GMT) Full text and rfc822 format available.

Message #20 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Fries <fries1234 <at> protonmail.com>
To: 64804 <at> debbugs.gnu.org
Cc: Fries <fries1234 <at> protonmail.com>, efraim <at> flashner.co.il, juli <at> incana.org
Subject: [PATCH 4/5] gnu: rust: Add make-ignore-test-list function.
Date: Mon, 24 Jul 2023 05:36:47 +0000
A little helper function to make creating a list to ignore tests easier.

* gnu/packages/rust.scm (make-ignore-test-list): New symbol.
---
 gnu/packages/rust.scm | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index b65390c97c..03681d55ac 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -123,6 +123,12 @@ (define* (rust-bootstrapped-package base-rust version checksum)
                     (alist-replace "rustc-bootstrap" (list base-rust)
                                    (package-native-inputs base-rust))))))
 
+(define (make-ignore-test-list strs)
+  "Function to make creating a list to ignore tests a bit easier."
+  (map (lambda (str)
+    `((,str) (string-append "#[ignore]\n" ,str)))
+    strs))
+
 ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed
 ;;; to be used in source form.
 (define %mrustc-commit "597593aba86fa2edbea80c6e09f0b1b2a480722d")
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Mon, 24 Jul 2023 07:31:06 GMT) Full text and rfc822 format available.

Message #23 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Fries <fries1234 <at> protonmail.com>
To: 64804 <at> debbugs.gnu.org
Cc: Fries <fries1234 <at> protonmail.com>, efraim <at> flashner.co.il, juli <at> incana.org
Subject: [PATCH 5/5] gnu: rust: Update to 1.71.
Date: Mon, 24 Jul 2023 05:36:53 +0000
* gnu/packages/rust.scm (rust): Update to 1.71.
[arguments]: Extend the disable-tests-requiring-git and
disable-tests-requiring-mercurial phases to ignore more tests that will
fail the build.
---
 gnu/packages/rust.scm | 55 +++++++++++++++++++++++++++++++------------
 1 file changed, 40 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 03681d55ac..505075b9d6 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -776,7 +776,7 @@ (define rust-1.71
 ;;; Here we take the latest included Rust, make it public, and re-enable tests
 ;;; and extra components such as rustfmt.
 (define-public rust
-  (let ((base-rust rust-1.67))
+  (let ((base-rust rust-1.71))
     (package
       (inherit base-rust)
       (outputs (cons "rustfmt" (package-outputs base-rust)))
@@ -811,23 +811,42 @@ (define-public rust
                     (which "env")))))
              (add-after 'unpack 'disable-tests-requiring-git
                (lambda _
-                 (substitute* "src/tools/cargo/tests/testsuite/new.rs"
-                   (("fn author_prefers_cargo")
-                    "#[ignore]\nfn author_prefers_cargo")
-                   (("fn finds_author_git")
-                    "#[ignore]\nfn finds_author_git")
-                   (("fn finds_local_author_git")
-                    "#[ignore]\nfn finds_local_author_git"))))
+                 (substitute* "src/tools/cargo/tests/testsuite/git.rs"
+                    ,@(make-ignore-test-list
+                      '("fn fetch_downloads_with_git2_first_then_with_gitoxide_and_vice_versa"
+                        "fn git_fetch_cli_env_clean"
+                        "fn git_with_cli_force"
+                        "fn use_the_cli")))
+                  ;; Gitoxide tests require the network.
+                  (substitute* "src/tools/cargo/tests/testsuite/git_shallow.rs"
+                    ,@(make-ignore-test-list
+                      '("fn gitoxide_clones_git_dependency_with_shallow_protocol_and_git2_is_used_for_followup_fetches"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_aborts_and_updates_again"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_fetch_maintains_shallowness"
+                        "fn gitoxide_clones_registry_with_shallow_protocol_and_follow_up_with_git2_fetch"
+                        "fn gitoxide_clones_registry_without_shallow_protocol_and_follow_up_fetch_uses_shallowness"
+                        "fn gitoxide_clones_shallow_two_revs_same_deps"
+                        "fn gitoxide_git_dependencies_switch_from_branch_to_rev"
+                        "fn gitoxide_shallow_clone_followed_by_non_shallow_update"
+                        "fn shallow_deps_work_with_revisions_and_branches_mixed_on_same_dependency")))
+                  (substitute* "src/tools/cargo/tests/testsuite/offline.rs"
+                    ,@(make-ignore-test-list '("fn gitoxide_cargo_compile_offline_with_cached_git_dep_shallow_dep")))
+                  (substitute* "src/tools/cargo/tests/testsuite/patch.rs"
+                    ,@(make-ignore-test-list '("fn gitoxide_clones_shallow_old_git_patch")))))
              (add-after 'unpack 'disable-tests-requiring-mercurial
                (lambda _
                  (substitute*
-                   "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
-                   (("fn simple_hg_ignore_exists")
-                    "#[ignore]\nfn simple_hg_ignore_exists"))
+                  "src/tools/cargo/tests/testsuite/init/simple_hg_ignore_exists/mod.rs"
+                  ,@(make-ignore-test-list '("fn case")))
                  (substitute*
                    "src/tools/cargo/tests/testsuite/init/mercurial_autodetect/mod.rs"
-                   (("fn mercurial_autodetect")
-                    "#[ignore]\nfn mercurial_autodetect"))))
+                   ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/init/simple_hg/mod.rs"
+                  ,@(make-ignore-test-list '("fn case")))
+                 (substitute*
+                  "src/tools/cargo/tests/testsuite/new.rs"
+                  ,@(make-ignore-test-list '("fn simple_hg")))))
              (add-after 'unpack 'disable-tests-broken-on-aarch64
                (lambda _
                  (with-directory-excursion "src/tools/cargo/tests/testsuite/"
@@ -870,7 +889,7 @@ (define-public rust
                ;; We skip the test since it's drastically unlikely Guix's
                ;; packaging will introduce a bug here.
                (lambda _
-                 (delete-file "src/test/ui/parser/shebang/sneaky-attrib.rs")))
+                 (delete-file "tests/ui/parser/shebang/sneaky-attrib.rs")))
              (add-after 'unpack 'patch-process-tests
                (lambda* (#:key inputs #:allow-other-keys)
                  (let ((bash (assoc-ref inputs "bash")))
@@ -903,11 +922,17 @@ (define-public rust
                                      "gdb = \"" gdb "/bin/gdb\"\n"))))))
              (replace 'build
                ;; Phase overridden to also build rustfmt.
-               (lambda* (#:key parallel-build? #:allow-other-keys)
+               (lambda* (#:key parallel-build? outputs #:allow-other-keys)
                  (let ((job-spec (string-append
                                   "-j" (if parallel-build?
                                            (number->string (parallel-job-count))
                                            "1"))))
+                   ;; Append the default output's lib folder to the RUSTFLAGS
+                   ;; environment variable. This lets programs like rustfmt
+                   ;; that depend on rustc's shared libraries like rustfmt work.
+                   (setenv "RUSTFLAGS"
+                    (format #f "-C link-arg=-Wl,-rpath,~a/lib"
+                      (assoc-ref outputs "out")))
                    (invoke "./x.py" job-spec "build"
                            "library/std" ;rustc
                            "src/tools/cargo"
-- 
2.41.0






Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Mon, 24 Jul 2023 07:31:06 GMT) Full text and rfc822 format available.

Message #26 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Fries <fries1234 <at> protonmail.com>
To: 64804 <at> debbugs.gnu.org
Cc: Fries <fries1234 <at> protonmail.com>, efraim <at> flashner.co.il,
 Juliana Sims <juli <at> incana.org>
Subject: Re: [PATCH 5/5] gnu: rust: Update to 1.71.
Date: Mon, 24 Jul 2023 05:51:24 +0000
git-send-email wouldn't let me make a cover letter as the teams script thought 
it was an invalid patch so i'm going to send this email here.

this patch series updates the rust package to rust 1.71.0! this means programs 
that require newer std api's like the stablized OnceCell API that was added in 
rust 1.70 can be used! i submitted this patch before and i got some feedback 
from juliana so i split my patches into a patch series. 

i don't know what branch this should go in but i checked the submitting patch 
webpage and i think as a rust update would mean a lot of rebuilding, i think 
it should go into the core-updates branch but i see theres also a rust-team 
branch. i don't know which one would be optimal.







Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Sat, 30 Sep 2023 15:42:01 GMT) Full text and rfc822 format available.

Message #29 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Milan Svoboda <milan.svoboda <at> centrum.cz>
To: 64804 <at> debbugs.gnu.org
Subject: Please merge it
Date: Sat, 30 Sep 2023 17:40:43 +0200
Hello,

it would be wonderful if this could be merged. I am trying to package 
broot (command line file manager) and one of it's dependency requires 
rust 1.70.0.

Pretty please.





Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Sun, 01 Oct 2023 07:12:02 GMT) Full text and rfc822 format available.

Message #32 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: Efraim Flashner <efraim <at> flashner.co.il>
To: Fries <fries1234 <at> protonmail.com>
Cc: 64804 <at> debbugs.gnu.org, Juliana Sims <juli <at> incana.org>
Subject: Re: [PATCH 5/5] gnu: rust: Update to 1.71.
Date: Sun, 1 Oct 2023 10:10:51 +0300
[Message part 1 (text/plain, inline)]
On Mon, Jul 24, 2023 at 05:51:24AM +0000, Fries wrote:
> git-send-email wouldn't let me make a cover letter as the teams script thought 
> it was an invalid patch so i'm going to send this email here.
> 
> this patch series updates the rust package to rust 1.71.0! this means programs 
> that require newer std api's like the stablized OnceCell API that was added in 
> rust 1.70 can be used! i submitted this patch before and i got some feedback 
> from juliana so i split my patches into a patch series. 
> 
> i don't know what branch this should go in but i checked the submitting patch 
> webpage and i think as a rust update would mean a lot of rebuilding, i think 
> it should go into the core-updates branch but i see theres also a rust-team 
> branch. i don't know which one would be optimal.

Thanks for the patches!

Sorry it took me a while to get back to you, I had some time off during
the summer and needed a bit of a break after the last rust team merge.

I've applied patches 1, 2 and 4. I wasn't able to get rust-1.71 to build
so in the mean time I've bumped rust to 1.70 on the rust-team branch.

-- 
Efraim Flashner   <efraim <at> flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Sun, 01 Oct 2023 07:28:02 GMT) Full text and rfc822 format available.

Message #35 received at 64804 <at> debbugs.gnu.org (full text, mbox):

From: jaeme <jsnc <at> anche.no>
To: 64804 <at> debbugs.gnu.org
Subject: [PATCH] gnu: rust: Update to Rust 1.71.0
Date: Sat, 30 Sep 2023 23:47:44 -0400
Also bump,

We shouldn't be 4 versions behind upstream as a lot of newer rust 
apps/programs require on what used to be unstable features in 
older/current versions of rust. This is currently a stopgap for me when 
packaging swww, a wayland compositor wallpaper changer.


Thanks all.





Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Sun, 01 Oct 2023 09:34:02 GMT) Full text and rfc822 format available.

Message #38 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Malte Frank Gerdes <malte.f.gerdes <at> gmail.com>
To: Milan Svoboda <milan.svoboda <at> centrum.cz>
Cc: 64804 <at> debbugs.gnu.org, guix-patches <at> gnu.org
Subject: Re: [bug#64804] Please merge it
Date: Sun, 01 Oct 2023 11:30:16 +0200
Hi,

such rust related changes are targeted at the rust team branch.  IIRC
the rust team is a one-man army, so it absolutely possible that things
take a while :/.

But reading #64804, Efraim already bumped rust to 1.70 on the rust-team
branch, so it will be available after the next rust-team merge.  In the
meantime you'd have to use the rust-team branch if you really want to
use rust-1.70.


mfg²


Milan Svoboda <milan.svoboda <at> centrum.cz> writes:

> Hello,
>
> it would be wonderful if this could be merged. I am trying to package broot
> (command line file manager) and one of it's dependency requires rust 1.70.0.
>
> Pretty please.





Information forwarded to guix-patches <at> gnu.org:
bug#64804; Package guix-patches. (Sun, 01 Oct 2023 09:34:02 GMT) Full text and rfc822 format available.

Reply sent to Nicolas Goaziou <mail <at> nicolasgoaziou.fr>:
You have taken responsibility. (Sat, 01 Mar 2025 11:10:02 GMT) Full text and rfc822 format available.

Notification sent to Fries <fries1234 <at> protonmail.com>:
bug acknowledged by developer. (Sat, 01 Mar 2025 11:10:02 GMT) Full text and rfc822 format available.

Message #46 received at 64804-done <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Goaziou <mail <at> nicolasgoaziou.fr>
To: 64804-done <at> debbugs.gnu.org
Subject: Re: [PATCH] gnu: rust: Update to Rust 1.71.0
Date: Sat, 01 Mar 2025 12:08:58 +0100
Closing, as Rust is already at a higher version.






bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 29 Mar 2025 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 40 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.