{"thread":{"id":"65421","subject":"[PATCH 4/4] Enable Rust by default","startedAt":"2026-04-03T01:17:23Z","lastAt":"2026-04-08T10:12:29Z","messageCount":9,"participants":["brian m. carlson","Junio C Hamano","Patrick Steinhardt"],"isPatch":true,"patchVersion":1,"patchTotal":4},"messages":[{"id":"540809","messageId":"20260403011249.4133372-5-sandals@crustytoothpaste.net","threadId":"65421","inReplyTo":"20260403011249.4133372-1-sandals@crustytoothpaste.net","subject":"[PATCH 4/4] Enable Rust by default","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-04-03T01:12:49Z","receivedAt":"2026-04-03T01:17:23Z","isPatch":true,"body":"Our breaking changes document says that we'll enable Rust by default in\nGit 2.54.  Adjust the Makefile to switch the option from WITH_RUST to\nNO_RUST to enable it by default and update the help text accordingly.\nSimilarly, for Meson, enable the option by default and do not\nautomatically disable it if Cargo is missing, since the goal is to help\nusers find where they are likely to have problems in the future.\n\nUpdate our CI tests to swap out the single Linux job with Rust to a\nsingle job without.  Similarly, update the Windows Makefile job to not\nuse Rust, while the Meson job (which does not build with ci/lib.sh) will\ndefault to having it enabled.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n Makefile                  | 10 +++++-----\n ci/lib.sh                 |  3 +++\n ci/run-build-and-tests.sh |  2 +-\n meson.build               |  2 +-\n meson_options.txt         |  2 +-\n 5 files changed, 11 insertions(+), 8 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex dbf0022054..84b59959de 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -498,9 +498,9 @@ include shared.mak\n #\n # == Optional Rust support ==\n #\n-# Define WITH_RUST if you want to include features and subsystems written in\n-# Rust into Git. For now, Rust is still an optional feature of the build\n-# process. With Git 3.0 though, Rust will always be enabled.\n+# Define NO_RUST if you want to disable features and subsystems written in Rust\n+# from being compiled into Git. For now, Rust is still an optional feature of\n+# the build process. With Git 3.0 though, Rust will always be enabled.\n #\n # Building Rust code requires Cargo.\n #\n@@ -1351,7 +1351,7 @@ LIB_OBJS += urlmatch.o\n LIB_OBJS += usage.o\n LIB_OBJS += userdiff.o\n LIB_OBJS += utf8.o\n-ifndef WITH_RUST\n+ifdef NO_RUST\n LIB_OBJS += varint.o\n endif\n LIB_OBJS += version.o\n@@ -1590,7 +1590,7 @@ endif\n ALL_CFLAGS = $(DEVELOPER_CFLAGS) $(CPPFLAGS) $(CFLAGS) $(CFLAGS_APPEND)\n ALL_LDFLAGS = $(LDFLAGS) $(LDFLAGS_APPEND)\n \n-ifdef WITH_RUST\n+ifndef NO_RUST\n BASIC_CFLAGS += -DWITH_RUST\n GITLIBS += $(RUST_LIB)\n ifeq ($(uname_S),Windows)\ndiff --git a/ci/lib.sh b/ci/lib.sh\nindex 42a2b6a318..1cfc8c6efc 100755\n--- a/ci/lib.sh\n+++ b/ci/lib.sh\n@@ -372,6 +372,9 @@ linux-asan-ubsan)\n osx-meson)\n \tMESONFLAGS=\"$MESONFLAGS -Dcredential_helpers=osxkeychain\"\n \t;;\n+windows-*)\n+\texport NO_RUST=UnfortunatelyYes\n+\t;;\n esac\n \n MAKEFLAGS=\"$MAKEFLAGS CC=${CC:-cc}\"\ndiff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\nindex 28cfe730ee..bf1fdbe968 100755\n--- a/ci/run-build-and-tests.sh\n+++ b/ci/run-build-and-tests.sh\n@@ -10,7 +10,6 @@ export TEST_CONTRIB_TOO=yes\n case \"$jobname\" in\n fedora-breaking-changes-musl|linux-breaking-changes)\n \texport WITH_BREAKING_CHANGES=YesPlease\n-\texport WITH_RUST=YesPlease\n \tMESONFLAGS=\"$MESONFLAGS -Dbreaking_changes=true\"\n \tMESONFLAGS=\"$MESONFLAGS -Drust=enabled\"\n \t;;\n@@ -30,6 +29,7 @@ linux-TEST-vars)\n \texport GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1\n \t;;\n linux-clang)\n+\texport NO_RUST=UnfortunatelyYes\n \texport GIT_TEST_DEFAULT_HASH=sha1\n \t;;\n linux-sha256)\ndiff --git a/meson.build b/meson.build\nindex 8309942d18..4e1a58ee01 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -1746,7 +1746,7 @@ version_def_h = custom_target(\n libgit_sources += version_def_h\n \n cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))\n-rust_option = get_option('rust').disable_auto_if(not cargo.found())\n+rust_option = get_option('rust')\n if rust_option.allowed()\n   subdir('src')\n   libgit_c_args += '-DWITH_RUST'\ndiff --git a/meson_options.txt b/meson_options.txt\nindex 659cbb218f..80a8025f20 100644\n--- a/meson_options.txt\n+++ b/meson_options.txt\n@@ -77,7 +77,7 @@ option('zlib_backend', type: 'combo', choices: ['auto', 'zlib', 'zlib-ng'], valu\n # Build tweaks.\n option('breaking_changes', type: 'boolean', value: false,\n   description: 'Enable upcoming breaking changes.')\n-option('rust', type: 'feature', value: 'auto',\n+option('rust', type: 'feature', value: 'enabled',\n   description: 'Enable building with Rust.')\n option('macos_use_homebrew_gettext', type: 'boolean', value: true,\n   description: 'Use gettext from Homebrew instead of the slightly-broken system-provided one.')\n"},{"id":"540810","messageId":"20260403011249.4133372-3-sandals@crustytoothpaste.net","threadId":"65421","inReplyTo":"20260403011249.4133372-1-sandals@crustytoothpaste.net","subject":"[PATCH 2/4] ci: install cargo on Alpine","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-04-03T01:12:47Z","receivedAt":"2026-04-03T01:17:23Z","isPatch":true,"body":"We'll make Rust the default in a future commit, so be sure to install\nCargo (which will also install Rust) to prepare for that case.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n ci/install-dependencies.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/ci/install-dependencies.sh b/ci/install-dependencies.sh\nindex c55441d9df..10c3530d1a 100755\n--- a/ci/install-dependencies.sh\n+++ b/ci/install-dependencies.sh\n@@ -29,7 +29,7 @@ alpine-*)\n \tapk add --update shadow sudo meson ninja-build gcc libc-dev curl-dev openssl-dev expat-dev gettext \\\n \t\tzlib-ng-dev pcre2-dev python3 musl-libintl perl-utils ncurses \\\n \t\tapache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \\\n-\t\tbash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty >/dev/null\n+\t\tbash cvs gnupg perl-cgi perl-dbd-sqlite perl-io-tty cargo >/dev/null\n \t;;\n fedora-*|almalinux-*)\n \tcase \"$jobname\" in\n"},{"id":"540811","messageId":"20260403011249.4133372-2-sandals@crustytoothpaste.net","threadId":"65421","inReplyTo":"20260403011249.4133372-1-sandals@crustytoothpaste.net","subject":"[PATCH 1/4] docs: update version with default Rust support","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-04-03T01:12:46Z","receivedAt":"2026-04-03T01:17:23Z","isPatch":true,"body":"We missed the cut-off for Rust by default in 2.53, but we still can\nenable it by default for 2.54, so update our breaking changes document\naccordingly.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n Documentation/BreakingChanges.adoc | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/BreakingChanges.adoc b/Documentation/BreakingChanges.adoc\nindex f814450d2f..510ed98b65 100644\n--- a/Documentation/BreakingChanges.adoc\n+++ b/Documentation/BreakingChanges.adoc\n@@ -190,7 +190,7 @@ milestones for the introduction of Rust:\n 1. Initially, with Git 2.52, support for Rust will be auto-detected by Meson and\n    disabled in our Makefile so that the project can sort out the initial\n    infrastructure.\n-2. In Git 2.53, both build systems will default-enable support for Rust.\n+2. In Git 2.54, both build systems will default-enable support for Rust.\n    Consequently, builds will break by default if Rust is not available on the\n    build host. The use of Rust can still be explicitly disabled via build\n    flags.\n"},{"id":"540812","messageId":"20260403011249.4133372-1-sandals@crustytoothpaste.net","threadId":"65421","inReplyTo":null,"subject":"[PATCH 0/4] Enable Rust by default","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-04-03T01:12:45Z","receivedAt":"2026-04-03T01:17:23Z","isPatch":true,"body":"Our breaking changes document said that we would enable Rust support by\ndefault in Git 2.53, while still leaving the ability for it to be\ndisabled.  Unfortunately, we forgot to do that and my time machine is\nbroken right now, so this series sets it up for Git 2.54.\n\nThe first patch updates the documentation accordingly and the next two\nfix a few cases that are broken in our CI system.  The final patch\nsimply enables Rust by default except for two jobs to make sure that we\ncontinue to build correctly without Rust for the moment.\n\nI didn't force Rust on with the breaking changes mode because it's\nalready on by default with this series and it seemed unnecessary.\n\nThe GitHub Actions CI passes on all platforms with this series.\n\nbrian m. carlson (4):\n  docs: update version with default Rust support\n  ci: install cargo on Alpine\n  Linux: link against libdl\n  Enable Rust by default\n\n Documentation/BreakingChanges.adoc |  2 +-\n Makefile                           | 10 +++++-----\n ci/install-dependencies.sh         |  2 +-\n ci/lib.sh                          |  3 +++\n ci/run-build-and-tests.sh          |  2 +-\n config.mak.uname                   |  1 +\n meson.build                        |  2 +-\n meson_options.txt                  |  2 +-\n 8 files changed, 14 insertions(+), 10 deletions(-)\n\n"},{"id":"540813","messageId":"20260403011249.4133372-4-sandals@crustytoothpaste.net","threadId":"65421","inReplyTo":"20260403011249.4133372-1-sandals@crustytoothpaste.net","subject":"[PATCH 3/4] Linux: link against libdl","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2026-04-03T01:12:48Z","receivedAt":"2026-04-03T01:17:23Z","isPatch":true,"body":"Older versions of Rust on Linux, such as that used in Debian 11 in our\nCI, require linking against libdl.  Were we linking with Cargo, this\nwould be included automatically, but since we're not, explicitly set it\nin the system-specific config.\n\nThis library is part of libc, so linking against it if it happens to be\nunnecessary will add no dependencies to the resulting binary.  In\naddition, it is provided by both glibc and musl, so it should be\nportable to almost all Linux systems.\n\nSigned-off-by: brian m. carlson <sandals@crustytoothpaste.net>\n---\n config.mak.uname | 1 +\n 1 file changed, 1 insertion(+)\n\ndiff --git a/config.mak.uname b/config.mak.uname\nindex ccb3f71881..7aab56c590 100644\n--- a/config.mak.uname\n+++ b/config.mak.uname\n@@ -63,6 +63,7 @@ ifeq ($(uname_S),Linux)\n \tPROCFS_EXECUTABLE_PATH = /proc/self/exe\n \tHAVE_PLATFORM_PROCINFO = YesPlease\n \tCOMPAT_OBJS += compat/linux/procinfo.o\n+\tEXTLIBS += -ldl\n \t# centos7/rhel7 provides gcc 4.8.5 and zlib 1.2.7.\n         ifneq ($(findstring .el7.,$(uname_R)),)\n \t\tBASIC_CFLAGS += -std=c99\n"},{"id":"540816","messageId":"xmqqldf4ocr2.fsf@gitster.g","threadId":"65421","inReplyTo":"20260403011249.4133372-1-sandals@crustytoothpaste.net","subject":"Re: [PATCH 0/4] Enable Rust by default","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2026-04-03T05:04:49Z","receivedAt":"2026-04-03T05:04:51Z","isPatch":true,"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n> Our breaking changes document said that we would enable Rust support by\n> default in Git 2.53, while still leaving the ability for it to be\n> disabled.  Unfortunately, we forgot to do that and my time machine is\n> broken right now, so this series sets it up for Git 2.54.\n>\n> The first patch updates the documentation accordingly and the next two\n> fix a few cases that are broken in our CI system.  The final patch\n> simply enables Rust by default except for two jobs to make sure that we\n> continue to build correctly without Rust for the moment.\n>\n> I didn't force Rust on with the breaking changes mode because it's\n> already on by default with this series and it seemed unnecessary.\n\nThanks.\n\n>\n> The GitHub Actions CI passes on all platforms with this series.\n>\n> brian m. carlson (4):\n>   docs: update version with default Rust support\n>   ci: install cargo on Alpine\n>   Linux: link against libdl\n>   Enable Rust by default\n>\n>  Documentation/BreakingChanges.adoc |  2 +-\n>  Makefile                           | 10 +++++-----\n>  ci/install-dependencies.sh         |  2 +-\n>  ci/lib.sh                          |  3 +++\n>  ci/run-build-and-tests.sh          |  2 +-\n>  config.mak.uname                   |  1 +\n>  meson.build                        |  2 +-\n>  meson_options.txt                  |  2 +-\n>  8 files changed, 14 insertions(+), 10 deletions(-)\n"},{"id":"541125","messageId":"adYp-I_VLV7S8RQP@pks.im","threadId":"65421","inReplyTo":"20260403011249.4133372-3-sandals@crustytoothpaste.net","subject":"Re: [PATCH 2/4] ci: install cargo on Alpine","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-04-08T10:12:08Z","receivedAt":"2026-04-08T10:12:14Z","isPatch":true,"body":"On Fri, Apr 03, 2026 at 01:12:47AM +0000, brian m. carlson wrote:\n> We'll make Rust the default in a future commit, so be sure to install\n> Cargo (which will also install Rust) to prepare for that case.\n\nDo we have one CI job that runs tests without Rust? If not I think\nwe should have one so that we can verify that Git continues to build\njust fine without it while it's not yet mandatory.\n\nEdit: I see you ensure that we do in a later commit.\n\nPatrick\n"},{"id":"541126","messageId":"adYp_l5-PxzQdqRb@pks.im","threadId":"65421","inReplyTo":"20260403011249.4133372-4-sandals@crustytoothpaste.net","subject":"Re: [PATCH 3/4] Linux: link against libdl","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-04-08T10:12:14Z","receivedAt":"2026-04-08T10:12:19Z","isPatch":true,"body":"On Fri, Apr 03, 2026 at 01:12:48AM +0000, brian m. carlson wrote:\n> Older versions of Rust on Linux, such as that used in Debian 11 in our\n> CI, require linking against libdl.  Were we linking with Cargo, this\n> would be included automatically, but since we're not, explicitly set it\n> in the system-specific config.\n> \n> This library is part of libc, so linking against it if it happens to be\n> unnecessary will add no dependencies to the resulting binary.  In\n> addition, it is provided by both glibc and musl, so it should be\n> portable to almost all Linux systems.\n\nFair. I was wondering whether we should make this conditional on\nWITH_RUST, but if it doesn't make a difference anyway I don't see why we\nshould.\n\nPatrick\n"},{"id":"541127","messageId":"adYqB0Ba65FEGHNB@pks.im","threadId":"65421","inReplyTo":"20260403011249.4133372-5-sandals@crustytoothpaste.net","subject":"Re: [PATCH 4/4] Enable Rust by default","fromName":"Patrick Steinhardt","fromEmail":"ps@pks.im","sentAt":"2026-04-08T10:12:23Z","receivedAt":"2026-04-08T10:12:29Z","isPatch":true,"body":"On Fri, Apr 03, 2026 at 01:12:49AM +0000, brian m. carlson wrote:\n> diff --git a/ci/run-build-and-tests.sh b/ci/run-build-and-tests.sh\n> index 28cfe730ee..bf1fdbe968 100755\n> --- a/ci/run-build-and-tests.sh\n> +++ b/ci/run-build-and-tests.sh\n> @@ -10,7 +10,6 @@ export TEST_CONTRIB_TOO=yes\n>  case \"$jobname\" in\n>  fedora-breaking-changes-musl|linux-breaking-changes)\n>  \texport WITH_BREAKING_CHANGES=YesPlease\n> -\texport WITH_RUST=YesPlease\n>  \tMESONFLAGS=\"$MESONFLAGS -Dbreaking_changes=true\"\n>  \tMESONFLAGS=\"$MESONFLAGS -Drust=enabled\"\n\nI guess we can drop this flag, as well.\n\n> @@ -30,6 +29,7 @@ linux-TEST-vars)\n>  \texport GIT_TEST_PACK_USE_BITMAP_BOUNDARY_TRAVERSAL=1\n>  \t;;\n>  linux-clang)\n> +\texport NO_RUST=UnfortunatelyYes\n>  \texport GIT_TEST_DEFAULT_HASH=sha1\n>  \t;;\n>  linux-sha256)\n\nDo we also want to to adjust one of the Meson-based jobs to not run with\nRust?\n\n> diff --git a/meson.build b/meson.build\n> index 8309942d18..4e1a58ee01 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -1746,7 +1746,7 @@ version_def_h = custom_target(\n>  libgit_sources += version_def_h\n>  \n>  cargo = find_program('cargo', dirs: program_path, native: true, required: get_option('rust'))\n\nWe should probably move this line into \"src/meson.build\".\n\n> -rust_option = get_option('rust').disable_auto_if(not cargo.found())\n> +rust_option = get_option('rust')\n>  if rust_option.allowed()\n>    subdir('src')\n>    libgit_c_args += '-DWITH_RUST'\n\nPatrick\n"}]}