summaryrefslogtreecommitdiff
path: root/devel
diff options
context:
space:
mode:
Diffstat (limited to 'devel')
-rw-r--r--devel/air-go/Makefile2
-rw-r--r--devel/android-tools/Makefile2
-rw-r--r--devel/app-builder-devel/Makefile1
-rw-r--r--devel/app-builder/Makefile2
-rw-r--r--devel/arduino-builder/Makefile2
-rw-r--r--devel/arduinoOTA/Makefile2
-rw-r--r--devel/awless/Makefile2
-rw-r--r--devel/bazel-buildtools/Makefile2
-rw-r--r--devel/bit/Makefile2
-rw-r--r--devel/buf/Makefile2
-rw-r--r--devel/buildkite-agent/Makefile1
-rw-r--r--devel/buildkite-cli/Makefile1
-rw-r--r--devel/chroma/Makefile2
-rw-r--r--devel/cirrus-cli/Makefile1
-rw-r--r--devel/delve/Makefile1
-rw-r--r--devel/dupl/Makefile2
-rw-r--r--devel/dwarf2json/Makefile2
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_BUILD.gn106
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_DEPS12
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_alias.cc25
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_alias.h40
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.cc20
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.h24
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_allocator__impls.cc108
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_allocator__impls.h27
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_allocator__impls__ffi.rs22
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_compiler__specific.h41
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_immediate__crash.h174
-rw-r--r--devel/electron32/files/patch-build_rust_allocator_lib.rs122
-rw-r--r--devel/electron32/files/patch-build_rust_cargo__crate.gni25
-rw-r--r--devel/electron32/files/patch-build_rust_rust__macro.gni12
-rw-r--r--devel/electron32/files/patch-build_rust_rust__target.gni13
-rw-r--r--devel/electron32/files/patch-build_rust_std_BUILD.gn58
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_BUILD.gn106
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_DEPS12
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_alias.cc25
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_alias.h40
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.cc20
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.h24
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_allocator__impls.cc108
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_allocator__impls.h27
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_allocator__impls__ffi.rs22
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_compiler__specific.h41
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_immediate__crash.h174
-rw-r--r--devel/electron33/files/patch-build_rust_allocator_lib.rs122
-rw-r--r--devel/electron33/files/patch-build_rust_cargo__crate.gni25
-rw-r--r--devel/electron33/files/patch-build_rust_rust__macro.gni12
-rw-r--r--devel/electron33/files/patch-build_rust_rust__target.gni13
-rw-r--r--devel/electron33/files/patch-build_rust_std_BUILD.gn56
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_BUILD.gn109
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_DEPS12
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_alias.cc25
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_alias.h40
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.cc20
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.h24
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_allocator__impls.cc108
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_allocator__impls.h27
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_allocator__impls__ffi.rs22
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_compiler__specific.h41
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_immediate__crash.h174
-rw-r--r--devel/electron34/files/patch-build_rust_allocator_lib.rs122
-rw-r--r--devel/electron34/files/patch-build_rust_cargo__crate.gni25
-rw-r--r--devel/electron34/files/patch-build_rust_rust__macro.gni12
-rw-r--r--devel/electron34/files/patch-build_rust_rust__target.gni13
-rw-r--r--devel/electron34/files/patch-build_rust_std_BUILD.gn56
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_BUILD.gn109
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_DEPS12
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_alias.cc25
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_alias.h40
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.cc20
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.h24
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_allocator__impls.cc108
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_allocator__impls.h27
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_allocator__impls__ffi.rs22
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_compiler__specific.h41
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_immediate__crash.h174
-rw-r--r--devel/electron35/files/patch-build_rust_allocator_lib.rs122
-rw-r--r--devel/electron35/files/patch-build_rust_cargo__crate.gni25
-rw-r--r--devel/electron35/files/patch-build_rust_rust__macro.gni12
-rw-r--r--devel/electron35/files/patch-build_rust_rust__target.gni13
-rw-r--r--devel/electron35/files/patch-build_rust_std_BUILD.gn80
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_BUILD.gn109
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_DEPS12
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_alias.cc25
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_alias.h40
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.cc20
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.h24
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_allocator__impls.cc108
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_allocator__impls.h27
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_allocator__impls__ffi.rs22
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_compiler__specific.h41
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_immediate__crash.h174
-rw-r--r--devel/electron36/files/patch-build_rust_allocator_lib.rs122
-rw-r--r--devel/electron36/files/patch-build_rust_cargo__crate.gni25
-rw-r--r--devel/electron36/files/patch-build_rust_rust__macro.gni12
-rw-r--r--devel/electron36/files/patch-build_rust_rust__target.gni13
-rw-r--r--devel/electron36/files/patch-build_rust_std_BUILD.gn80
-rw-r--r--devel/esbuild/Makefile2
-rw-r--r--devel/etcd/Makefile2
-rw-r--r--devel/etcd31/Makefile2
-rw-r--r--devel/etcd32/Makefile2
-rw-r--r--devel/etcd33/Makefile2
-rw-r--r--devel/gh/Makefile2
-rw-r--r--devel/gh/distinfo10
-rw-r--r--devel/ghq/Makefile2
-rw-r--r--devel/git-bug/Makefile2
-rw-r--r--devel/git-codereview/Makefile1
-rw-r--r--devel/git-lfs/Makefile2
-rw-r--r--devel/gitty/Makefile2
-rw-r--r--devel/gllvm/Makefile2
-rw-r--r--devel/go-bindata-assetfs/Makefile2
-rw-r--r--devel/go-bindata/Makefile2
-rw-r--r--devel/go-git/Makefile2
-rw-r--r--devel/go-perf/Makefile2
-rw-r--r--devel/go-wire/Makefile2
-rw-r--r--devel/gocheese/Makefile2
-rw-r--r--devel/gocritic/Makefile1
-rw-r--r--devel/gogs/Makefile2
-rw-r--r--devel/golint/Makefile2
-rw-r--r--devel/goprotobuf/Makefile2
-rw-r--r--devel/goredo/Makefile2
-rw-r--r--devel/goreleaser/Makefile1
-rw-r--r--devel/goswagger/Makefile2
-rw-r--r--devel/gpm/Makefile2
-rw-r--r--devel/gvp/Makefile2
-rw-r--r--devel/hub/Makefile2
-rw-r--r--devel/influx-pkg-config/Makefile2
-rw-r--r--devel/jiri/Makefile2
-rw-r--r--devel/lab/Makefile2
-rw-r--r--devel/lets/Makefile2
-rw-r--r--devel/libchdr/Makefile8
-rw-r--r--devel/libchdr/distinfo6
-rw-r--r--devel/linenoise-ng/Makefile3
-rw-r--r--devel/liteide/Makefile2
-rw-r--r--devel/loccount/Makefile2
-rw-r--r--devel/mage/Makefile2
-rw-r--r--devel/modd/Makefile2
-rw-r--r--devel/mutagen/Makefile2
-rw-r--r--devel/packr/Makefile2
-rw-r--r--devel/prototool/Makefile2
-rw-r--r--devel/py-types-jsonschema/Makefile3
-rw-r--r--devel/py-types-jsonschema/distinfo6
-rw-r--r--devel/py-types-jsonschema/files/patch-pyproject.toml23
-rw-r--r--devel/scc/Makefile2
-rw-r--r--devel/shfmt/Makefile2
-rw-r--r--devel/soft-serve/Makefile2
-rw-r--r--devel/statik/Makefile2
-rw-r--r--devel/stuffbin/Makefile2
-rw-r--r--devel/taskctl/Makefile2
-rw-r--r--devel/tinygo/Makefile2
-rw-r--r--devel/venom/Makefile2
-rw-r--r--devel/yaegi/Makefile2
-rw-r--r--devel/zls/Makefile16
-rw-r--r--devel/zls/distinfo18
154 files changed, 4304 insertions, 105 deletions
diff --git a/devel/air-go/Makefile b/devel/air-go/Makefile
index bd64e52daf69..f1bfb3e3ff7f 100644
--- a/devel/air-go/Makefile
+++ b/devel/air-go/Makefile
@@ -1,7 +1,7 @@
PORTNAME= air
DISTVERSIONPREFIX= v
DISTVERSION= 1.61.7
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
PKGNAMESUFFIX= -go
diff --git a/devel/android-tools/Makefile b/devel/android-tools/Makefile
index 330f1f1fb6b8..e8fe1a5d83e2 100644
--- a/devel/android-tools/Makefile
+++ b/devel/android-tools/Makefile
@@ -1,6 +1,6 @@
PORTNAME= android-tools
PORTVERSION= 31.0.3p2.0
-PORTREVISION= 32
+PORTREVISION= 33
CATEGORIES= devel
MASTER_SITES= GH
diff --git a/devel/app-builder-devel/Makefile b/devel/app-builder-devel/Makefile
index dea95b2527fd..f0e891bc44cb 100644
--- a/devel/app-builder-devel/Makefile
+++ b/devel/app-builder-devel/Makefile
@@ -1,6 +1,7 @@
PORTNAME= app-builder
DISTVERSIONPREFIX= v
DISTVERSION= 5.0.0-alpha.13
+PORTREVISION= 1
CATEGORIES= devel
PKGNAMESUFFIX= -devel
diff --git a/devel/app-builder/Makefile b/devel/app-builder/Makefile
index 56f4986874bd..88095fcb149d 100644
--- a/devel/app-builder/Makefile
+++ b/devel/app-builder/Makefile
@@ -1,7 +1,7 @@
PORTNAME= app-builder
DISTVERSIONPREFIX= v
DISTVERSION= 3.4.2
-PORTREVISION= 10
+PORTREVISION= 11
PORTEPOCH= 1
CATEGORIES= devel
diff --git a/devel/arduino-builder/Makefile b/devel/arduino-builder/Makefile
index ef0210a07fd3..c9aee907cbab 100644
--- a/devel/arduino-builder/Makefile
+++ b/devel/arduino-builder/Makefile
@@ -1,6 +1,6 @@
PORTNAME= arduino-builder
PORTVERSION= 1.3.25
-PORTREVISION= 27
+PORTREVISION= 28
CATEGORIES= devel
MAINTAINER= kevans@FreeBSD.org
diff --git a/devel/arduinoOTA/Makefile b/devel/arduinoOTA/Makefile
index 74b116d0d9c1..993594eaa765 100644
--- a/devel/arduinoOTA/Makefile
+++ b/devel/arduinoOTA/Makefile
@@ -1,6 +1,6 @@
PORTNAME= arduinoOTA
PORTVERSION= 1.2.0
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= kevans@FreeBSD.org
diff --git a/devel/awless/Makefile b/devel/awless/Makefile
index 3a030c3dbb30..68b919e58ccb 100644
--- a/devel/awless/Makefile
+++ b/devel/awless/Makefile
@@ -1,7 +1,7 @@
PORTNAME= awless
DISTVERSIONPREFIX= v
DISTVERSION= 0.1.11
-PORTREVISION= 27
+PORTREVISION= 28
CATEGORIES= devel
MAINTAINER= ports@FreeBSD.org
diff --git a/devel/bazel-buildtools/Makefile b/devel/bazel-buildtools/Makefile
index b9a150c0245e..87fb4b929040 100644
--- a/devel/bazel-buildtools/Makefile
+++ b/devel/bazel-buildtools/Makefile
@@ -1,6 +1,6 @@
PORTNAME= bazel-buildtools
DISTVERSION= 3.2.1
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/bit/Makefile b/devel/bit/Makefile
index 1b84a50645b4..f9610ef90d1d 100644
--- a/devel/bit/Makefile
+++ b/devel/bit/Makefile
@@ -1,7 +1,7 @@
PORTNAME= bit
DISTVERSIONPREFIX= v
DISTVERSION= 1.1.2
-PORTREVISION= 25
+PORTREVISION= 26
CATEGORIES= devel
MAINTAINER= ashish@FreeBSD.org
diff --git a/devel/buf/Makefile b/devel/buf/Makefile
index 77c59dc9bd06..0d499c4440a1 100644
--- a/devel/buf/Makefile
+++ b/devel/buf/Makefile
@@ -1,7 +1,7 @@
PORTNAME= buf
DISTVERSIONPREFIX= v
DISTVERSION= 1.32.1
-PORTREVISION= 5
+PORTREVISION= 6
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/buildkite-agent/Makefile b/devel/buildkite-agent/Makefile
index 1329012e2d04..0bbf16d043a9 100644
--- a/devel/buildkite-agent/Makefile
+++ b/devel/buildkite-agent/Makefile
@@ -1,6 +1,7 @@
PORTNAME= buildkite-agent
DISTVERSIONPREFIX= v
DISTVERSION= 3.97.0
+PORTREVISION= 1
CATEGORIES= devel sysutils
MAINTAINER= dch@FreeBSD.org
diff --git a/devel/buildkite-cli/Makefile b/devel/buildkite-cli/Makefile
index a649290abafe..1e725a16141f 100644
--- a/devel/buildkite-cli/Makefile
+++ b/devel/buildkite-cli/Makefile
@@ -1,6 +1,7 @@
PORTNAME= buildkite-cli
DISTVERSIONPREFIX= v
DISTVERSION= 3.7.1
+PORTREVISION= 1
CATEGORIES= devel sysutils
MAINTAINER= dch@FreeBSD.org
diff --git a/devel/chroma/Makefile b/devel/chroma/Makefile
index f90edb0a866d..b3a13ac55ae6 100644
--- a/devel/chroma/Makefile
+++ b/devel/chroma/Makefile
@@ -1,7 +1,7 @@
PORTNAME= chroma
DISTVERSIONPREFIX= v
DISTVERSION= 0.9.2
-PORTREVISION= 25
+PORTREVISION= 26
CATEGORIES= devel
PKGNAMESUFFIX= -syntax-highlighter
diff --git a/devel/cirrus-cli/Makefile b/devel/cirrus-cli/Makefile
index d1a9883bd0a7..a20e3b37837a 100644
--- a/devel/cirrus-cli/Makefile
+++ b/devel/cirrus-cli/Makefile
@@ -1,6 +1,7 @@
PORTNAME= cirrus-cli
DISTVERSIONPREFIX= v
DISTVERSION= 0.132.0
+PORTREVISION= 1
CATEGORIES= devel
MAINTAINER= bofh@FreeBSD.org
diff --git a/devel/delve/Makefile b/devel/delve/Makefile
index 402da67c17fe..4b1cb1d6a74f 100644
--- a/devel/delve/Makefile
+++ b/devel/delve/Makefile
@@ -1,6 +1,7 @@
PORTNAME= delve
DISTVERSIONPREFIX= v
DISTVERSION= 1.24.2
+PORTREVISION= 1
CATEGORIES= devel
MAINTAINER= dmitry.wagin@ya.ru
diff --git a/devel/dupl/Makefile b/devel/dupl/Makefile
index c49b2bc72dcb..cffb0b310d69 100644
--- a/devel/dupl/Makefile
+++ b/devel/dupl/Makefile
@@ -2,7 +2,7 @@ PORTNAME= dupl
DISTVERSIONPREFIX= v
DISTVERSION= 1.0.0-11
DISTVERSIONSUFFIX= -g28d787e
-PORTREVISION= 25
+PORTREVISION= 26
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/dwarf2json/Makefile b/devel/dwarf2json/Makefile
index c0d23ea62bd3..78adeecf049e 100644
--- a/devel/dwarf2json/Makefile
+++ b/devel/dwarf2json/Makefile
@@ -1,6 +1,6 @@
PORTNAME= dwarf2json
DISTVERSION= g20220807
-PORTREVISION= 20
+PORTREVISION= 21
CATEGORIES= devel
MAINTAINER= antoine@FreeBSD.org
diff --git a/devel/electron32/files/patch-build_rust_allocator_BUILD.gn b/devel/electron32/files/patch-build_rust_allocator_BUILD.gn
new file mode 100644
index 000000000000..cbc5c7dcf1fe
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_BUILD.gn
@@ -0,0 +1,106 @@
+--- build/rust/allocator/BUILD.gn.orig 2025-05-22 04:39:53 UTC
++++ build/rust/allocator/BUILD.gn
+@@ -0,0 +1,103 @@
++# Copyright 2025 The Chromium Authors
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/buildflag_header.gni")
++import("//build/config/rust.gni")
++import("//build/rust/rust_static_library.gni")
++
++rust_allocator_uses_partition_alloc = false
++if (build_with_chromium) {
++ import("//base/allocator/partition_allocator/partition_alloc.gni")
++ rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
++}
++
++# In ASAN builds, PartitionAlloc-Everywhere is disabled, meaning malloc() and
++# friends in C++ do not go to PartitionAlloc. So we also don't point the Rust
++# allocation functions at PartitionAlloc. Generally, this means we just direct
++# them to the Standard Library's allocator.
++#
++# However, on Windows the Standard Library uses HeapAlloc() and Windows ASAN
++# does *not* hook that method, so ASAN does not get to hear about allocations
++# made in Rust. To resolve this, we redirect allocation to _aligned_malloc
++# which Windows ASAN *does* hook.
++#
++# Note that there is a runtime option to make ASAN hook HeapAlloc() but
++# enabling it breaks Win32 APIs like CreateProcess:
++# https://crbug.com/368070343#comment29
++rust_allocator_uses_aligned_malloc = false
++if (!rust_allocator_uses_partition_alloc && is_win && is_asan) {
++ rust_allocator_uses_aligned_malloc = true
++}
++
++rust_allocator_uses_allocator_impls_h =
++ rust_allocator_uses_partition_alloc || rust_allocator_uses_aligned_malloc
++
++buildflag_header("buildflags") {
++ header = "buildflags.h"
++ flags = [
++ "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
++ "RUST_ALLOCATOR_USES_ALIGNED_MALLOC=$rust_allocator_uses_aligned_malloc",
++ ]
++ visibility = [ ":*" ]
++}
++
++if (toolchain_has_rust) {
++ # All targets which depend on Rust code but are not linked by rustc must
++ # depend on this. Usually, this dependency will come from the rust_target() GN
++ # template. However, cargo_crate() does *not* include this dependency so any
++ # C++ targets which directly depend on a cargo_crate() must depend on this.
++ rust_static_library("allocator") {
++ sources = [ "lib.rs" ]
++ crate_root = "lib.rs"
++ cxx_bindings = [ "lib.rs" ]
++
++ deps = [ ":alloc_error_handler_impl" ]
++ if (rust_allocator_uses_allocator_impls_h) {
++ deps += [ ":allocator_impls" ]
++ }
++
++ no_chromium_prelude = true
++ no_allocator_crate = true
++ allow_unsafe = true
++
++ rustflags = []
++ if (rust_allocator_uses_allocator_impls_h) {
++ rustflags += [ "--cfg=rust_allocator_uses_allocator_impls_h" ]
++ cxx_bindings += [ "allocator_impls_ffi.rs" ]
++ sources += [ "allocator_impls_ffi.rs" ]
++ }
++ }
++
++ if (rust_allocator_uses_allocator_impls_h) {
++ static_library("allocator_impls") {
++ public_deps = []
++ if (rust_allocator_uses_partition_alloc) {
++ public_deps +=
++ [ "//base/allocator/partition_allocator:partition_alloc" ]
++ }
++
++ sources = [
++ "allocator_impls.cc",
++ "allocator_impls.h",
++ ]
++ deps = [ ":buildflags" ]
++ visibility = [ ":*" ]
++ }
++ }
++
++ static_library("alloc_error_handler_impl") {
++ sources = [
++ # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
++ # copied from `//base`.
++ # TODO(crbug.com/40279749): Avoid duplication / reuse code.
++ "alias.cc",
++ "alias.h",
++ "alloc_error_handler_impl.cc",
++ "alloc_error_handler_impl.h",
++ "compiler_specific.h",
++ "immediate_crash.h",
++ ]
++ visibility = [ ":*" ]
++ }
++}
diff --git a/devel/electron32/files/patch-build_rust_allocator_DEPS b/devel/electron32/files/patch-build_rust_allocator_DEPS
new file mode 100644
index 000000000000..74bb2d6c2421
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_DEPS
@@ -0,0 +1,12 @@
+--- build/rust/allocator/DEPS.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/DEPS
+@@ -0,0 +1,9 @@
++include_rules = [
++ "-base",
++]
++
++specific_include_rules = {
++ "allocator_impls.cc" : [
++ "+partition_alloc"
++ ]
++}
diff --git a/devel/electron32/files/patch-build_rust_allocator_alias.cc b/devel/electron32/files/patch-build_rust_allocator_alias.cc
new file mode 100644
index 000000000000..5280641f27e1
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_alias.cc
@@ -0,0 +1,25 @@
+--- build/rust/allocator/alias.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.cc
+@@ -0,0 +1,22 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.cc ( additionally the APIs
++// were moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#include "build/rust/allocator/alias.h"
++
++#include "build/rust/allocator/compiler_specific.h"
++
++namespace build_rust_std {
++namespace debug {
++
++// This file/function should be excluded from LTO/LTCG to ensure that the
++// compiler can't see this function's implementation when compiling calls to it.
++NOINLINE void Alias(const void* var) {}
++
++} // namespace debug
++} // namespace build_rust_std
diff --git a/devel/electron32/files/patch-build_rust_allocator_alias.h b/devel/electron32/files/patch-build_rust_allocator_alias.h
new file mode 100644
index 000000000000..6530c6ae8779
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_alias.h
@@ -0,0 +1,40 @@
+--- build/rust/allocator/alias.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.h
+@@ -0,0 +1,37 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.h (and then trimmed to just
++// the APIs / macros needed by //build/rust/std; additionally the APIs were
++// moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALIAS_H_
++#define BUILD_RUST_ALLOCATOR_ALIAS_H_
++
++#include <stddef.h>
++
++namespace build_rust_std {
++namespace debug {
++
++// Make the optimizer think that |var| is aliased. This can be used to prevent a
++// local variable from being optimized out (which is something that
++// `NO_CODE_FOLDING` macro definition below depends on). See
++// //base/debug/alias.h for more details.
++void Alias(const void* var);
++
++} // namespace debug
++
++} // namespace build_rust_std
++
++// Prevent code folding (where a linker identifies functions that are
++// bit-identical and overlays them, which saves space but it leads to confusing
++// call stacks because multiple symbols are at the same address). See
++// //base/debug/alias.h for more details.
++#define NO_CODE_FOLDING() \
++ const int line_number = __LINE__; \
++ build_rust_std::debug::Alias(&line_number)
++
++#endif // BUILD_RUST_ALLOCATOR_ALIAS_H_
diff --git a/devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.cc b/devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
new file mode 100644
index 000000000000..048c267abefa
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
@@ -0,0 +1,20 @@
+--- build/rust/allocator/alloc_error_handler_impl.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.cc
+@@ -0,0 +1,17 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/alloc_error_handler_impl.h"
++
++#include "build/rust/allocator/alias.h"
++#include "build/rust/allocator/immediate_crash.h"
++
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl() {
++ NO_CODE_FOLDING();
++ IMMEDIATE_CRASH();
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.h b/devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.h
new file mode 100644
index 000000000000..887ea602b027
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_alloc__error__handler__impl.h
@@ -0,0 +1,24 @@
+--- build/rust/allocator/alloc_error_handler_impl.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.h
+@@ -0,0 +1,21 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++#define BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++
++// This header exposes to Rust a C++ implementation of quickly crashing after an
++// allocation error. (The API below is called from `__rust_alloc_error_handler`
++// in `lib.rs`.)
++//
++// TODO(lukasza): Investigate if we can delete this `.h` / `.cc` and just call
++// `std::process::abort()` (or something else?) directly from `.rs`. The main
++// open question is how much we care about `NO_CODE_FOLDING`.
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl();
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
diff --git a/devel/electron32/files/patch-build_rust_allocator_allocator__impls.cc b/devel/electron32/files/patch-build_rust_allocator_allocator__impls.cc
new file mode 100644
index 000000000000..94e04d7b966a
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_allocator__impls.cc
@@ -0,0 +1,108 @@
+--- build/rust/allocator/allocator_impls.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.cc
+@@ -0,0 +1,105 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/allocator_impls.h"
++
++#ifdef UNSAFE_BUFFERS_BUILD
++// TODO(crbug.com/390223051): Remove C-library calls to fix the errors.
++#pragma allow_unsafe_libc_calls
++#endif
++
++#include <cstddef>
++#include <cstring>
++
++#include "build/build_config.h"
++#include "build/rust/allocator/buildflags.h"
++
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++#include "partition_alloc/partition_alloc_constants.h" // nogncheck
++#include "partition_alloc/shim/allocator_shim.h" // nogncheck
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++#include <cstdlib>
++#endif
++
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // PartitionAlloc will crash if given an alignment larger than this.
++ if (align > partition_alloc::internal::kMaxSupportedAlignment) {
++ return nullptr;
++ }
++
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(allocator_shim::UncheckedAlloc(size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedAlloc(size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_malloc(size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++void dealloc(unsigned char* p, size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ if (align <= alignof(std::max_align_t)) {
++ allocator_shim::UncheckedFree(p);
++ } else {
++ allocator_shim::UncheckedAlignedFree(p);
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return _aligned_free(p);
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedRealloc(p, new_size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedRealloc(p, new_size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_realloc(p, new_size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* alloc_zeroed(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) || \
++ BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ // TODO(danakj): When RUST_ALLOCATOR_USES_PARTITION_ALLOC is true, it's
++ // possible that a partition_alloc::UncheckedAllocZeroed() call would perform
++ // better than partition_alloc::UncheckedAlloc() + memset. But there is no
++ // such API today. See b/342251590.
++ unsigned char* p = alloc(size, align);
++ if (p) {
++ memset(p, 0, size);
++ }
++ return p;
++#else
++#error This configuration is not supported.
++#endif
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron32/files/patch-build_rust_allocator_allocator__impls.h b/devel/electron32/files/patch-build_rust_allocator_allocator__impls.h
new file mode 100644
index 000000000000..9249cdc938d2
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_allocator__impls.h
@@ -0,0 +1,27 @@
+--- build/rust/allocator/allocator_impls.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.h
+@@ -0,0 +1,24 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++
++#include <cstddef>
++
++// This header exposes a C++ allocator (e.g. PartitionAlloc) to Rust.
++// The APIs below are called from `impl GlobalAlloc` in `lib.rs`.
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align);
++void dealloc(unsigned char* p, size_t size, size_t align);
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size);
++unsigned char* alloc_zeroed(size_t size, size_t align);
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
diff --git a/devel/electron32/files/patch-build_rust_allocator_allocator__impls__ffi.rs b/devel/electron32/files/patch-build_rust_allocator_allocator__impls__ffi.rs
new file mode 100644
index 000000000000..8f0baf1576ce
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_allocator__impls__ffi.rs
@@ -0,0 +1,22 @@
+--- build/rust/allocator/allocator_impls_ffi.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls_ffi.rs
+@@ -0,0 +1,19 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! FFI for `allocator_impls.h` is in a separate `.rs` file/module to
++//! better support conditional compilation (these functions are only
++//! used under `#[cfg(rust_allocator_uses_allocator_impls_h)]`.
++
++#[cxx::bridge(namespace = "rust_allocator_internal")]
++pub mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/allocator_impls.h");
++
++ unsafe fn alloc(size: usize, align: usize) -> *mut u8;
++ unsafe fn dealloc(p: *mut u8, size: usize, align: usize);
++ unsafe fn realloc(p: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
++ unsafe fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
++ }
++}
diff --git a/devel/electron32/files/patch-build_rust_allocator_compiler__specific.h b/devel/electron32/files/patch-build_rust_allocator_compiler__specific.h
new file mode 100644
index 000000000000..7feb0c739d79
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_compiler__specific.h
@@ -0,0 +1,41 @@
+--- build/rust/allocator/compiler_specific.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/compiler_specific.h
+@@ -0,0 +1,38 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/compiler_specific.h (and then
++// significantly trimmed to just the APIs / macros needed by //build/rust/std).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++#define BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++
++#include "build/build_config.h"
++
++#if defined(COMPILER_MSVC) && !defined(__clang__)
++#error "Only clang-cl is supported on Windows, see https://crbug.com/988071"
++#endif
++
++#if defined(__has_attribute)
++#define HAS_ATTRIBUTE(x) __has_attribute(x)
++#else
++#define HAS_ATTRIBUTE(x) 0
++#endif
++
++// Annotate a function indicating it should not be inlined.
++// Use like:
++// NOINLINE void DoStuff() { ... }
++#if defined(__clang__) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE [[clang::noinline]]
++#elif defined(COMPILER_GCC) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE __attribute__((noinline))
++#elif defined(COMPILER_MSVC)
++#define NOINLINE __declspec(noinline)
++#else
++#define NOINLINE
++#endif
++
++#endif // BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
diff --git a/devel/electron32/files/patch-build_rust_allocator_immediate__crash.h b/devel/electron32/files/patch-build_rust_allocator_immediate__crash.h
new file mode 100644
index 000000000000..7ab0f9d9c34c
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_immediate__crash.h
@@ -0,0 +1,174 @@
+--- build/rust/allocator/immediate_crash.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/immediate_crash.h
+@@ -0,0 +1,171 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/immediate_crash.h.
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++#define BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++
++#include "build/build_config.h"
++
++// Crashes in the fastest possible way with no attempt at logging.
++// There are several constraints; see http://crbug.com/664209 for more context.
++//
++// - TRAP_SEQUENCE_() must be fatal. It should not be possible to ignore the
++// resulting exception or simply hit 'continue' to skip over it in a debugger.
++// - Different instances of TRAP_SEQUENCE_() must not be folded together, to
++// ensure crash reports are debuggable. Unlike __builtin_trap(), asm volatile
++// blocks will not be folded together.
++// Note: TRAP_SEQUENCE_() previously required an instruction with a unique
++// nonce since unlike clang, GCC folds together identical asm volatile
++// blocks.
++// - TRAP_SEQUENCE_() must produce a signal that is distinct from an invalid
++// memory access.
++// - TRAP_SEQUENCE_() must be treated as a set of noreturn instructions.
++// __builtin_unreachable() is used to provide that hint here. clang also uses
++// this as a heuristic to pack the instructions in the function epilogue to
++// improve code density.
++//
++// Additional properties that are nice to have:
++// - TRAP_SEQUENCE_() should be as compact as possible.
++// - The first instruction of TRAP_SEQUENCE_() should not change, to avoid
++// shifting crash reporting clusters. As a consequence of this, explicit
++// assembly is preferred over intrinsics.
++// Note: this last bullet point may no longer be true, and may be removed in
++// the future.
++
++// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact
++// that clang emits an actual instruction for __builtin_unreachable() on certain
++// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will
++// be removed in followups, so splitting it up like this now makes it easy to
++// land the followups.
++
++#if defined(COMPILER_GCC)
++
++#if BUILDFLAG(IS_NACL)
++
++// Crash report accuracy is not guaranteed on NaCl.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#elif defined(ARCH_CPU_X86_FAMILY)
++
++// TODO(crbug.com/40625592): In theory, it should be possible to use just
++// int3. However, there are a number of crashes with SIGILL as the exception
++// code, so it seems likely that there's a signal handler that allows execution
++// to continue after SIGTRAP.
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++
++#if BUILDFLAG(IS_APPLE)
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
++#define TRAP_SEQUENCE2_() asm volatile("")
++#else
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++#endif // BUILDFLAG(IS_APPLE)
++
++#elif defined(ARCH_CPU_ARMEL)
++
++// bkpt will generate a SIGBUS when running on armv7 and a SIGTRAP when running
++// as a 32 bit userspace app on arm64. There doesn't seem to be any way to
++// cause a SIGTRAP from userspace without using a syscall (which would be a
++// problem for sandboxing).
++// TODO(crbug.com/40625592): Remove bkpt from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("bkpt #0")
++#define TRAP_SEQUENCE2_() asm volatile("udf #0")
++
++#elif defined(ARCH_CPU_ARM64)
++
++// This will always generate a SIGTRAP on arm64.
++// TODO(crbug.com/40625592): Remove brk from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("brk #0")
++#define TRAP_SEQUENCE2_() asm volatile("hlt #0")
++
++#else
++
++// Crash report accuracy will not be guaranteed on other architectures, but at
++// least this will crash as expected.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#endif // ARCH_CPU_*
++
++#elif defined(COMPILER_MSVC)
++
++#if !defined(__clang__)
++
++// MSVC x64 doesn't support inline asm, so use the MSVC intrinsic.
++#define TRAP_SEQUENCE1_() __debugbreak()
++#define TRAP_SEQUENCE2_()
++
++#elif defined(ARCH_CPU_ARM64)
++
++// Windows ARM64 uses "BRK #F000" as its breakpoint instruction, and
++// __debugbreak() generates that in both VC++ and clang.
++#define TRAP_SEQUENCE1_() __debugbreak()
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64,
++// https://crbug.com/958373
++#define TRAP_SEQUENCE2_() __asm volatile("")
++
++#else
++
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++
++#endif // __clang__
++
++#else
++
++#error No supported trap sequence!
++
++#endif // COMPILER_GCC
++
++#define TRAP_SEQUENCE_() \
++ do { \
++ TRAP_SEQUENCE1_(); \
++ TRAP_SEQUENCE2_(); \
++ } while (false)
++
++// CHECK() and the trap sequence can be invoked from a constexpr function.
++// This could make compilation fail on GCC, as it forbids directly using inline
++// asm inside a constexpr function. However, it allows calling a lambda
++// expression including the same asm.
++// The side effect is that the top of the stacktrace will not point to the
++// calling function, but to this anonymous lambda. This is still useful as the
++// full name of the lambda will typically include the name of the function that
++// calls CHECK() and the debugger will still break at the right line of code.
++#if !defined(COMPILER_GCC) || defined(__clang__)
++
++#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_()
++
++#else
++
++#define WRAPPED_TRAP_SEQUENCE_() \
++ do { \
++ [] { TRAP_SEQUENCE_(); }(); \
++ } while (false)
++
++#endif // !defined(COMPILER_GCC) || defined(__clang__)
++
++#if defined(__clang__) || defined(COMPILER_GCC)
++
++// __builtin_unreachable() hints to the compiler that this is noreturn and can
++// be packed in the function epilogue.
++#define IMMEDIATE_CRASH() \
++ ({ \
++ WRAPPED_TRAP_SEQUENCE_(); \
++ __builtin_unreachable(); \
++ })
++
++#else
++
++// This is supporting non-chromium user of logging.h to build with MSVC, like
++// pdfium. On MSVC there is no __builtin_unreachable().
++#define IMMEDIATE_CRASH() WRAPPED_TRAP_SEQUENCE_()
++
++#endif // defined(__clang__) || defined(COMPILER_GCC)
++
++#endif // BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
diff --git a/devel/electron32/files/patch-build_rust_allocator_lib.rs b/devel/electron32/files/patch-build_rust_allocator_lib.rs
new file mode 100644
index 000000000000..89fddf278294
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_allocator_lib.rs
@@ -0,0 +1,122 @@
+--- build/rust/allocator/lib.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/lib.rs
+@@ -0,0 +1,119 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! Define the allocator that Rust code in Chrome should use.
++//!
++//! Any final artifact that depends on this crate, even transitively, will use
++//! the allocator defined here.
++//!
++//! List of known issues:
++//!
++//! 1. We'd like to use PartitionAlloc on Windows, but the stdlib uses Windows
++//! heap functions directly that PartitionAlloc can not intercept.
++//! 2. We'd like `Vec::try_reserve` to fail at runtime on Linux instead of
++//! crashing in malloc() where PartitionAlloc replaces that function.
++
++// Required to apply weak linkage to symbols.
++//
++// TODO(https://crbug.com/410596442): Stop using unstable features here.
++// https://github.com/rust-lang/rust/issues/29603 tracks stabilization of the `linkage` feature.
++#![feature(linkage)]
++// Required to apply `#[rustc_std_internal_symbol]` to our alloc error handler
++// so the name is correctly mangled as rustc expects.
++//
++// TODO(https://crbug.com/410596442): Stop using internal features here.
++#![allow(internal_features)]
++#![feature(rustc_attrs)]
++
++// This module is in a separate source file to avoid having to teach `cxxbridge`
++// about conditional compilation.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod allocator_impls_ffi;
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using an allocator from C++.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod cpp_allocator {
++ use super::allocator_impls_ffi::ffi;
++ use std::alloc::{GlobalAlloc, Layout};
++
++ struct Allocator;
++
++ unsafe impl GlobalAlloc for Allocator {
++ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc(layout.size(), layout.align()) }
++ }
++
++ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
++ unsafe {
++ ffi::dealloc(ptr, layout.size(), layout.align());
++ }
++ }
++
++ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc_zeroed(layout.size(), layout.align()) }
++ }
++
++ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
++ unsafe { ffi::realloc(ptr, layout.size(), layout.align(), new_size) }
++ }
++ }
++
++ #[global_allocator]
++ static GLOBAL: Allocator = Allocator;
++}
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using the default Rust allocator.
++#[cfg(not(rust_allocator_uses_allocator_impls_h))]
++mod rust_allocator {
++ #[global_allocator]
++ static GLOBAL: std::alloc::System = std::alloc::System;
++}
++
++/// Module that provides global symbols that are needed both by `cpp_allocator`
++/// and `rust_allocator`.
++///
++/// When `rustc` drives linking, then it will define the symbols below. But
++/// Chromium only uses `rustc` to link Rust-only executables (e.g. `build.rs`
++/// scripts) and otherwise uses a non-Rust linker. This is why we have to
++/// manually define a few symbols below. We define those symbols
++/// as "weak" symbols, so that Rust-provided symbols "win" in case where Rust
++/// actually does drive the linking. This hack works (not only for Chromium,
++/// but also for google3 and other projects), but isn't officially supported by
++/// `rustc`.
++///
++/// TODO(https://crbug.com/410596442): Stop using internal features here.
++mod both_allocators {
++ /// As part of rustc's contract for using `#[global_allocator]` without
++ /// rustc-generated shims we must define this symbol, since we are opting in
++ /// to unstable functionality. See https://github.com/rust-lang/rust/issues/123015
++ #[no_mangle]
++ #[linkage = "weak"]
++ static __rust_no_alloc_shim_is_unstable: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ static __rust_alloc_error_handler_should_panic: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ fn __rust_alloc_error_handler(_size: usize, _align: usize) {
++ // TODO(lukasza): Investigate if we can just call `std::process::abort()` here.
++ // (Not really _needed_, but it could simplify code a little bit.)
++ unsafe { ffi::alloc_error_handler_impl() }
++ }
++
++ #[cxx::bridge(namespace = "rust_allocator_internal")]
++ mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/alloc_error_handler_impl.h");
++ unsafe fn alloc_error_handler_impl();
++ }
++ }
++}
diff --git a/devel/electron32/files/patch-build_rust_cargo__crate.gni b/devel/electron32/files/patch-build_rust_cargo__crate.gni
new file mode 100644
index 000000000000..d635e722200c
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_cargo__crate.gni
@@ -0,0 +1,25 @@
+--- build/rust/cargo_crate.gni.orig 2024-10-18 12:33:59 UTC
++++ build/rust/cargo_crate.gni
+@@ -273,6 +273,12 @@ template("cargo_crate") {
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
+
++ # Don't depend on the chrome-specific #[global_allocator] crate from
++ # third-party code. This avoids some dependency cycle issues. The allocator
++ # crate will still be used if it exists anywhere in the dependency graph for
++ # a given linked artifact.
++ no_allocator_crate = true
++
+ rustc_metadata = _rustc_metadata
+
+ # TODO(crbug.com/40259764): don't default to true. This requires changes to
+@@ -466,6 +472,9 @@ template("cargo_crate") {
+
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
++
++ # Build scripts do not need to link to chrome's allocator.
++ no_allocator_crate = true
+
+ # The ${_build_script_name}_output target looks for the exe in this
+ # location. Due to how the Windows component build works, this has to
diff --git a/devel/electron32/files/patch-build_rust_rust__macro.gni b/devel/electron32/files/patch-build_rust_rust__macro.gni
new file mode 100644
index 000000000000..0dafc3819aa1
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_rust__macro.gni
@@ -0,0 +1,12 @@
+--- build/rust/rust_macro.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_macro.gni
+@@ -16,6 +16,9 @@ template("rust_macro") {
+ forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+ proc_macro_configs = invoker.configs
+ target_type = "rust_proc_macro"
++
++ # Macros are loaded by rustc and shouldn't use chrome's allocation routines.
++ no_allocator_crate = true
+ }
+ }
+
diff --git a/devel/electron32/files/patch-build_rust_rust__target.gni b/devel/electron32/files/patch-build_rust_rust__target.gni
new file mode 100644
index 000000000000..baae37a2b643
--- /dev/null
+++ b/devel/electron32/files/patch-build_rust_rust__target.gni
@@ -0,0 +1,13 @@
+--- build/rust/rust_target.gni.orig 2024-10-18 12:33:59 UTC
++++ build/rust/rust_target.gni
+@@ -307,6 +307,10 @@ template("rust_target") {
+ _rust_deps += [ "//build/rust/std" ]
+ }
+
++ if (!defined(invoker.no_allocator_crate) || !invoker.no_allocator_crate) {
++ _rust_deps += [ "//build/rust/allocator" ]
++ }
++
+ if (_build_unit_tests) {
+ _unit_test_target = "${_target_name}_unittests"
+ if (defined(invoker.unit_test_target)) {
diff --git a/devel/electron32/files/patch-build_rust_std_BUILD.gn b/devel/electron32/files/patch-build_rust_std_BUILD.gn
index 473f4c097e4b..1564fa7b808a 100644
--- a/devel/electron32/files/patch-build_rust_std_BUILD.gn
+++ b/devel/electron32/files/patch-build_rust_std_BUILD.gn
@@ -1,6 +1,36 @@
---- build/rust/std/BUILD.gn.orig 2025-04-05 13:54:50 UTC
+--- build/rust/std/BUILD.gn.orig 2024-10-18 12:33:59 UTC
+++ build/rust/std/BUILD.gn
-@@ -89,13 +89,20 @@ if (toolchain_has_rust) {
+@@ -22,29 +22,6 @@ if (toolchain_has_rust) {
+ import("//build/config/sanitizers/sanitizers.gni")
+
+ if (toolchain_has_rust) {
+- # If clang performs the link step, we need to provide the allocator symbols
+- # that are normally injected by rustc during linking.
+- #
+- # We also "happen to" use this to redirect allocations to PartitionAlloc,
+- # though that would be better done through a #[global_allocator] crate (see
+- # above).
+- source_set("remap_alloc") {
+- public_deps = [ "//base/allocator/partition_allocator:buildflags" ]
+- if (use_partition_alloc_as_malloc) {
+- public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
+- }
+- sources = [
+- # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
+- # copied from `//base`.
+- # TODO(crbug.com/40279749): Avoid duplication / reuse code.
+- "alias.cc",
+- "alias.h",
+- "compiler_specific.h",
+- "immediate_crash.h",
+- "remap_alloc.cc",
+- ]
+- }
+-
+ # List of Rust stdlib rlibs which are present in the official Rust toolchain
+ # we are using from the Android team. This is usually a version or two behind
+ # nightly. Generally this matches the toolchain we build ourselves, but if
+@@ -74,13 +51,20 @@ if (toolchain_has_rust) {
# These are no longer present in the Windows toolchain.
stdlib_files += [
"addr2line",
@@ -22,7 +52,7 @@
}
if (toolchain_for_rust_host_build_tools) {
-@@ -115,7 +122,6 @@ if (toolchain_has_rust) {
+@@ -100,7 +84,6 @@ if (toolchain_has_rust) {
# don't need to pass to the C++ linker because they're used for specialized
# purposes.
skip_stdlib_files = [
@@ -30,3 +60,25 @@
"rustc_std_workspace_alloc",
"rustc_std_workspace_core",
"rustc_std_workspace_std",
+@@ -297,8 +280,6 @@ if (toolchain_has_rust) {
+ deps += [ "rules:$libname" ]
+ }
+ deps += rustc_sanitizer_runtimes
+-
+- public_deps = [ ":remap_alloc" ]
+ }
+ } else {
+ action("find_stdlib") {
+@@ -424,12 +405,6 @@ if (toolchain_has_rust) {
+ ":stdlib_public_dependent_libs",
+ ]
+ deps = [ ":prebuilt_rustc_copy_to_sysroot" ]
+-
+- # The host builds tools toolchain supports Rust only and does not use
+- # the allocator remapping to point it to PartitionAlloc.
+- if (!toolchain_for_rust_host_build_tools) {
+- deps += [ ":remap_alloc" ]
+- }
+ }
+ }
+ }
diff --git a/devel/electron33/files/patch-build_rust_allocator_BUILD.gn b/devel/electron33/files/patch-build_rust_allocator_BUILD.gn
new file mode 100644
index 000000000000..57f7b932a8ec
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_BUILD.gn
@@ -0,0 +1,106 @@
+--- build/rust/allocator/BUILD.gn.orig 2025-05-21 21:06:22 UTC
++++ build/rust/allocator/BUILD.gn
+@@ -0,0 +1,103 @@
++# Copyright 2025 The Chromium Authors
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/buildflag_header.gni")
++import("//build/config/rust.gni")
++import("//build/rust/rust_static_library.gni")
++
++rust_allocator_uses_partition_alloc = false
++if (build_with_chromium) {
++ import("//base/allocator/partition_allocator/partition_alloc.gni")
++ rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
++}
++
++# In ASAN builds, PartitionAlloc-Everywhere is disabled, meaning malloc() and
++# friends in C++ do not go to PartitionAlloc. So we also don't point the Rust
++# allocation functions at PartitionAlloc. Generally, this means we just direct
++# them to the Standard Library's allocator.
++#
++# However, on Windows the Standard Library uses HeapAlloc() and Windows ASAN
++# does *not* hook that method, so ASAN does not get to hear about allocations
++# made in Rust. To resolve this, we redirect allocation to _aligned_malloc
++# which Windows ASAN *does* hook.
++#
++# Note that there is a runtime option to make ASAN hook HeapAlloc() but
++# enabling it breaks Win32 APIs like CreateProcess:
++# https://crbug.com/368070343#comment29
++rust_allocator_uses_aligned_malloc = false
++if (!rust_allocator_uses_partition_alloc && is_win && is_asan) {
++ rust_allocator_uses_aligned_malloc = true
++}
++
++rust_allocator_uses_allocator_impls_h =
++ rust_allocator_uses_partition_alloc || rust_allocator_uses_aligned_malloc
++
++buildflag_header("buildflags") {
++ header = "buildflags.h"
++ flags = [
++ "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
++ "RUST_ALLOCATOR_USES_ALIGNED_MALLOC=$rust_allocator_uses_aligned_malloc",
++ ]
++ visibility = [ ":*" ]
++}
++
++if (toolchain_has_rust) {
++ # All targets which depend on Rust code but are not linked by rustc must
++ # depend on this. Usually, this dependency will come from the rust_target() GN
++ # template. However, cargo_crate() does *not* include this dependency so any
++ # C++ targets which directly depend on a cargo_crate() must depend on this.
++ rust_static_library("allocator") {
++ sources = [ "lib.rs" ]
++ crate_root = "lib.rs"
++ cxx_bindings = [ "lib.rs" ]
++
++ deps = [ ":alloc_error_handler_impl" ]
++ if (rust_allocator_uses_allocator_impls_h) {
++ deps += [ ":allocator_impls" ]
++ }
++
++ no_chromium_prelude = true
++ no_allocator_crate = true
++ allow_unsafe = true
++
++ rustflags = []
++ if (rust_allocator_uses_allocator_impls_h) {
++ rustflags += [ "--cfg=rust_allocator_uses_allocator_impls_h" ]
++ cxx_bindings += [ "allocator_impls_ffi.rs" ]
++ sources += [ "allocator_impls_ffi.rs" ]
++ }
++ }
++
++ if (rust_allocator_uses_allocator_impls_h) {
++ static_library("allocator_impls") {
++ public_deps = []
++ if (rust_allocator_uses_partition_alloc) {
++ public_deps +=
++ [ "//base/allocator/partition_allocator:partition_alloc" ]
++ }
++
++ sources = [
++ "allocator_impls.cc",
++ "allocator_impls.h",
++ ]
++ deps = [ ":buildflags" ]
++ visibility = [ ":*" ]
++ }
++ }
++
++ static_library("alloc_error_handler_impl") {
++ sources = [
++ # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
++ # copied from `//base`.
++ # TODO(crbug.com/40279749): Avoid duplication / reuse code.
++ "alias.cc",
++ "alias.h",
++ "alloc_error_handler_impl.cc",
++ "alloc_error_handler_impl.h",
++ "compiler_specific.h",
++ "immediate_crash.h",
++ ]
++ visibility = [ ":*" ]
++ }
++}
diff --git a/devel/electron33/files/patch-build_rust_allocator_DEPS b/devel/electron33/files/patch-build_rust_allocator_DEPS
new file mode 100644
index 000000000000..74bb2d6c2421
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_DEPS
@@ -0,0 +1,12 @@
+--- build/rust/allocator/DEPS.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/DEPS
+@@ -0,0 +1,9 @@
++include_rules = [
++ "-base",
++]
++
++specific_include_rules = {
++ "allocator_impls.cc" : [
++ "+partition_alloc"
++ ]
++}
diff --git a/devel/electron33/files/patch-build_rust_allocator_alias.cc b/devel/electron33/files/patch-build_rust_allocator_alias.cc
new file mode 100644
index 000000000000..5280641f27e1
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_alias.cc
@@ -0,0 +1,25 @@
+--- build/rust/allocator/alias.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.cc
+@@ -0,0 +1,22 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.cc ( additionally the APIs
++// were moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#include "build/rust/allocator/alias.h"
++
++#include "build/rust/allocator/compiler_specific.h"
++
++namespace build_rust_std {
++namespace debug {
++
++// This file/function should be excluded from LTO/LTCG to ensure that the
++// compiler can't see this function's implementation when compiling calls to it.
++NOINLINE void Alias(const void* var) {}
++
++} // namespace debug
++} // namespace build_rust_std
diff --git a/devel/electron33/files/patch-build_rust_allocator_alias.h b/devel/electron33/files/patch-build_rust_allocator_alias.h
new file mode 100644
index 000000000000..6530c6ae8779
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_alias.h
@@ -0,0 +1,40 @@
+--- build/rust/allocator/alias.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.h
+@@ -0,0 +1,37 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.h (and then trimmed to just
++// the APIs / macros needed by //build/rust/std; additionally the APIs were
++// moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALIAS_H_
++#define BUILD_RUST_ALLOCATOR_ALIAS_H_
++
++#include <stddef.h>
++
++namespace build_rust_std {
++namespace debug {
++
++// Make the optimizer think that |var| is aliased. This can be used to prevent a
++// local variable from being optimized out (which is something that
++// `NO_CODE_FOLDING` macro definition below depends on). See
++// //base/debug/alias.h for more details.
++void Alias(const void* var);
++
++} // namespace debug
++
++} // namespace build_rust_std
++
++// Prevent code folding (where a linker identifies functions that are
++// bit-identical and overlays them, which saves space but it leads to confusing
++// call stacks because multiple symbols are at the same address). See
++// //base/debug/alias.h for more details.
++#define NO_CODE_FOLDING() \
++ const int line_number = __LINE__; \
++ build_rust_std::debug::Alias(&line_number)
++
++#endif // BUILD_RUST_ALLOCATOR_ALIAS_H_
diff --git a/devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.cc b/devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
new file mode 100644
index 000000000000..048c267abefa
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
@@ -0,0 +1,20 @@
+--- build/rust/allocator/alloc_error_handler_impl.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.cc
+@@ -0,0 +1,17 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/alloc_error_handler_impl.h"
++
++#include "build/rust/allocator/alias.h"
++#include "build/rust/allocator/immediate_crash.h"
++
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl() {
++ NO_CODE_FOLDING();
++ IMMEDIATE_CRASH();
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.h b/devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.h
new file mode 100644
index 000000000000..887ea602b027
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_alloc__error__handler__impl.h
@@ -0,0 +1,24 @@
+--- build/rust/allocator/alloc_error_handler_impl.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.h
+@@ -0,0 +1,21 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++#define BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++
++// This header exposes to Rust a C++ implementation of quickly crashing after an
++// allocation error. (The API below is called from `__rust_alloc_error_handler`
++// in `lib.rs`.)
++//
++// TODO(lukasza): Investigate if we can delete this `.h` / `.cc` and just call
++// `std::process::abort()` (or something else?) directly from `.rs`. The main
++// open question is how much we care about `NO_CODE_FOLDING`.
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl();
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
diff --git a/devel/electron33/files/patch-build_rust_allocator_allocator__impls.cc b/devel/electron33/files/patch-build_rust_allocator_allocator__impls.cc
new file mode 100644
index 000000000000..94e04d7b966a
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_allocator__impls.cc
@@ -0,0 +1,108 @@
+--- build/rust/allocator/allocator_impls.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.cc
+@@ -0,0 +1,105 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/allocator_impls.h"
++
++#ifdef UNSAFE_BUFFERS_BUILD
++// TODO(crbug.com/390223051): Remove C-library calls to fix the errors.
++#pragma allow_unsafe_libc_calls
++#endif
++
++#include <cstddef>
++#include <cstring>
++
++#include "build/build_config.h"
++#include "build/rust/allocator/buildflags.h"
++
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++#include "partition_alloc/partition_alloc_constants.h" // nogncheck
++#include "partition_alloc/shim/allocator_shim.h" // nogncheck
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++#include <cstdlib>
++#endif
++
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // PartitionAlloc will crash if given an alignment larger than this.
++ if (align > partition_alloc::internal::kMaxSupportedAlignment) {
++ return nullptr;
++ }
++
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(allocator_shim::UncheckedAlloc(size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedAlloc(size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_malloc(size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++void dealloc(unsigned char* p, size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ if (align <= alignof(std::max_align_t)) {
++ allocator_shim::UncheckedFree(p);
++ } else {
++ allocator_shim::UncheckedAlignedFree(p);
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return _aligned_free(p);
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedRealloc(p, new_size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedRealloc(p, new_size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_realloc(p, new_size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* alloc_zeroed(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) || \
++ BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ // TODO(danakj): When RUST_ALLOCATOR_USES_PARTITION_ALLOC is true, it's
++ // possible that a partition_alloc::UncheckedAllocZeroed() call would perform
++ // better than partition_alloc::UncheckedAlloc() + memset. But there is no
++ // such API today. See b/342251590.
++ unsigned char* p = alloc(size, align);
++ if (p) {
++ memset(p, 0, size);
++ }
++ return p;
++#else
++#error This configuration is not supported.
++#endif
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron33/files/patch-build_rust_allocator_allocator__impls.h b/devel/electron33/files/patch-build_rust_allocator_allocator__impls.h
new file mode 100644
index 000000000000..9249cdc938d2
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_allocator__impls.h
@@ -0,0 +1,27 @@
+--- build/rust/allocator/allocator_impls.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.h
+@@ -0,0 +1,24 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++
++#include <cstddef>
++
++// This header exposes a C++ allocator (e.g. PartitionAlloc) to Rust.
++// The APIs below are called from `impl GlobalAlloc` in `lib.rs`.
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align);
++void dealloc(unsigned char* p, size_t size, size_t align);
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size);
++unsigned char* alloc_zeroed(size_t size, size_t align);
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
diff --git a/devel/electron33/files/patch-build_rust_allocator_allocator__impls__ffi.rs b/devel/electron33/files/patch-build_rust_allocator_allocator__impls__ffi.rs
new file mode 100644
index 000000000000..8f0baf1576ce
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_allocator__impls__ffi.rs
@@ -0,0 +1,22 @@
+--- build/rust/allocator/allocator_impls_ffi.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls_ffi.rs
+@@ -0,0 +1,19 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! FFI for `allocator_impls.h` is in a separate `.rs` file/module to
++//! better support conditional compilation (these functions are only
++//! used under `#[cfg(rust_allocator_uses_allocator_impls_h)]`.
++
++#[cxx::bridge(namespace = "rust_allocator_internal")]
++pub mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/allocator_impls.h");
++
++ unsafe fn alloc(size: usize, align: usize) -> *mut u8;
++ unsafe fn dealloc(p: *mut u8, size: usize, align: usize);
++ unsafe fn realloc(p: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
++ unsafe fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
++ }
++}
diff --git a/devel/electron33/files/patch-build_rust_allocator_compiler__specific.h b/devel/electron33/files/patch-build_rust_allocator_compiler__specific.h
new file mode 100644
index 000000000000..7feb0c739d79
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_compiler__specific.h
@@ -0,0 +1,41 @@
+--- build/rust/allocator/compiler_specific.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/compiler_specific.h
+@@ -0,0 +1,38 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/compiler_specific.h (and then
++// significantly trimmed to just the APIs / macros needed by //build/rust/std).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++#define BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++
++#include "build/build_config.h"
++
++#if defined(COMPILER_MSVC) && !defined(__clang__)
++#error "Only clang-cl is supported on Windows, see https://crbug.com/988071"
++#endif
++
++#if defined(__has_attribute)
++#define HAS_ATTRIBUTE(x) __has_attribute(x)
++#else
++#define HAS_ATTRIBUTE(x) 0
++#endif
++
++// Annotate a function indicating it should not be inlined.
++// Use like:
++// NOINLINE void DoStuff() { ... }
++#if defined(__clang__) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE [[clang::noinline]]
++#elif defined(COMPILER_GCC) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE __attribute__((noinline))
++#elif defined(COMPILER_MSVC)
++#define NOINLINE __declspec(noinline)
++#else
++#define NOINLINE
++#endif
++
++#endif // BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
diff --git a/devel/electron33/files/patch-build_rust_allocator_immediate__crash.h b/devel/electron33/files/patch-build_rust_allocator_immediate__crash.h
new file mode 100644
index 000000000000..7ab0f9d9c34c
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_immediate__crash.h
@@ -0,0 +1,174 @@
+--- build/rust/allocator/immediate_crash.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/immediate_crash.h
+@@ -0,0 +1,171 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/immediate_crash.h.
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++#define BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++
++#include "build/build_config.h"
++
++// Crashes in the fastest possible way with no attempt at logging.
++// There are several constraints; see http://crbug.com/664209 for more context.
++//
++// - TRAP_SEQUENCE_() must be fatal. It should not be possible to ignore the
++// resulting exception or simply hit 'continue' to skip over it in a debugger.
++// - Different instances of TRAP_SEQUENCE_() must not be folded together, to
++// ensure crash reports are debuggable. Unlike __builtin_trap(), asm volatile
++// blocks will not be folded together.
++// Note: TRAP_SEQUENCE_() previously required an instruction with a unique
++// nonce since unlike clang, GCC folds together identical asm volatile
++// blocks.
++// - TRAP_SEQUENCE_() must produce a signal that is distinct from an invalid
++// memory access.
++// - TRAP_SEQUENCE_() must be treated as a set of noreturn instructions.
++// __builtin_unreachable() is used to provide that hint here. clang also uses
++// this as a heuristic to pack the instructions in the function epilogue to
++// improve code density.
++//
++// Additional properties that are nice to have:
++// - TRAP_SEQUENCE_() should be as compact as possible.
++// - The first instruction of TRAP_SEQUENCE_() should not change, to avoid
++// shifting crash reporting clusters. As a consequence of this, explicit
++// assembly is preferred over intrinsics.
++// Note: this last bullet point may no longer be true, and may be removed in
++// the future.
++
++// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact
++// that clang emits an actual instruction for __builtin_unreachable() on certain
++// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will
++// be removed in followups, so splitting it up like this now makes it easy to
++// land the followups.
++
++#if defined(COMPILER_GCC)
++
++#if BUILDFLAG(IS_NACL)
++
++// Crash report accuracy is not guaranteed on NaCl.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#elif defined(ARCH_CPU_X86_FAMILY)
++
++// TODO(crbug.com/40625592): In theory, it should be possible to use just
++// int3. However, there are a number of crashes with SIGILL as the exception
++// code, so it seems likely that there's a signal handler that allows execution
++// to continue after SIGTRAP.
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++
++#if BUILDFLAG(IS_APPLE)
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
++#define TRAP_SEQUENCE2_() asm volatile("")
++#else
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++#endif // BUILDFLAG(IS_APPLE)
++
++#elif defined(ARCH_CPU_ARMEL)
++
++// bkpt will generate a SIGBUS when running on armv7 and a SIGTRAP when running
++// as a 32 bit userspace app on arm64. There doesn't seem to be any way to
++// cause a SIGTRAP from userspace without using a syscall (which would be a
++// problem for sandboxing).
++// TODO(crbug.com/40625592): Remove bkpt from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("bkpt #0")
++#define TRAP_SEQUENCE2_() asm volatile("udf #0")
++
++#elif defined(ARCH_CPU_ARM64)
++
++// This will always generate a SIGTRAP on arm64.
++// TODO(crbug.com/40625592): Remove brk from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("brk #0")
++#define TRAP_SEQUENCE2_() asm volatile("hlt #0")
++
++#else
++
++// Crash report accuracy will not be guaranteed on other architectures, but at
++// least this will crash as expected.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#endif // ARCH_CPU_*
++
++#elif defined(COMPILER_MSVC)
++
++#if !defined(__clang__)
++
++// MSVC x64 doesn't support inline asm, so use the MSVC intrinsic.
++#define TRAP_SEQUENCE1_() __debugbreak()
++#define TRAP_SEQUENCE2_()
++
++#elif defined(ARCH_CPU_ARM64)
++
++// Windows ARM64 uses "BRK #F000" as its breakpoint instruction, and
++// __debugbreak() generates that in both VC++ and clang.
++#define TRAP_SEQUENCE1_() __debugbreak()
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64,
++// https://crbug.com/958373
++#define TRAP_SEQUENCE2_() __asm volatile("")
++
++#else
++
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++
++#endif // __clang__
++
++#else
++
++#error No supported trap sequence!
++
++#endif // COMPILER_GCC
++
++#define TRAP_SEQUENCE_() \
++ do { \
++ TRAP_SEQUENCE1_(); \
++ TRAP_SEQUENCE2_(); \
++ } while (false)
++
++// CHECK() and the trap sequence can be invoked from a constexpr function.
++// This could make compilation fail on GCC, as it forbids directly using inline
++// asm inside a constexpr function. However, it allows calling a lambda
++// expression including the same asm.
++// The side effect is that the top of the stacktrace will not point to the
++// calling function, but to this anonymous lambda. This is still useful as the
++// full name of the lambda will typically include the name of the function that
++// calls CHECK() and the debugger will still break at the right line of code.
++#if !defined(COMPILER_GCC) || defined(__clang__)
++
++#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_()
++
++#else
++
++#define WRAPPED_TRAP_SEQUENCE_() \
++ do { \
++ [] { TRAP_SEQUENCE_(); }(); \
++ } while (false)
++
++#endif // !defined(COMPILER_GCC) || defined(__clang__)
++
++#if defined(__clang__) || defined(COMPILER_GCC)
++
++// __builtin_unreachable() hints to the compiler that this is noreturn and can
++// be packed in the function epilogue.
++#define IMMEDIATE_CRASH() \
++ ({ \
++ WRAPPED_TRAP_SEQUENCE_(); \
++ __builtin_unreachable(); \
++ })
++
++#else
++
++// This is supporting non-chromium user of logging.h to build with MSVC, like
++// pdfium. On MSVC there is no __builtin_unreachable().
++#define IMMEDIATE_CRASH() WRAPPED_TRAP_SEQUENCE_()
++
++#endif // defined(__clang__) || defined(COMPILER_GCC)
++
++#endif // BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
diff --git a/devel/electron33/files/patch-build_rust_allocator_lib.rs b/devel/electron33/files/patch-build_rust_allocator_lib.rs
new file mode 100644
index 000000000000..89fddf278294
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_allocator_lib.rs
@@ -0,0 +1,122 @@
+--- build/rust/allocator/lib.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/lib.rs
+@@ -0,0 +1,119 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! Define the allocator that Rust code in Chrome should use.
++//!
++//! Any final artifact that depends on this crate, even transitively, will use
++//! the allocator defined here.
++//!
++//! List of known issues:
++//!
++//! 1. We'd like to use PartitionAlloc on Windows, but the stdlib uses Windows
++//! heap functions directly that PartitionAlloc can not intercept.
++//! 2. We'd like `Vec::try_reserve` to fail at runtime on Linux instead of
++//! crashing in malloc() where PartitionAlloc replaces that function.
++
++// Required to apply weak linkage to symbols.
++//
++// TODO(https://crbug.com/410596442): Stop using unstable features here.
++// https://github.com/rust-lang/rust/issues/29603 tracks stabilization of the `linkage` feature.
++#![feature(linkage)]
++// Required to apply `#[rustc_std_internal_symbol]` to our alloc error handler
++// so the name is correctly mangled as rustc expects.
++//
++// TODO(https://crbug.com/410596442): Stop using internal features here.
++#![allow(internal_features)]
++#![feature(rustc_attrs)]
++
++// This module is in a separate source file to avoid having to teach `cxxbridge`
++// about conditional compilation.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod allocator_impls_ffi;
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using an allocator from C++.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod cpp_allocator {
++ use super::allocator_impls_ffi::ffi;
++ use std::alloc::{GlobalAlloc, Layout};
++
++ struct Allocator;
++
++ unsafe impl GlobalAlloc for Allocator {
++ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc(layout.size(), layout.align()) }
++ }
++
++ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
++ unsafe {
++ ffi::dealloc(ptr, layout.size(), layout.align());
++ }
++ }
++
++ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc_zeroed(layout.size(), layout.align()) }
++ }
++
++ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
++ unsafe { ffi::realloc(ptr, layout.size(), layout.align(), new_size) }
++ }
++ }
++
++ #[global_allocator]
++ static GLOBAL: Allocator = Allocator;
++}
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using the default Rust allocator.
++#[cfg(not(rust_allocator_uses_allocator_impls_h))]
++mod rust_allocator {
++ #[global_allocator]
++ static GLOBAL: std::alloc::System = std::alloc::System;
++}
++
++/// Module that provides global symbols that are needed both by `cpp_allocator`
++/// and `rust_allocator`.
++///
++/// When `rustc` drives linking, then it will define the symbols below. But
++/// Chromium only uses `rustc` to link Rust-only executables (e.g. `build.rs`
++/// scripts) and otherwise uses a non-Rust linker. This is why we have to
++/// manually define a few symbols below. We define those symbols
++/// as "weak" symbols, so that Rust-provided symbols "win" in case where Rust
++/// actually does drive the linking. This hack works (not only for Chromium,
++/// but also for google3 and other projects), but isn't officially supported by
++/// `rustc`.
++///
++/// TODO(https://crbug.com/410596442): Stop using internal features here.
++mod both_allocators {
++ /// As part of rustc's contract for using `#[global_allocator]` without
++ /// rustc-generated shims we must define this symbol, since we are opting in
++ /// to unstable functionality. See https://github.com/rust-lang/rust/issues/123015
++ #[no_mangle]
++ #[linkage = "weak"]
++ static __rust_no_alloc_shim_is_unstable: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ static __rust_alloc_error_handler_should_panic: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ fn __rust_alloc_error_handler(_size: usize, _align: usize) {
++ // TODO(lukasza): Investigate if we can just call `std::process::abort()` here.
++ // (Not really _needed_, but it could simplify code a little bit.)
++ unsafe { ffi::alloc_error_handler_impl() }
++ }
++
++ #[cxx::bridge(namespace = "rust_allocator_internal")]
++ mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/alloc_error_handler_impl.h");
++ unsafe fn alloc_error_handler_impl();
++ }
++ }
++}
diff --git a/devel/electron33/files/patch-build_rust_cargo__crate.gni b/devel/electron33/files/patch-build_rust_cargo__crate.gni
new file mode 100644
index 000000000000..8b1ce9670eb6
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_cargo__crate.gni
@@ -0,0 +1,25 @@
+--- build/rust/cargo_crate.gni.orig 2025-01-06 14:31:29 UTC
++++ build/rust/cargo_crate.gni
+@@ -273,6 +273,12 @@ template("cargo_crate") {
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
+
++ # Don't depend on the chrome-specific #[global_allocator] crate from
++ # third-party code. This avoids some dependency cycle issues. The allocator
++ # crate will still be used if it exists anywhere in the dependency graph for
++ # a given linked artifact.
++ no_allocator_crate = true
++
+ rustc_metadata = _rustc_metadata
+
+ # TODO(crbug.com/40259764): don't default to true. This requires changes to
+@@ -484,6 +490,9 @@ template("cargo_crate") {
+
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
++
++ # Build scripts do not need to link to chrome's allocator.
++ no_allocator_crate = true
+
+ # The ${_build_script_name}_output target looks for the exe in this
+ # location. Due to how the Windows component build works, this has to
diff --git a/devel/electron33/files/patch-build_rust_rust__macro.gni b/devel/electron33/files/patch-build_rust_rust__macro.gni
new file mode 100644
index 000000000000..0dafc3819aa1
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_rust__macro.gni
@@ -0,0 +1,12 @@
+--- build/rust/rust_macro.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_macro.gni
+@@ -16,6 +16,9 @@ template("rust_macro") {
+ forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+ proc_macro_configs = invoker.configs
+ target_type = "rust_proc_macro"
++
++ # Macros are loaded by rustc and shouldn't use chrome's allocation routines.
++ no_allocator_crate = true
+ }
+ }
+
diff --git a/devel/electron33/files/patch-build_rust_rust__target.gni b/devel/electron33/files/patch-build_rust_rust__target.gni
new file mode 100644
index 000000000000..358746e85b33
--- /dev/null
+++ b/devel/electron33/files/patch-build_rust_rust__target.gni
@@ -0,0 +1,13 @@
+--- build/rust/rust_target.gni.orig 2025-01-06 14:31:29 UTC
++++ build/rust/rust_target.gni
+@@ -307,6 +307,10 @@ template("rust_target") {
+ _rust_deps += [ "//build/rust/std" ]
+ }
+
++ if (!defined(invoker.no_allocator_crate) || !invoker.no_allocator_crate) {
++ _rust_deps += [ "//build/rust/allocator" ]
++ }
++
+ if (_build_unit_tests) {
+ _unit_test_target = "${_target_name}_unittests"
+ if (defined(invoker.unit_test_target)) {
diff --git a/devel/electron33/files/patch-build_rust_std_BUILD.gn b/devel/electron33/files/patch-build_rust_std_BUILD.gn
index d8594d0f399a..9b828f8c5b9c 100644
--- a/devel/electron33/files/patch-build_rust_std_BUILD.gn
+++ b/devel/electron33/files/patch-build_rust_std_BUILD.gn
@@ -1,6 +1,36 @@
--- build/rust/std/BUILD.gn.orig 2025-01-06 14:31:29 UTC
+++ build/rust/std/BUILD.gn
-@@ -74,13 +74,20 @@ if (toolchain_has_rust) {
+@@ -22,29 +22,6 @@ if (toolchain_has_rust) {
+ import("//build/config/sanitizers/sanitizers.gni")
+
+ if (toolchain_has_rust) {
+- # If clang performs the link step, we need to provide the allocator symbols
+- # that are normally injected by rustc during linking.
+- #
+- # We also "happen to" use this to redirect allocations to PartitionAlloc,
+- # though that would be better done through a #[global_allocator] crate (see
+- # above).
+- source_set("remap_alloc") {
+- public_deps = [ "//base/allocator/partition_allocator:buildflags" ]
+- if (use_partition_alloc_as_malloc) {
+- public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
+- }
+- sources = [
+- # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
+- # copied from `//base`.
+- # TODO(crbug.com/40279749): Avoid duplication / reuse code.
+- "alias.cc",
+- "alias.h",
+- "compiler_specific.h",
+- "immediate_crash.h",
+- "remap_alloc.cc",
+- ]
+- }
+-
+ # List of Rust stdlib rlibs which are present in the official Rust toolchain
+ # we are using from the Android team. This is usually a version or two behind
+ # nightly. Generally this matches the toolchain we build ourselves, but if
+@@ -74,13 +51,20 @@ if (toolchain_has_rust) {
# These are no longer present in the Windows toolchain.
stdlib_files += [
"addr2line",
@@ -22,7 +52,7 @@
}
if (toolchain_for_rust_host_build_tools) {
-@@ -100,7 +107,6 @@ if (toolchain_has_rust) {
+@@ -100,7 +84,6 @@ if (toolchain_has_rust) {
# don't need to pass to the C++ linker because they're used for specialized
# purposes.
skip_stdlib_files = [
@@ -30,3 +60,25 @@
"rustc_std_workspace_alloc",
"rustc_std_workspace_core",
"rustc_std_workspace_std",
+@@ -297,8 +280,6 @@ if (toolchain_has_rust) {
+ deps += [ "rules:$libname" ]
+ }
+ deps += rustc_sanitizer_runtimes
+-
+- public_deps = [ ":remap_alloc" ]
+ }
+ } else {
+ action("find_stdlib") {
+@@ -424,12 +405,6 @@ if (toolchain_has_rust) {
+ ":stdlib_public_dependent_libs",
+ ]
+ deps = [ ":prebuilt_rustc_copy_to_sysroot" ]
+-
+- # The host builds tools toolchain supports Rust only and does not use
+- # the allocator remapping to point it to PartitionAlloc.
+- if (!toolchain_for_rust_host_build_tools) {
+- deps += [ ":remap_alloc" ]
+- }
+ }
+ }
+ }
diff --git a/devel/electron34/files/patch-build_rust_allocator_BUILD.gn b/devel/electron34/files/patch-build_rust_allocator_BUILD.gn
new file mode 100644
index 000000000000..cb1633140dcc
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_BUILD.gn
@@ -0,0 +1,109 @@
+--- build/rust/allocator/BUILD.gn.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/BUILD.gn
+@@ -0,0 +1,106 @@
++# Copyright 2025 The Chromium Authors
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/buildflag_header.gni")
++import("//build/config/rust.gni")
++import("//build/rust/rust_static_library.gni")
++
++rust_allocator_uses_partition_alloc = false
++if (build_with_chromium) {
++ import("//base/allocator/partition_allocator/partition_alloc.gni")
++ rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
++}
++
++# In ASAN builds, PartitionAlloc-Everywhere is disabled, meaning malloc() and
++# friends in C++ do not go to PartitionAlloc. So we also don't point the Rust
++# allocation functions at PartitionAlloc. Generally, this means we just direct
++# them to the Standard Library's allocator.
++#
++# However, on Windows the Standard Library uses HeapAlloc() and Windows ASAN
++# does *not* hook that method, so ASAN does not get to hear about allocations
++# made in Rust. To resolve this, we redirect allocation to _aligned_malloc
++# which Windows ASAN *does* hook.
++#
++# Note that there is a runtime option to make ASAN hook HeapAlloc() but
++# enabling it breaks Win32 APIs like CreateProcess:
++# https://crbug.com/368070343#comment29
++rust_allocator_uses_aligned_malloc = false
++if (!rust_allocator_uses_partition_alloc && is_win && is_asan) {
++ rust_allocator_uses_aligned_malloc = true
++}
++
++rust_allocator_uses_allocator_impls_h =
++ rust_allocator_uses_partition_alloc || rust_allocator_uses_aligned_malloc
++
++buildflag_header("buildflags") {
++ header = "buildflags.h"
++ flags = [
++ "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
++ "RUST_ALLOCATOR_USES_ALIGNED_MALLOC=$rust_allocator_uses_aligned_malloc",
++ ]
++ visibility = [ ":*" ]
++}
++
++if (toolchain_has_rust) {
++ # All targets which depend on Rust code but are not linked by rustc must
++ # depend on this. Usually, this dependency will come from the rust_target() GN
++ # template. However, cargo_crate() does *not* include this dependency so any
++ # C++ targets which directly depend on a cargo_crate() must depend on this.
++ rust_static_library("allocator") {
++ sources = [ "lib.rs" ]
++ crate_root = "lib.rs"
++ cxx_bindings = [ "lib.rs" ]
++
++ deps = [ ":alloc_error_handler_impl" ]
++ if (rust_allocator_uses_allocator_impls_h) {
++ deps += [ ":allocator_impls" ]
++ }
++
++ no_chromium_prelude = true
++ no_allocator_crate = true
++ allow_unsafe = true
++
++ rustflags = []
++ if (rust_allocator_uses_allocator_impls_h) {
++ rustflags += [ "--cfg=rust_allocator_uses_allocator_impls_h" ]
++ cxx_bindings += [ "allocator_impls_ffi.rs" ]
++ sources += [ "allocator_impls_ffi.rs" ]
++ }
++
++ # TODO(https://crbug.com/410596442): Stop using unstable features here.
++ configs -= [ "//build/config/compiler:disallow_unstable_features" ]
++ }
++
++ if (rust_allocator_uses_allocator_impls_h) {
++ static_library("allocator_impls") {
++ public_deps = []
++ if (rust_allocator_uses_partition_alloc) {
++ public_deps +=
++ [ "//base/allocator/partition_allocator:partition_alloc" ]
++ }
++
++ sources = [
++ "allocator_impls.cc",
++ "allocator_impls.h",
++ ]
++ deps = [ ":buildflags" ]
++ visibility = [ ":*" ]
++ }
++ }
++
++ static_library("alloc_error_handler_impl") {
++ sources = [
++ # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
++ # copied from `//base`.
++ # TODO(crbug.com/40279749): Avoid duplication / reuse code.
++ "alias.cc",
++ "alias.h",
++ "alloc_error_handler_impl.cc",
++ "alloc_error_handler_impl.h",
++ "compiler_specific.h",
++ "immediate_crash.h",
++ ]
++ visibility = [ ":*" ]
++ }
++}
diff --git a/devel/electron34/files/patch-build_rust_allocator_DEPS b/devel/electron34/files/patch-build_rust_allocator_DEPS
new file mode 100644
index 000000000000..74bb2d6c2421
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_DEPS
@@ -0,0 +1,12 @@
+--- build/rust/allocator/DEPS.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/DEPS
+@@ -0,0 +1,9 @@
++include_rules = [
++ "-base",
++]
++
++specific_include_rules = {
++ "allocator_impls.cc" : [
++ "+partition_alloc"
++ ]
++}
diff --git a/devel/electron34/files/patch-build_rust_allocator_alias.cc b/devel/electron34/files/patch-build_rust_allocator_alias.cc
new file mode 100644
index 000000000000..5280641f27e1
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_alias.cc
@@ -0,0 +1,25 @@
+--- build/rust/allocator/alias.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.cc
+@@ -0,0 +1,22 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.cc ( additionally the APIs
++// were moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#include "build/rust/allocator/alias.h"
++
++#include "build/rust/allocator/compiler_specific.h"
++
++namespace build_rust_std {
++namespace debug {
++
++// This file/function should be excluded from LTO/LTCG to ensure that the
++// compiler can't see this function's implementation when compiling calls to it.
++NOINLINE void Alias(const void* var) {}
++
++} // namespace debug
++} // namespace build_rust_std
diff --git a/devel/electron34/files/patch-build_rust_allocator_alias.h b/devel/electron34/files/patch-build_rust_allocator_alias.h
new file mode 100644
index 000000000000..6530c6ae8779
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_alias.h
@@ -0,0 +1,40 @@
+--- build/rust/allocator/alias.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.h
+@@ -0,0 +1,37 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.h (and then trimmed to just
++// the APIs / macros needed by //build/rust/std; additionally the APIs were
++// moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALIAS_H_
++#define BUILD_RUST_ALLOCATOR_ALIAS_H_
++
++#include <stddef.h>
++
++namespace build_rust_std {
++namespace debug {
++
++// Make the optimizer think that |var| is aliased. This can be used to prevent a
++// local variable from being optimized out (which is something that
++// `NO_CODE_FOLDING` macro definition below depends on). See
++// //base/debug/alias.h for more details.
++void Alias(const void* var);
++
++} // namespace debug
++
++} // namespace build_rust_std
++
++// Prevent code folding (where a linker identifies functions that are
++// bit-identical and overlays them, which saves space but it leads to confusing
++// call stacks because multiple symbols are at the same address). See
++// //base/debug/alias.h for more details.
++#define NO_CODE_FOLDING() \
++ const int line_number = __LINE__; \
++ build_rust_std::debug::Alias(&line_number)
++
++#endif // BUILD_RUST_ALLOCATOR_ALIAS_H_
diff --git a/devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.cc b/devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
new file mode 100644
index 000000000000..048c267abefa
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
@@ -0,0 +1,20 @@
+--- build/rust/allocator/alloc_error_handler_impl.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.cc
+@@ -0,0 +1,17 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/alloc_error_handler_impl.h"
++
++#include "build/rust/allocator/alias.h"
++#include "build/rust/allocator/immediate_crash.h"
++
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl() {
++ NO_CODE_FOLDING();
++ IMMEDIATE_CRASH();
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.h b/devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.h
new file mode 100644
index 000000000000..887ea602b027
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_alloc__error__handler__impl.h
@@ -0,0 +1,24 @@
+--- build/rust/allocator/alloc_error_handler_impl.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.h
+@@ -0,0 +1,21 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++#define BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++
++// This header exposes to Rust a C++ implementation of quickly crashing after an
++// allocation error. (The API below is called from `__rust_alloc_error_handler`
++// in `lib.rs`.)
++//
++// TODO(lukasza): Investigate if we can delete this `.h` / `.cc` and just call
++// `std::process::abort()` (or something else?) directly from `.rs`. The main
++// open question is how much we care about `NO_CODE_FOLDING`.
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl();
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
diff --git a/devel/electron34/files/patch-build_rust_allocator_allocator__impls.cc b/devel/electron34/files/patch-build_rust_allocator_allocator__impls.cc
new file mode 100644
index 000000000000..94e04d7b966a
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_allocator__impls.cc
@@ -0,0 +1,108 @@
+--- build/rust/allocator/allocator_impls.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.cc
+@@ -0,0 +1,105 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/allocator_impls.h"
++
++#ifdef UNSAFE_BUFFERS_BUILD
++// TODO(crbug.com/390223051): Remove C-library calls to fix the errors.
++#pragma allow_unsafe_libc_calls
++#endif
++
++#include <cstddef>
++#include <cstring>
++
++#include "build/build_config.h"
++#include "build/rust/allocator/buildflags.h"
++
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++#include "partition_alloc/partition_alloc_constants.h" // nogncheck
++#include "partition_alloc/shim/allocator_shim.h" // nogncheck
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++#include <cstdlib>
++#endif
++
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // PartitionAlloc will crash if given an alignment larger than this.
++ if (align > partition_alloc::internal::kMaxSupportedAlignment) {
++ return nullptr;
++ }
++
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(allocator_shim::UncheckedAlloc(size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedAlloc(size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_malloc(size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++void dealloc(unsigned char* p, size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ if (align <= alignof(std::max_align_t)) {
++ allocator_shim::UncheckedFree(p);
++ } else {
++ allocator_shim::UncheckedAlignedFree(p);
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return _aligned_free(p);
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedRealloc(p, new_size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedRealloc(p, new_size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_realloc(p, new_size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* alloc_zeroed(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) || \
++ BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ // TODO(danakj): When RUST_ALLOCATOR_USES_PARTITION_ALLOC is true, it's
++ // possible that a partition_alloc::UncheckedAllocZeroed() call would perform
++ // better than partition_alloc::UncheckedAlloc() + memset. But there is no
++ // such API today. See b/342251590.
++ unsigned char* p = alloc(size, align);
++ if (p) {
++ memset(p, 0, size);
++ }
++ return p;
++#else
++#error This configuration is not supported.
++#endif
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron34/files/patch-build_rust_allocator_allocator__impls.h b/devel/electron34/files/patch-build_rust_allocator_allocator__impls.h
new file mode 100644
index 000000000000..9249cdc938d2
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_allocator__impls.h
@@ -0,0 +1,27 @@
+--- build/rust/allocator/allocator_impls.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.h
+@@ -0,0 +1,24 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++
++#include <cstddef>
++
++// This header exposes a C++ allocator (e.g. PartitionAlloc) to Rust.
++// The APIs below are called from `impl GlobalAlloc` in `lib.rs`.
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align);
++void dealloc(unsigned char* p, size_t size, size_t align);
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size);
++unsigned char* alloc_zeroed(size_t size, size_t align);
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
diff --git a/devel/electron34/files/patch-build_rust_allocator_allocator__impls__ffi.rs b/devel/electron34/files/patch-build_rust_allocator_allocator__impls__ffi.rs
new file mode 100644
index 000000000000..8f0baf1576ce
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_allocator__impls__ffi.rs
@@ -0,0 +1,22 @@
+--- build/rust/allocator/allocator_impls_ffi.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls_ffi.rs
+@@ -0,0 +1,19 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! FFI for `allocator_impls.h` is in a separate `.rs` file/module to
++//! better support conditional compilation (these functions are only
++//! used under `#[cfg(rust_allocator_uses_allocator_impls_h)]`.
++
++#[cxx::bridge(namespace = "rust_allocator_internal")]
++pub mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/allocator_impls.h");
++
++ unsafe fn alloc(size: usize, align: usize) -> *mut u8;
++ unsafe fn dealloc(p: *mut u8, size: usize, align: usize);
++ unsafe fn realloc(p: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
++ unsafe fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
++ }
++}
diff --git a/devel/electron34/files/patch-build_rust_allocator_compiler__specific.h b/devel/electron34/files/patch-build_rust_allocator_compiler__specific.h
new file mode 100644
index 000000000000..7feb0c739d79
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_compiler__specific.h
@@ -0,0 +1,41 @@
+--- build/rust/allocator/compiler_specific.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/compiler_specific.h
+@@ -0,0 +1,38 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/compiler_specific.h (and then
++// significantly trimmed to just the APIs / macros needed by //build/rust/std).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++#define BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++
++#include "build/build_config.h"
++
++#if defined(COMPILER_MSVC) && !defined(__clang__)
++#error "Only clang-cl is supported on Windows, see https://crbug.com/988071"
++#endif
++
++#if defined(__has_attribute)
++#define HAS_ATTRIBUTE(x) __has_attribute(x)
++#else
++#define HAS_ATTRIBUTE(x) 0
++#endif
++
++// Annotate a function indicating it should not be inlined.
++// Use like:
++// NOINLINE void DoStuff() { ... }
++#if defined(__clang__) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE [[clang::noinline]]
++#elif defined(COMPILER_GCC) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE __attribute__((noinline))
++#elif defined(COMPILER_MSVC)
++#define NOINLINE __declspec(noinline)
++#else
++#define NOINLINE
++#endif
++
++#endif // BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
diff --git a/devel/electron34/files/patch-build_rust_allocator_immediate__crash.h b/devel/electron34/files/patch-build_rust_allocator_immediate__crash.h
new file mode 100644
index 000000000000..7ab0f9d9c34c
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_immediate__crash.h
@@ -0,0 +1,174 @@
+--- build/rust/allocator/immediate_crash.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/immediate_crash.h
+@@ -0,0 +1,171 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/immediate_crash.h.
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++#define BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++
++#include "build/build_config.h"
++
++// Crashes in the fastest possible way with no attempt at logging.
++// There are several constraints; see http://crbug.com/664209 for more context.
++//
++// - TRAP_SEQUENCE_() must be fatal. It should not be possible to ignore the
++// resulting exception or simply hit 'continue' to skip over it in a debugger.
++// - Different instances of TRAP_SEQUENCE_() must not be folded together, to
++// ensure crash reports are debuggable. Unlike __builtin_trap(), asm volatile
++// blocks will not be folded together.
++// Note: TRAP_SEQUENCE_() previously required an instruction with a unique
++// nonce since unlike clang, GCC folds together identical asm volatile
++// blocks.
++// - TRAP_SEQUENCE_() must produce a signal that is distinct from an invalid
++// memory access.
++// - TRAP_SEQUENCE_() must be treated as a set of noreturn instructions.
++// __builtin_unreachable() is used to provide that hint here. clang also uses
++// this as a heuristic to pack the instructions in the function epilogue to
++// improve code density.
++//
++// Additional properties that are nice to have:
++// - TRAP_SEQUENCE_() should be as compact as possible.
++// - The first instruction of TRAP_SEQUENCE_() should not change, to avoid
++// shifting crash reporting clusters. As a consequence of this, explicit
++// assembly is preferred over intrinsics.
++// Note: this last bullet point may no longer be true, and may be removed in
++// the future.
++
++// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact
++// that clang emits an actual instruction for __builtin_unreachable() on certain
++// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will
++// be removed in followups, so splitting it up like this now makes it easy to
++// land the followups.
++
++#if defined(COMPILER_GCC)
++
++#if BUILDFLAG(IS_NACL)
++
++// Crash report accuracy is not guaranteed on NaCl.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#elif defined(ARCH_CPU_X86_FAMILY)
++
++// TODO(crbug.com/40625592): In theory, it should be possible to use just
++// int3. However, there are a number of crashes with SIGILL as the exception
++// code, so it seems likely that there's a signal handler that allows execution
++// to continue after SIGTRAP.
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++
++#if BUILDFLAG(IS_APPLE)
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
++#define TRAP_SEQUENCE2_() asm volatile("")
++#else
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++#endif // BUILDFLAG(IS_APPLE)
++
++#elif defined(ARCH_CPU_ARMEL)
++
++// bkpt will generate a SIGBUS when running on armv7 and a SIGTRAP when running
++// as a 32 bit userspace app on arm64. There doesn't seem to be any way to
++// cause a SIGTRAP from userspace without using a syscall (which would be a
++// problem for sandboxing).
++// TODO(crbug.com/40625592): Remove bkpt from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("bkpt #0")
++#define TRAP_SEQUENCE2_() asm volatile("udf #0")
++
++#elif defined(ARCH_CPU_ARM64)
++
++// This will always generate a SIGTRAP on arm64.
++// TODO(crbug.com/40625592): Remove brk from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("brk #0")
++#define TRAP_SEQUENCE2_() asm volatile("hlt #0")
++
++#else
++
++// Crash report accuracy will not be guaranteed on other architectures, but at
++// least this will crash as expected.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#endif // ARCH_CPU_*
++
++#elif defined(COMPILER_MSVC)
++
++#if !defined(__clang__)
++
++// MSVC x64 doesn't support inline asm, so use the MSVC intrinsic.
++#define TRAP_SEQUENCE1_() __debugbreak()
++#define TRAP_SEQUENCE2_()
++
++#elif defined(ARCH_CPU_ARM64)
++
++// Windows ARM64 uses "BRK #F000" as its breakpoint instruction, and
++// __debugbreak() generates that in both VC++ and clang.
++#define TRAP_SEQUENCE1_() __debugbreak()
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64,
++// https://crbug.com/958373
++#define TRAP_SEQUENCE2_() __asm volatile("")
++
++#else
++
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++
++#endif // __clang__
++
++#else
++
++#error No supported trap sequence!
++
++#endif // COMPILER_GCC
++
++#define TRAP_SEQUENCE_() \
++ do { \
++ TRAP_SEQUENCE1_(); \
++ TRAP_SEQUENCE2_(); \
++ } while (false)
++
++// CHECK() and the trap sequence can be invoked from a constexpr function.
++// This could make compilation fail on GCC, as it forbids directly using inline
++// asm inside a constexpr function. However, it allows calling a lambda
++// expression including the same asm.
++// The side effect is that the top of the stacktrace will not point to the
++// calling function, but to this anonymous lambda. This is still useful as the
++// full name of the lambda will typically include the name of the function that
++// calls CHECK() and the debugger will still break at the right line of code.
++#if !defined(COMPILER_GCC) || defined(__clang__)
++
++#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_()
++
++#else
++
++#define WRAPPED_TRAP_SEQUENCE_() \
++ do { \
++ [] { TRAP_SEQUENCE_(); }(); \
++ } while (false)
++
++#endif // !defined(COMPILER_GCC) || defined(__clang__)
++
++#if defined(__clang__) || defined(COMPILER_GCC)
++
++// __builtin_unreachable() hints to the compiler that this is noreturn and can
++// be packed in the function epilogue.
++#define IMMEDIATE_CRASH() \
++ ({ \
++ WRAPPED_TRAP_SEQUENCE_(); \
++ __builtin_unreachable(); \
++ })
++
++#else
++
++// This is supporting non-chromium user of logging.h to build with MSVC, like
++// pdfium. On MSVC there is no __builtin_unreachable().
++#define IMMEDIATE_CRASH() WRAPPED_TRAP_SEQUENCE_()
++
++#endif // defined(__clang__) || defined(COMPILER_GCC)
++
++#endif // BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
diff --git a/devel/electron34/files/patch-build_rust_allocator_lib.rs b/devel/electron34/files/patch-build_rust_allocator_lib.rs
new file mode 100644
index 000000000000..89fddf278294
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_allocator_lib.rs
@@ -0,0 +1,122 @@
+--- build/rust/allocator/lib.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/lib.rs
+@@ -0,0 +1,119 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! Define the allocator that Rust code in Chrome should use.
++//!
++//! Any final artifact that depends on this crate, even transitively, will use
++//! the allocator defined here.
++//!
++//! List of known issues:
++//!
++//! 1. We'd like to use PartitionAlloc on Windows, but the stdlib uses Windows
++//! heap functions directly that PartitionAlloc can not intercept.
++//! 2. We'd like `Vec::try_reserve` to fail at runtime on Linux instead of
++//! crashing in malloc() where PartitionAlloc replaces that function.
++
++// Required to apply weak linkage to symbols.
++//
++// TODO(https://crbug.com/410596442): Stop using unstable features here.
++// https://github.com/rust-lang/rust/issues/29603 tracks stabilization of the `linkage` feature.
++#![feature(linkage)]
++// Required to apply `#[rustc_std_internal_symbol]` to our alloc error handler
++// so the name is correctly mangled as rustc expects.
++//
++// TODO(https://crbug.com/410596442): Stop using internal features here.
++#![allow(internal_features)]
++#![feature(rustc_attrs)]
++
++// This module is in a separate source file to avoid having to teach `cxxbridge`
++// about conditional compilation.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod allocator_impls_ffi;
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using an allocator from C++.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod cpp_allocator {
++ use super::allocator_impls_ffi::ffi;
++ use std::alloc::{GlobalAlloc, Layout};
++
++ struct Allocator;
++
++ unsafe impl GlobalAlloc for Allocator {
++ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc(layout.size(), layout.align()) }
++ }
++
++ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
++ unsafe {
++ ffi::dealloc(ptr, layout.size(), layout.align());
++ }
++ }
++
++ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc_zeroed(layout.size(), layout.align()) }
++ }
++
++ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
++ unsafe { ffi::realloc(ptr, layout.size(), layout.align(), new_size) }
++ }
++ }
++
++ #[global_allocator]
++ static GLOBAL: Allocator = Allocator;
++}
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using the default Rust allocator.
++#[cfg(not(rust_allocator_uses_allocator_impls_h))]
++mod rust_allocator {
++ #[global_allocator]
++ static GLOBAL: std::alloc::System = std::alloc::System;
++}
++
++/// Module that provides global symbols that are needed both by `cpp_allocator`
++/// and `rust_allocator`.
++///
++/// When `rustc` drives linking, then it will define the symbols below. But
++/// Chromium only uses `rustc` to link Rust-only executables (e.g. `build.rs`
++/// scripts) and otherwise uses a non-Rust linker. This is why we have to
++/// manually define a few symbols below. We define those symbols
++/// as "weak" symbols, so that Rust-provided symbols "win" in case where Rust
++/// actually does drive the linking. This hack works (not only for Chromium,
++/// but also for google3 and other projects), but isn't officially supported by
++/// `rustc`.
++///
++/// TODO(https://crbug.com/410596442): Stop using internal features here.
++mod both_allocators {
++ /// As part of rustc's contract for using `#[global_allocator]` without
++ /// rustc-generated shims we must define this symbol, since we are opting in
++ /// to unstable functionality. See https://github.com/rust-lang/rust/issues/123015
++ #[no_mangle]
++ #[linkage = "weak"]
++ static __rust_no_alloc_shim_is_unstable: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ static __rust_alloc_error_handler_should_panic: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ fn __rust_alloc_error_handler(_size: usize, _align: usize) {
++ // TODO(lukasza): Investigate if we can just call `std::process::abort()` here.
++ // (Not really _needed_, but it could simplify code a little bit.)
++ unsafe { ffi::alloc_error_handler_impl() }
++ }
++
++ #[cxx::bridge(namespace = "rust_allocator_internal")]
++ mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/alloc_error_handler_impl.h");
++ unsafe fn alloc_error_handler_impl();
++ }
++ }
++}
diff --git a/devel/electron34/files/patch-build_rust_cargo__crate.gni b/devel/electron34/files/patch-build_rust_cargo__crate.gni
new file mode 100644
index 000000000000..14f1a6b4022e
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_cargo__crate.gni
@@ -0,0 +1,25 @@
+--- build/rust/cargo_crate.gni.orig 2025-02-24 19:59:26 UTC
++++ build/rust/cargo_crate.gni
+@@ -267,6 +267,12 @@ template("cargo_crate") {
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
+
++ # Don't depend on the chrome-specific #[global_allocator] crate from
++ # third-party code. This avoids some dependency cycle issues. The allocator
++ # crate will still be used if it exists anywhere in the dependency graph for
++ # a given linked artifact.
++ no_allocator_crate = true
++
+ rustc_metadata = _rustc_metadata
+
+ # TODO(crbug.com/40259764): don't default to true. This requires changes to
+@@ -504,6 +510,9 @@ template("cargo_crate") {
+
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
++
++ # Build scripts do not need to link to chrome's allocator.
++ no_allocator_crate = true
+
+ # The ${_build_script_name}_output target looks for the exe in this
+ # location. Due to how the Windows component build works, this has to
diff --git a/devel/electron34/files/patch-build_rust_rust__macro.gni b/devel/electron34/files/patch-build_rust_rust__macro.gni
new file mode 100644
index 000000000000..0dafc3819aa1
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_rust__macro.gni
@@ -0,0 +1,12 @@
+--- build/rust/rust_macro.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_macro.gni
+@@ -16,6 +16,9 @@ template("rust_macro") {
+ forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+ proc_macro_configs = invoker.configs
+ target_type = "rust_proc_macro"
++
++ # Macros are loaded by rustc and shouldn't use chrome's allocation routines.
++ no_allocator_crate = true
+ }
+ }
+
diff --git a/devel/electron34/files/patch-build_rust_rust__target.gni b/devel/electron34/files/patch-build_rust_rust__target.gni
new file mode 100644
index 000000000000..f4ad6f04fc45
--- /dev/null
+++ b/devel/electron34/files/patch-build_rust_rust__target.gni
@@ -0,0 +1,13 @@
+--- build/rust/rust_target.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_target.gni
+@@ -339,6 +339,10 @@ template("rust_target") {
+ _rust_deps += [ "//build/rust/std" ]
+ }
+
++ if (!defined(invoker.no_allocator_crate) || !invoker.no_allocator_crate) {
++ _rust_deps += [ "//build/rust/allocator" ]
++ }
++
+ if (_build_unit_tests) {
+ _unit_test_target = "${_target_name}_unittests"
+ if (defined(invoker.unit_test_target)) {
diff --git a/devel/electron34/files/patch-build_rust_std_BUILD.gn b/devel/electron34/files/patch-build_rust_std_BUILD.gn
index 0efb06e75eb1..7314d062a541 100644
--- a/devel/electron34/files/patch-build_rust_std_BUILD.gn
+++ b/devel/electron34/files/patch-build_rust_std_BUILD.gn
@@ -1,6 +1,36 @@
--- build/rust/std/BUILD.gn.orig 2025-02-24 19:59:26 UTC
+++ build/rust/std/BUILD.gn
-@@ -74,13 +74,20 @@ if (toolchain_has_rust) {
+@@ -22,29 +22,6 @@ if (toolchain_has_rust) {
+ import("//build/config/sanitizers/sanitizers.gni")
+
+ if (toolchain_has_rust) {
+- # If clang performs the link step, we need to provide the allocator symbols
+- # that are normally injected by rustc during linking.
+- #
+- # We also "happen to" use this to redirect allocations to PartitionAlloc,
+- # though that would be better done through a #[global_allocator] crate (see
+- # above).
+- source_set("remap_alloc") {
+- public_deps = [ "//base/allocator/partition_allocator:buildflags" ]
+- if (use_partition_alloc_as_malloc) {
+- public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
+- }
+- sources = [
+- # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
+- # copied from `//base`.
+- # TODO(crbug.com/40279749): Avoid duplication / reuse code.
+- "alias.cc",
+- "alias.h",
+- "compiler_specific.h",
+- "immediate_crash.h",
+- "remap_alloc.cc",
+- ]
+- }
+-
+ # List of Rust stdlib rlibs which are present in the official Rust toolchain
+ # we are using from the Android team. This is usually a version or two behind
+ # nightly. Generally this matches the toolchain we build ourselves, but if
+@@ -74,13 +51,20 @@ if (toolchain_has_rust) {
# These are no longer present in the Windows toolchain.
stdlib_files += [
"addr2line",
@@ -22,7 +52,7 @@
}
if (toolchain_for_rust_host_build_tools) {
-@@ -100,7 +107,6 @@ if (toolchain_has_rust) {
+@@ -100,7 +84,6 @@ if (toolchain_has_rust) {
# don't need to pass to the C++ linker because they're used for specialized
# purposes.
skip_stdlib_files = [
@@ -30,3 +60,25 @@
"rustc_std_workspace_alloc",
"rustc_std_workspace_core",
"rustc_std_workspace_std",
+@@ -254,8 +237,6 @@ if (toolchain_has_rust) {
+ foreach(libname, stdlib_files + skip_stdlib_files) {
+ deps += [ "rules:$libname" ]
+ }
+-
+- public_deps = [ ":remap_alloc" ]
+ }
+ } else {
+ action("find_stdlib") {
+@@ -381,12 +362,6 @@ if (toolchain_has_rust) {
+ ":stdlib_public_dependent_libs",
+ ]
+ deps = [ ":prebuilt_rustc_copy_to_sysroot" ]
+-
+- # The host builds tools toolchain supports Rust only and does not use
+- # the allocator remapping to point it to PartitionAlloc.
+- if (!toolchain_for_rust_host_build_tools) {
+- deps += [ ":remap_alloc" ]
+- }
+ }
+ }
+ }
diff --git a/devel/electron35/files/patch-build_rust_allocator_BUILD.gn b/devel/electron35/files/patch-build_rust_allocator_BUILD.gn
new file mode 100644
index 000000000000..cb1633140dcc
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_BUILD.gn
@@ -0,0 +1,109 @@
+--- build/rust/allocator/BUILD.gn.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/BUILD.gn
+@@ -0,0 +1,106 @@
++# Copyright 2025 The Chromium Authors
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/buildflag_header.gni")
++import("//build/config/rust.gni")
++import("//build/rust/rust_static_library.gni")
++
++rust_allocator_uses_partition_alloc = false
++if (build_with_chromium) {
++ import("//base/allocator/partition_allocator/partition_alloc.gni")
++ rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
++}
++
++# In ASAN builds, PartitionAlloc-Everywhere is disabled, meaning malloc() and
++# friends in C++ do not go to PartitionAlloc. So we also don't point the Rust
++# allocation functions at PartitionAlloc. Generally, this means we just direct
++# them to the Standard Library's allocator.
++#
++# However, on Windows the Standard Library uses HeapAlloc() and Windows ASAN
++# does *not* hook that method, so ASAN does not get to hear about allocations
++# made in Rust. To resolve this, we redirect allocation to _aligned_malloc
++# which Windows ASAN *does* hook.
++#
++# Note that there is a runtime option to make ASAN hook HeapAlloc() but
++# enabling it breaks Win32 APIs like CreateProcess:
++# https://crbug.com/368070343#comment29
++rust_allocator_uses_aligned_malloc = false
++if (!rust_allocator_uses_partition_alloc && is_win && is_asan) {
++ rust_allocator_uses_aligned_malloc = true
++}
++
++rust_allocator_uses_allocator_impls_h =
++ rust_allocator_uses_partition_alloc || rust_allocator_uses_aligned_malloc
++
++buildflag_header("buildflags") {
++ header = "buildflags.h"
++ flags = [
++ "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
++ "RUST_ALLOCATOR_USES_ALIGNED_MALLOC=$rust_allocator_uses_aligned_malloc",
++ ]
++ visibility = [ ":*" ]
++}
++
++if (toolchain_has_rust) {
++ # All targets which depend on Rust code but are not linked by rustc must
++ # depend on this. Usually, this dependency will come from the rust_target() GN
++ # template. However, cargo_crate() does *not* include this dependency so any
++ # C++ targets which directly depend on a cargo_crate() must depend on this.
++ rust_static_library("allocator") {
++ sources = [ "lib.rs" ]
++ crate_root = "lib.rs"
++ cxx_bindings = [ "lib.rs" ]
++
++ deps = [ ":alloc_error_handler_impl" ]
++ if (rust_allocator_uses_allocator_impls_h) {
++ deps += [ ":allocator_impls" ]
++ }
++
++ no_chromium_prelude = true
++ no_allocator_crate = true
++ allow_unsafe = true
++
++ rustflags = []
++ if (rust_allocator_uses_allocator_impls_h) {
++ rustflags += [ "--cfg=rust_allocator_uses_allocator_impls_h" ]
++ cxx_bindings += [ "allocator_impls_ffi.rs" ]
++ sources += [ "allocator_impls_ffi.rs" ]
++ }
++
++ # TODO(https://crbug.com/410596442): Stop using unstable features here.
++ configs -= [ "//build/config/compiler:disallow_unstable_features" ]
++ }
++
++ if (rust_allocator_uses_allocator_impls_h) {
++ static_library("allocator_impls") {
++ public_deps = []
++ if (rust_allocator_uses_partition_alloc) {
++ public_deps +=
++ [ "//base/allocator/partition_allocator:partition_alloc" ]
++ }
++
++ sources = [
++ "allocator_impls.cc",
++ "allocator_impls.h",
++ ]
++ deps = [ ":buildflags" ]
++ visibility = [ ":*" ]
++ }
++ }
++
++ static_library("alloc_error_handler_impl") {
++ sources = [
++ # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
++ # copied from `//base`.
++ # TODO(crbug.com/40279749): Avoid duplication / reuse code.
++ "alias.cc",
++ "alias.h",
++ "alloc_error_handler_impl.cc",
++ "alloc_error_handler_impl.h",
++ "compiler_specific.h",
++ "immediate_crash.h",
++ ]
++ visibility = [ ":*" ]
++ }
++}
diff --git a/devel/electron35/files/patch-build_rust_allocator_DEPS b/devel/electron35/files/patch-build_rust_allocator_DEPS
new file mode 100644
index 000000000000..74bb2d6c2421
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_DEPS
@@ -0,0 +1,12 @@
+--- build/rust/allocator/DEPS.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/DEPS
+@@ -0,0 +1,9 @@
++include_rules = [
++ "-base",
++]
++
++specific_include_rules = {
++ "allocator_impls.cc" : [
++ "+partition_alloc"
++ ]
++}
diff --git a/devel/electron35/files/patch-build_rust_allocator_alias.cc b/devel/electron35/files/patch-build_rust_allocator_alias.cc
new file mode 100644
index 000000000000..5280641f27e1
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_alias.cc
@@ -0,0 +1,25 @@
+--- build/rust/allocator/alias.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.cc
+@@ -0,0 +1,22 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.cc ( additionally the APIs
++// were moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#include "build/rust/allocator/alias.h"
++
++#include "build/rust/allocator/compiler_specific.h"
++
++namespace build_rust_std {
++namespace debug {
++
++// This file/function should be excluded from LTO/LTCG to ensure that the
++// compiler can't see this function's implementation when compiling calls to it.
++NOINLINE void Alias(const void* var) {}
++
++} // namespace debug
++} // namespace build_rust_std
diff --git a/devel/electron35/files/patch-build_rust_allocator_alias.h b/devel/electron35/files/patch-build_rust_allocator_alias.h
new file mode 100644
index 000000000000..6530c6ae8779
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_alias.h
@@ -0,0 +1,40 @@
+--- build/rust/allocator/alias.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.h
+@@ -0,0 +1,37 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.h (and then trimmed to just
++// the APIs / macros needed by //build/rust/std; additionally the APIs were
++// moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALIAS_H_
++#define BUILD_RUST_ALLOCATOR_ALIAS_H_
++
++#include <stddef.h>
++
++namespace build_rust_std {
++namespace debug {
++
++// Make the optimizer think that |var| is aliased. This can be used to prevent a
++// local variable from being optimized out (which is something that
++// `NO_CODE_FOLDING` macro definition below depends on). See
++// //base/debug/alias.h for more details.
++void Alias(const void* var);
++
++} // namespace debug
++
++} // namespace build_rust_std
++
++// Prevent code folding (where a linker identifies functions that are
++// bit-identical and overlays them, which saves space but it leads to confusing
++// call stacks because multiple symbols are at the same address). See
++// //base/debug/alias.h for more details.
++#define NO_CODE_FOLDING() \
++ const int line_number = __LINE__; \
++ build_rust_std::debug::Alias(&line_number)
++
++#endif // BUILD_RUST_ALLOCATOR_ALIAS_H_
diff --git a/devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.cc b/devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
new file mode 100644
index 000000000000..048c267abefa
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
@@ -0,0 +1,20 @@
+--- build/rust/allocator/alloc_error_handler_impl.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.cc
+@@ -0,0 +1,17 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/alloc_error_handler_impl.h"
++
++#include "build/rust/allocator/alias.h"
++#include "build/rust/allocator/immediate_crash.h"
++
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl() {
++ NO_CODE_FOLDING();
++ IMMEDIATE_CRASH();
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.h b/devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.h
new file mode 100644
index 000000000000..887ea602b027
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_alloc__error__handler__impl.h
@@ -0,0 +1,24 @@
+--- build/rust/allocator/alloc_error_handler_impl.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.h
+@@ -0,0 +1,21 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++#define BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++
++// This header exposes to Rust a C++ implementation of quickly crashing after an
++// allocation error. (The API below is called from `__rust_alloc_error_handler`
++// in `lib.rs`.)
++//
++// TODO(lukasza): Investigate if we can delete this `.h` / `.cc` and just call
++// `std::process::abort()` (or something else?) directly from `.rs`. The main
++// open question is how much we care about `NO_CODE_FOLDING`.
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl();
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
diff --git a/devel/electron35/files/patch-build_rust_allocator_allocator__impls.cc b/devel/electron35/files/patch-build_rust_allocator_allocator__impls.cc
new file mode 100644
index 000000000000..94e04d7b966a
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_allocator__impls.cc
@@ -0,0 +1,108 @@
+--- build/rust/allocator/allocator_impls.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.cc
+@@ -0,0 +1,105 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/allocator_impls.h"
++
++#ifdef UNSAFE_BUFFERS_BUILD
++// TODO(crbug.com/390223051): Remove C-library calls to fix the errors.
++#pragma allow_unsafe_libc_calls
++#endif
++
++#include <cstddef>
++#include <cstring>
++
++#include "build/build_config.h"
++#include "build/rust/allocator/buildflags.h"
++
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++#include "partition_alloc/partition_alloc_constants.h" // nogncheck
++#include "partition_alloc/shim/allocator_shim.h" // nogncheck
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++#include <cstdlib>
++#endif
++
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // PartitionAlloc will crash if given an alignment larger than this.
++ if (align > partition_alloc::internal::kMaxSupportedAlignment) {
++ return nullptr;
++ }
++
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(allocator_shim::UncheckedAlloc(size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedAlloc(size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_malloc(size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++void dealloc(unsigned char* p, size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ if (align <= alignof(std::max_align_t)) {
++ allocator_shim::UncheckedFree(p);
++ } else {
++ allocator_shim::UncheckedAlignedFree(p);
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return _aligned_free(p);
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedRealloc(p, new_size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedRealloc(p, new_size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_realloc(p, new_size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* alloc_zeroed(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) || \
++ BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ // TODO(danakj): When RUST_ALLOCATOR_USES_PARTITION_ALLOC is true, it's
++ // possible that a partition_alloc::UncheckedAllocZeroed() call would perform
++ // better than partition_alloc::UncheckedAlloc() + memset. But there is no
++ // such API today. See b/342251590.
++ unsigned char* p = alloc(size, align);
++ if (p) {
++ memset(p, 0, size);
++ }
++ return p;
++#else
++#error This configuration is not supported.
++#endif
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron35/files/patch-build_rust_allocator_allocator__impls.h b/devel/electron35/files/patch-build_rust_allocator_allocator__impls.h
new file mode 100644
index 000000000000..9249cdc938d2
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_allocator__impls.h
@@ -0,0 +1,27 @@
+--- build/rust/allocator/allocator_impls.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.h
+@@ -0,0 +1,24 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++
++#include <cstddef>
++
++// This header exposes a C++ allocator (e.g. PartitionAlloc) to Rust.
++// The APIs below are called from `impl GlobalAlloc` in `lib.rs`.
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align);
++void dealloc(unsigned char* p, size_t size, size_t align);
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size);
++unsigned char* alloc_zeroed(size_t size, size_t align);
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
diff --git a/devel/electron35/files/patch-build_rust_allocator_allocator__impls__ffi.rs b/devel/electron35/files/patch-build_rust_allocator_allocator__impls__ffi.rs
new file mode 100644
index 000000000000..8f0baf1576ce
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_allocator__impls__ffi.rs
@@ -0,0 +1,22 @@
+--- build/rust/allocator/allocator_impls_ffi.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls_ffi.rs
+@@ -0,0 +1,19 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! FFI for `allocator_impls.h` is in a separate `.rs` file/module to
++//! better support conditional compilation (these functions are only
++//! used under `#[cfg(rust_allocator_uses_allocator_impls_h)]`.
++
++#[cxx::bridge(namespace = "rust_allocator_internal")]
++pub mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/allocator_impls.h");
++
++ unsafe fn alloc(size: usize, align: usize) -> *mut u8;
++ unsafe fn dealloc(p: *mut u8, size: usize, align: usize);
++ unsafe fn realloc(p: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
++ unsafe fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
++ }
++}
diff --git a/devel/electron35/files/patch-build_rust_allocator_compiler__specific.h b/devel/electron35/files/patch-build_rust_allocator_compiler__specific.h
new file mode 100644
index 000000000000..7feb0c739d79
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_compiler__specific.h
@@ -0,0 +1,41 @@
+--- build/rust/allocator/compiler_specific.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/compiler_specific.h
+@@ -0,0 +1,38 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/compiler_specific.h (and then
++// significantly trimmed to just the APIs / macros needed by //build/rust/std).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++#define BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++
++#include "build/build_config.h"
++
++#if defined(COMPILER_MSVC) && !defined(__clang__)
++#error "Only clang-cl is supported on Windows, see https://crbug.com/988071"
++#endif
++
++#if defined(__has_attribute)
++#define HAS_ATTRIBUTE(x) __has_attribute(x)
++#else
++#define HAS_ATTRIBUTE(x) 0
++#endif
++
++// Annotate a function indicating it should not be inlined.
++// Use like:
++// NOINLINE void DoStuff() { ... }
++#if defined(__clang__) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE [[clang::noinline]]
++#elif defined(COMPILER_GCC) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE __attribute__((noinline))
++#elif defined(COMPILER_MSVC)
++#define NOINLINE __declspec(noinline)
++#else
++#define NOINLINE
++#endif
++
++#endif // BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
diff --git a/devel/electron35/files/patch-build_rust_allocator_immediate__crash.h b/devel/electron35/files/patch-build_rust_allocator_immediate__crash.h
new file mode 100644
index 000000000000..7ab0f9d9c34c
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_immediate__crash.h
@@ -0,0 +1,174 @@
+--- build/rust/allocator/immediate_crash.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/immediate_crash.h
+@@ -0,0 +1,171 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/immediate_crash.h.
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++#define BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++
++#include "build/build_config.h"
++
++// Crashes in the fastest possible way with no attempt at logging.
++// There are several constraints; see http://crbug.com/664209 for more context.
++//
++// - TRAP_SEQUENCE_() must be fatal. It should not be possible to ignore the
++// resulting exception or simply hit 'continue' to skip over it in a debugger.
++// - Different instances of TRAP_SEQUENCE_() must not be folded together, to
++// ensure crash reports are debuggable. Unlike __builtin_trap(), asm volatile
++// blocks will not be folded together.
++// Note: TRAP_SEQUENCE_() previously required an instruction with a unique
++// nonce since unlike clang, GCC folds together identical asm volatile
++// blocks.
++// - TRAP_SEQUENCE_() must produce a signal that is distinct from an invalid
++// memory access.
++// - TRAP_SEQUENCE_() must be treated as a set of noreturn instructions.
++// __builtin_unreachable() is used to provide that hint here. clang also uses
++// this as a heuristic to pack the instructions in the function epilogue to
++// improve code density.
++//
++// Additional properties that are nice to have:
++// - TRAP_SEQUENCE_() should be as compact as possible.
++// - The first instruction of TRAP_SEQUENCE_() should not change, to avoid
++// shifting crash reporting clusters. As a consequence of this, explicit
++// assembly is preferred over intrinsics.
++// Note: this last bullet point may no longer be true, and may be removed in
++// the future.
++
++// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact
++// that clang emits an actual instruction for __builtin_unreachable() on certain
++// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will
++// be removed in followups, so splitting it up like this now makes it easy to
++// land the followups.
++
++#if defined(COMPILER_GCC)
++
++#if BUILDFLAG(IS_NACL)
++
++// Crash report accuracy is not guaranteed on NaCl.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#elif defined(ARCH_CPU_X86_FAMILY)
++
++// TODO(crbug.com/40625592): In theory, it should be possible to use just
++// int3. However, there are a number of crashes with SIGILL as the exception
++// code, so it seems likely that there's a signal handler that allows execution
++// to continue after SIGTRAP.
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++
++#if BUILDFLAG(IS_APPLE)
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
++#define TRAP_SEQUENCE2_() asm volatile("")
++#else
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++#endif // BUILDFLAG(IS_APPLE)
++
++#elif defined(ARCH_CPU_ARMEL)
++
++// bkpt will generate a SIGBUS when running on armv7 and a SIGTRAP when running
++// as a 32 bit userspace app on arm64. There doesn't seem to be any way to
++// cause a SIGTRAP from userspace without using a syscall (which would be a
++// problem for sandboxing).
++// TODO(crbug.com/40625592): Remove bkpt from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("bkpt #0")
++#define TRAP_SEQUENCE2_() asm volatile("udf #0")
++
++#elif defined(ARCH_CPU_ARM64)
++
++// This will always generate a SIGTRAP on arm64.
++// TODO(crbug.com/40625592): Remove brk from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("brk #0")
++#define TRAP_SEQUENCE2_() asm volatile("hlt #0")
++
++#else
++
++// Crash report accuracy will not be guaranteed on other architectures, but at
++// least this will crash as expected.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#endif // ARCH_CPU_*
++
++#elif defined(COMPILER_MSVC)
++
++#if !defined(__clang__)
++
++// MSVC x64 doesn't support inline asm, so use the MSVC intrinsic.
++#define TRAP_SEQUENCE1_() __debugbreak()
++#define TRAP_SEQUENCE2_()
++
++#elif defined(ARCH_CPU_ARM64)
++
++// Windows ARM64 uses "BRK #F000" as its breakpoint instruction, and
++// __debugbreak() generates that in both VC++ and clang.
++#define TRAP_SEQUENCE1_() __debugbreak()
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64,
++// https://crbug.com/958373
++#define TRAP_SEQUENCE2_() __asm volatile("")
++
++#else
++
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++
++#endif // __clang__
++
++#else
++
++#error No supported trap sequence!
++
++#endif // COMPILER_GCC
++
++#define TRAP_SEQUENCE_() \
++ do { \
++ TRAP_SEQUENCE1_(); \
++ TRAP_SEQUENCE2_(); \
++ } while (false)
++
++// CHECK() and the trap sequence can be invoked from a constexpr function.
++// This could make compilation fail on GCC, as it forbids directly using inline
++// asm inside a constexpr function. However, it allows calling a lambda
++// expression including the same asm.
++// The side effect is that the top of the stacktrace will not point to the
++// calling function, but to this anonymous lambda. This is still useful as the
++// full name of the lambda will typically include the name of the function that
++// calls CHECK() and the debugger will still break at the right line of code.
++#if !defined(COMPILER_GCC) || defined(__clang__)
++
++#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_()
++
++#else
++
++#define WRAPPED_TRAP_SEQUENCE_() \
++ do { \
++ [] { TRAP_SEQUENCE_(); }(); \
++ } while (false)
++
++#endif // !defined(COMPILER_GCC) || defined(__clang__)
++
++#if defined(__clang__) || defined(COMPILER_GCC)
++
++// __builtin_unreachable() hints to the compiler that this is noreturn and can
++// be packed in the function epilogue.
++#define IMMEDIATE_CRASH() \
++ ({ \
++ WRAPPED_TRAP_SEQUENCE_(); \
++ __builtin_unreachable(); \
++ })
++
++#else
++
++// This is supporting non-chromium user of logging.h to build with MSVC, like
++// pdfium. On MSVC there is no __builtin_unreachable().
++#define IMMEDIATE_CRASH() WRAPPED_TRAP_SEQUENCE_()
++
++#endif // defined(__clang__) || defined(COMPILER_GCC)
++
++#endif // BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
diff --git a/devel/electron35/files/patch-build_rust_allocator_lib.rs b/devel/electron35/files/patch-build_rust_allocator_lib.rs
new file mode 100644
index 000000000000..89fddf278294
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_allocator_lib.rs
@@ -0,0 +1,122 @@
+--- build/rust/allocator/lib.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/lib.rs
+@@ -0,0 +1,119 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! Define the allocator that Rust code in Chrome should use.
++//!
++//! Any final artifact that depends on this crate, even transitively, will use
++//! the allocator defined here.
++//!
++//! List of known issues:
++//!
++//! 1. We'd like to use PartitionAlloc on Windows, but the stdlib uses Windows
++//! heap functions directly that PartitionAlloc can not intercept.
++//! 2. We'd like `Vec::try_reserve` to fail at runtime on Linux instead of
++//! crashing in malloc() where PartitionAlloc replaces that function.
++
++// Required to apply weak linkage to symbols.
++//
++// TODO(https://crbug.com/410596442): Stop using unstable features here.
++// https://github.com/rust-lang/rust/issues/29603 tracks stabilization of the `linkage` feature.
++#![feature(linkage)]
++// Required to apply `#[rustc_std_internal_symbol]` to our alloc error handler
++// so the name is correctly mangled as rustc expects.
++//
++// TODO(https://crbug.com/410596442): Stop using internal features here.
++#![allow(internal_features)]
++#![feature(rustc_attrs)]
++
++// This module is in a separate source file to avoid having to teach `cxxbridge`
++// about conditional compilation.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod allocator_impls_ffi;
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using an allocator from C++.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod cpp_allocator {
++ use super::allocator_impls_ffi::ffi;
++ use std::alloc::{GlobalAlloc, Layout};
++
++ struct Allocator;
++
++ unsafe impl GlobalAlloc for Allocator {
++ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc(layout.size(), layout.align()) }
++ }
++
++ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
++ unsafe {
++ ffi::dealloc(ptr, layout.size(), layout.align());
++ }
++ }
++
++ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc_zeroed(layout.size(), layout.align()) }
++ }
++
++ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
++ unsafe { ffi::realloc(ptr, layout.size(), layout.align(), new_size) }
++ }
++ }
++
++ #[global_allocator]
++ static GLOBAL: Allocator = Allocator;
++}
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using the default Rust allocator.
++#[cfg(not(rust_allocator_uses_allocator_impls_h))]
++mod rust_allocator {
++ #[global_allocator]
++ static GLOBAL: std::alloc::System = std::alloc::System;
++}
++
++/// Module that provides global symbols that are needed both by `cpp_allocator`
++/// and `rust_allocator`.
++///
++/// When `rustc` drives linking, then it will define the symbols below. But
++/// Chromium only uses `rustc` to link Rust-only executables (e.g. `build.rs`
++/// scripts) and otherwise uses a non-Rust linker. This is why we have to
++/// manually define a few symbols below. We define those symbols
++/// as "weak" symbols, so that Rust-provided symbols "win" in case where Rust
++/// actually does drive the linking. This hack works (not only for Chromium,
++/// but also for google3 and other projects), but isn't officially supported by
++/// `rustc`.
++///
++/// TODO(https://crbug.com/410596442): Stop using internal features here.
++mod both_allocators {
++ /// As part of rustc's contract for using `#[global_allocator]` without
++ /// rustc-generated shims we must define this symbol, since we are opting in
++ /// to unstable functionality. See https://github.com/rust-lang/rust/issues/123015
++ #[no_mangle]
++ #[linkage = "weak"]
++ static __rust_no_alloc_shim_is_unstable: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ static __rust_alloc_error_handler_should_panic: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ fn __rust_alloc_error_handler(_size: usize, _align: usize) {
++ // TODO(lukasza): Investigate if we can just call `std::process::abort()` here.
++ // (Not really _needed_, but it could simplify code a little bit.)
++ unsafe { ffi::alloc_error_handler_impl() }
++ }
++
++ #[cxx::bridge(namespace = "rust_allocator_internal")]
++ mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/alloc_error_handler_impl.h");
++ unsafe fn alloc_error_handler_impl();
++ }
++ }
++}
diff --git a/devel/electron35/files/patch-build_rust_cargo__crate.gni b/devel/electron35/files/patch-build_rust_cargo__crate.gni
new file mode 100644
index 000000000000..8b1b8e5144e9
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_cargo__crate.gni
@@ -0,0 +1,25 @@
+--- build/rust/cargo_crate.gni.orig 2025-04-14 21:12:04 UTC
++++ build/rust/cargo_crate.gni
+@@ -267,6 +267,12 @@ template("cargo_crate") {
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
+
++ # Don't depend on the chrome-specific #[global_allocator] crate from
++ # third-party code. This avoids some dependency cycle issues. The allocator
++ # crate will still be used if it exists anywhere in the dependency graph for
++ # a given linked artifact.
++ no_allocator_crate = true
++
+ rustc_metadata = _rustc_metadata
+
+ # TODO(crbug.com/40259764): don't default to true. This requires changes to
+@@ -504,6 +510,9 @@ template("cargo_crate") {
+
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
++
++ # Build scripts do not need to link to chrome's allocator.
++ no_allocator_crate = true
+
+ # The ${_build_script_name}_output target looks for the exe in this
+ # location. Due to how the Windows component build works, this has to
diff --git a/devel/electron35/files/patch-build_rust_rust__macro.gni b/devel/electron35/files/patch-build_rust_rust__macro.gni
new file mode 100644
index 000000000000..0dafc3819aa1
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_rust__macro.gni
@@ -0,0 +1,12 @@
+--- build/rust/rust_macro.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_macro.gni
+@@ -16,6 +16,9 @@ template("rust_macro") {
+ forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+ proc_macro_configs = invoker.configs
+ target_type = "rust_proc_macro"
++
++ # Macros are loaded by rustc and shouldn't use chrome's allocation routines.
++ no_allocator_crate = true
+ }
+ }
+
diff --git a/devel/electron35/files/patch-build_rust_rust__target.gni b/devel/electron35/files/patch-build_rust_rust__target.gni
new file mode 100644
index 000000000000..f4ad6f04fc45
--- /dev/null
+++ b/devel/electron35/files/patch-build_rust_rust__target.gni
@@ -0,0 +1,13 @@
+--- build/rust/rust_target.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_target.gni
+@@ -339,6 +339,10 @@ template("rust_target") {
+ _rust_deps += [ "//build/rust/std" ]
+ }
+
++ if (!defined(invoker.no_allocator_crate) || !invoker.no_allocator_crate) {
++ _rust_deps += [ "//build/rust/allocator" ]
++ }
++
+ if (_build_unit_tests) {
+ _unit_test_target = "${_target_name}_unittests"
+ if (defined(invoker.unit_test_target)) {
diff --git a/devel/electron35/files/patch-build_rust_std_BUILD.gn b/devel/electron35/files/patch-build_rust_std_BUILD.gn
index 0a5335d58d48..c6c2801bd47d 100644
--- a/devel/electron35/files/patch-build_rust_std_BUILD.gn
+++ b/devel/electron35/files/patch-build_rust_std_BUILD.gn
@@ -1,6 +1,58 @@
---- build/rust/std/BUILD.gn.orig 2025-04-05 13:54:50 UTC
+--- build/rust/std/BUILD.gn.orig 2025-05-20 09:16:26 UTC
+++ build/rust/std/BUILD.gn
-@@ -89,13 +89,20 @@ if (toolchain_has_rust) {
+@@ -15,51 +15,12 @@
+ # allocator functions to PartitionAlloc when `use_partition_alloc_as_malloc` is
+ # true, so that Rust and C++ use the same allocator backend.
+
+-import("//build/buildflag_header.gni")
+ import("//build/config/compiler/compiler.gni")
+ import("//build/config/coverage/coverage.gni")
+ import("//build/config/rust.gni")
+ import("//build/config/sanitizers/sanitizers.gni")
+
+-rust_allocator_uses_partition_alloc = false
+-if (build_with_chromium) {
+- import("//base/allocator/partition_allocator/partition_alloc.gni")
+- rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
+-}
+-
+-buildflag_header("buildflags") {
+- header = "buildflags.h"
+- flags = [
+- "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
+- ]
+- visibility = [ ":*" ]
+-}
+-
+ if (toolchain_has_rust) {
+- # If clang performs the link step, we need to provide the allocator symbols
+- # that are normally injected by rustc during linking.
+- #
+- # We also "happen to" use this to redirect allocations to PartitionAlloc,
+- # though that would be better done through a #[global_allocator] crate (see
+- # above).
+- source_set("remap_alloc") {
+- public_deps = []
+- if (rust_allocator_uses_partition_alloc) {
+- public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
+- }
+- deps = [ ":buildflags" ]
+- sources = [
+- # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
+- # copied from `//base`.
+- # TODO(crbug.com/40279749): Avoid duplication / reuse code.
+- "alias.cc",
+- "alias.h",
+- "compiler_specific.h",
+- "immediate_crash.h",
+- "remap_alloc.cc",
+- ]
+- }
+-
+ # List of Rust stdlib rlibs which are present in the official Rust toolchain
+ # we are using from the Android team. This is usually a version or two behind
+ # nightly. Generally this matches the toolchain we build ourselves, but if
+@@ -89,13 +50,20 @@ if (toolchain_has_rust) {
# These are no longer present in the Windows toolchain.
stdlib_files += [
"addr2line",
@@ -22,7 +74,7 @@
}
if (toolchain_for_rust_host_build_tools) {
-@@ -115,7 +122,6 @@ if (toolchain_has_rust) {
+@@ -115,7 +83,6 @@ if (toolchain_has_rust) {
# don't need to pass to the C++ linker because they're used for specialized
# purposes.
skip_stdlib_files = [
@@ -30,3 +82,25 @@
"rustc_std_workspace_alloc",
"rustc_std_workspace_core",
"rustc_std_workspace_std",
+@@ -269,8 +236,6 @@ if (toolchain_has_rust) {
+ foreach(libname, stdlib_files + skip_stdlib_files) {
+ deps += [ "rules:$libname" ]
+ }
+-
+- public_deps = [ ":remap_alloc" ]
+ }
+ } else {
+ action("find_stdlib") {
+@@ -396,12 +361,6 @@ if (toolchain_has_rust) {
+ ":stdlib_public_dependent_libs",
+ ]
+ deps = [ ":prebuilt_rustc_copy_to_sysroot" ]
+-
+- # The host builds tools toolchain supports Rust only and does not use
+- # the allocator remapping to point it to PartitionAlloc.
+- if (!toolchain_for_rust_host_build_tools) {
+- deps += [ ":remap_alloc" ]
+- }
+ }
+ }
+ }
diff --git a/devel/electron36/files/patch-build_rust_allocator_BUILD.gn b/devel/electron36/files/patch-build_rust_allocator_BUILD.gn
new file mode 100644
index 000000000000..cb1633140dcc
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_BUILD.gn
@@ -0,0 +1,109 @@
+--- build/rust/allocator/BUILD.gn.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/BUILD.gn
+@@ -0,0 +1,106 @@
++# Copyright 2025 The Chromium Authors
++# Use of this source code is governed by a BSD-style license that can be
++# found in the LICENSE file.
++
++import("//build/buildflag_header.gni")
++import("//build/config/rust.gni")
++import("//build/rust/rust_static_library.gni")
++
++rust_allocator_uses_partition_alloc = false
++if (build_with_chromium) {
++ import("//base/allocator/partition_allocator/partition_alloc.gni")
++ rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
++}
++
++# In ASAN builds, PartitionAlloc-Everywhere is disabled, meaning malloc() and
++# friends in C++ do not go to PartitionAlloc. So we also don't point the Rust
++# allocation functions at PartitionAlloc. Generally, this means we just direct
++# them to the Standard Library's allocator.
++#
++# However, on Windows the Standard Library uses HeapAlloc() and Windows ASAN
++# does *not* hook that method, so ASAN does not get to hear about allocations
++# made in Rust. To resolve this, we redirect allocation to _aligned_malloc
++# which Windows ASAN *does* hook.
++#
++# Note that there is a runtime option to make ASAN hook HeapAlloc() but
++# enabling it breaks Win32 APIs like CreateProcess:
++# https://crbug.com/368070343#comment29
++rust_allocator_uses_aligned_malloc = false
++if (!rust_allocator_uses_partition_alloc && is_win && is_asan) {
++ rust_allocator_uses_aligned_malloc = true
++}
++
++rust_allocator_uses_allocator_impls_h =
++ rust_allocator_uses_partition_alloc || rust_allocator_uses_aligned_malloc
++
++buildflag_header("buildflags") {
++ header = "buildflags.h"
++ flags = [
++ "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
++ "RUST_ALLOCATOR_USES_ALIGNED_MALLOC=$rust_allocator_uses_aligned_malloc",
++ ]
++ visibility = [ ":*" ]
++}
++
++if (toolchain_has_rust) {
++ # All targets which depend on Rust code but are not linked by rustc must
++ # depend on this. Usually, this dependency will come from the rust_target() GN
++ # template. However, cargo_crate() does *not* include this dependency so any
++ # C++ targets which directly depend on a cargo_crate() must depend on this.
++ rust_static_library("allocator") {
++ sources = [ "lib.rs" ]
++ crate_root = "lib.rs"
++ cxx_bindings = [ "lib.rs" ]
++
++ deps = [ ":alloc_error_handler_impl" ]
++ if (rust_allocator_uses_allocator_impls_h) {
++ deps += [ ":allocator_impls" ]
++ }
++
++ no_chromium_prelude = true
++ no_allocator_crate = true
++ allow_unsafe = true
++
++ rustflags = []
++ if (rust_allocator_uses_allocator_impls_h) {
++ rustflags += [ "--cfg=rust_allocator_uses_allocator_impls_h" ]
++ cxx_bindings += [ "allocator_impls_ffi.rs" ]
++ sources += [ "allocator_impls_ffi.rs" ]
++ }
++
++ # TODO(https://crbug.com/410596442): Stop using unstable features here.
++ configs -= [ "//build/config/compiler:disallow_unstable_features" ]
++ }
++
++ if (rust_allocator_uses_allocator_impls_h) {
++ static_library("allocator_impls") {
++ public_deps = []
++ if (rust_allocator_uses_partition_alloc) {
++ public_deps +=
++ [ "//base/allocator/partition_allocator:partition_alloc" ]
++ }
++
++ sources = [
++ "allocator_impls.cc",
++ "allocator_impls.h",
++ ]
++ deps = [ ":buildflags" ]
++ visibility = [ ":*" ]
++ }
++ }
++
++ static_library("alloc_error_handler_impl") {
++ sources = [
++ # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
++ # copied from `//base`.
++ # TODO(crbug.com/40279749): Avoid duplication / reuse code.
++ "alias.cc",
++ "alias.h",
++ "alloc_error_handler_impl.cc",
++ "alloc_error_handler_impl.h",
++ "compiler_specific.h",
++ "immediate_crash.h",
++ ]
++ visibility = [ ":*" ]
++ }
++}
diff --git a/devel/electron36/files/patch-build_rust_allocator_DEPS b/devel/electron36/files/patch-build_rust_allocator_DEPS
new file mode 100644
index 000000000000..74bb2d6c2421
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_DEPS
@@ -0,0 +1,12 @@
+--- build/rust/allocator/DEPS.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/DEPS
+@@ -0,0 +1,9 @@
++include_rules = [
++ "-base",
++]
++
++specific_include_rules = {
++ "allocator_impls.cc" : [
++ "+partition_alloc"
++ ]
++}
diff --git a/devel/electron36/files/patch-build_rust_allocator_alias.cc b/devel/electron36/files/patch-build_rust_allocator_alias.cc
new file mode 100644
index 000000000000..5280641f27e1
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_alias.cc
@@ -0,0 +1,25 @@
+--- build/rust/allocator/alias.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.cc
+@@ -0,0 +1,22 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.cc ( additionally the APIs
++// were moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#include "build/rust/allocator/alias.h"
++
++#include "build/rust/allocator/compiler_specific.h"
++
++namespace build_rust_std {
++namespace debug {
++
++// This file/function should be excluded from LTO/LTCG to ensure that the
++// compiler can't see this function's implementation when compiling calls to it.
++NOINLINE void Alias(const void* var) {}
++
++} // namespace debug
++} // namespace build_rust_std
diff --git a/devel/electron36/files/patch-build_rust_allocator_alias.h b/devel/electron36/files/patch-build_rust_allocator_alias.h
new file mode 100644
index 000000000000..6530c6ae8779
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_alias.h
@@ -0,0 +1,40 @@
+--- build/rust/allocator/alias.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alias.h
+@@ -0,0 +1,37 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/debug/alias.h (and then trimmed to just
++// the APIs / macros needed by //build/rust/std; additionally the APIs were
++// moved into the `build_rust_std` namespace).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALIAS_H_
++#define BUILD_RUST_ALLOCATOR_ALIAS_H_
++
++#include <stddef.h>
++
++namespace build_rust_std {
++namespace debug {
++
++// Make the optimizer think that |var| is aliased. This can be used to prevent a
++// local variable from being optimized out (which is something that
++// `NO_CODE_FOLDING` macro definition below depends on). See
++// //base/debug/alias.h for more details.
++void Alias(const void* var);
++
++} // namespace debug
++
++} // namespace build_rust_std
++
++// Prevent code folding (where a linker identifies functions that are
++// bit-identical and overlays them, which saves space but it leads to confusing
++// call stacks because multiple symbols are at the same address). See
++// //base/debug/alias.h for more details.
++#define NO_CODE_FOLDING() \
++ const int line_number = __LINE__; \
++ build_rust_std::debug::Alias(&line_number)
++
++#endif // BUILD_RUST_ALLOCATOR_ALIAS_H_
diff --git a/devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.cc b/devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
new file mode 100644
index 000000000000..048c267abefa
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.cc
@@ -0,0 +1,20 @@
+--- build/rust/allocator/alloc_error_handler_impl.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.cc
+@@ -0,0 +1,17 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/alloc_error_handler_impl.h"
++
++#include "build/rust/allocator/alias.h"
++#include "build/rust/allocator/immediate_crash.h"
++
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl() {
++ NO_CODE_FOLDING();
++ IMMEDIATE_CRASH();
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.h b/devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.h
new file mode 100644
index 000000000000..887ea602b027
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_alloc__error__handler__impl.h
@@ -0,0 +1,24 @@
+--- build/rust/allocator/alloc_error_handler_impl.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/alloc_error_handler_impl.h
+@@ -0,0 +1,21 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++#define BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
++
++// This header exposes to Rust a C++ implementation of quickly crashing after an
++// allocation error. (The API below is called from `__rust_alloc_error_handler`
++// in `lib.rs`.)
++//
++// TODO(lukasza): Investigate if we can delete this `.h` / `.cc` and just call
++// `std::process::abort()` (or something else?) directly from `.rs`. The main
++// open question is how much we care about `NO_CODE_FOLDING`.
++namespace rust_allocator_internal {
++
++void alloc_error_handler_impl();
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOC_ERROR_HANDLER_IMPL_H_
diff --git a/devel/electron36/files/patch-build_rust_allocator_allocator__impls.cc b/devel/electron36/files/patch-build_rust_allocator_allocator__impls.cc
new file mode 100644
index 000000000000..94e04d7b966a
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_allocator__impls.cc
@@ -0,0 +1,108 @@
+--- build/rust/allocator/allocator_impls.cc.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.cc
+@@ -0,0 +1,105 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#include "build/rust/allocator/allocator_impls.h"
++
++#ifdef UNSAFE_BUFFERS_BUILD
++// TODO(crbug.com/390223051): Remove C-library calls to fix the errors.
++#pragma allow_unsafe_libc_calls
++#endif
++
++#include <cstddef>
++#include <cstring>
++
++#include "build/build_config.h"
++#include "build/rust/allocator/buildflags.h"
++
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++#include "partition_alloc/partition_alloc_constants.h" // nogncheck
++#include "partition_alloc/shim/allocator_shim.h" // nogncheck
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++#include <cstdlib>
++#endif
++
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // PartitionAlloc will crash if given an alignment larger than this.
++ if (align > partition_alloc::internal::kMaxSupportedAlignment) {
++ return nullptr;
++ }
++
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(allocator_shim::UncheckedAlloc(size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedAlloc(size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_malloc(size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++void dealloc(unsigned char* p, size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ if (align <= alignof(std::max_align_t)) {
++ allocator_shim::UncheckedFree(p);
++ } else {
++ allocator_shim::UncheckedAlignedFree(p);
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return _aligned_free(p);
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC)
++ // We use unchecked allocation paths in PartitionAlloc rather than going
++ // through its shims in `malloc()` etc so that we can support fallible
++ // allocation paths such as Vec::try_reserve without crashing on allocation
++ // failure.
++ if (align <= alignof(std::max_align_t)) {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedRealloc(p, new_size));
++ } else {
++ return static_cast<unsigned char*>(
++ allocator_shim::UncheckedAlignedRealloc(p, new_size, align));
++ }
++#elif BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ return static_cast<unsigned char*>(_aligned_realloc(p, new_size, align));
++#else
++#error This configuration is not supported.
++#endif
++}
++
++unsigned char* alloc_zeroed(size_t size, size_t align) {
++#if BUILDFLAG(RUST_ALLOCATOR_USES_PARTITION_ALLOC) || \
++ BUILDFLAG(RUST_ALLOCATOR_USES_ALIGNED_MALLOC)
++ // TODO(danakj): When RUST_ALLOCATOR_USES_PARTITION_ALLOC is true, it's
++ // possible that a partition_alloc::UncheckedAllocZeroed() call would perform
++ // better than partition_alloc::UncheckedAlloc() + memset. But there is no
++ // such API today. See b/342251590.
++ unsigned char* p = alloc(size, align);
++ if (p) {
++ memset(p, 0, size);
++ }
++ return p;
++#else
++#error This configuration is not supported.
++#endif
++}
++
++} // namespace rust_allocator_internal
diff --git a/devel/electron36/files/patch-build_rust_allocator_allocator__impls.h b/devel/electron36/files/patch-build_rust_allocator_allocator__impls.h
new file mode 100644
index 000000000000..9249cdc938d2
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_allocator__impls.h
@@ -0,0 +1,27 @@
+--- build/rust/allocator/allocator_impls.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls.h
+@@ -0,0 +1,24 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++#ifndef BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++#define BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
++
++#include <cstddef>
++
++// This header exposes a C++ allocator (e.g. PartitionAlloc) to Rust.
++// The APIs below are called from `impl GlobalAlloc` in `lib.rs`.
++namespace rust_allocator_internal {
++
++unsigned char* alloc(size_t size, size_t align);
++void dealloc(unsigned char* p, size_t size, size_t align);
++unsigned char* realloc(unsigned char* p,
++ size_t old_size,
++ size_t align,
++ size_t new_size);
++unsigned char* alloc_zeroed(size_t size, size_t align);
++
++} // namespace rust_allocator_internal
++
++#endif // BUILD_RUST_ALLOCATOR_ALLOCATOR_IMPLS_H_
diff --git a/devel/electron36/files/patch-build_rust_allocator_allocator__impls__ffi.rs b/devel/electron36/files/patch-build_rust_allocator_allocator__impls__ffi.rs
new file mode 100644
index 000000000000..8f0baf1576ce
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_allocator__impls__ffi.rs
@@ -0,0 +1,22 @@
+--- build/rust/allocator/allocator_impls_ffi.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/allocator_impls_ffi.rs
+@@ -0,0 +1,19 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! FFI for `allocator_impls.h` is in a separate `.rs` file/module to
++//! better support conditional compilation (these functions are only
++//! used under `#[cfg(rust_allocator_uses_allocator_impls_h)]`.
++
++#[cxx::bridge(namespace = "rust_allocator_internal")]
++pub mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/allocator_impls.h");
++
++ unsafe fn alloc(size: usize, align: usize) -> *mut u8;
++ unsafe fn dealloc(p: *mut u8, size: usize, align: usize);
++ unsafe fn realloc(p: *mut u8, old_size: usize, align: usize, new_size: usize) -> *mut u8;
++ unsafe fn alloc_zeroed(size: usize, align: usize) -> *mut u8;
++ }
++}
diff --git a/devel/electron36/files/patch-build_rust_allocator_compiler__specific.h b/devel/electron36/files/patch-build_rust_allocator_compiler__specific.h
new file mode 100644
index 000000000000..7feb0c739d79
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_compiler__specific.h
@@ -0,0 +1,41 @@
+--- build/rust/allocator/compiler_specific.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/compiler_specific.h
+@@ -0,0 +1,38 @@
++// Copyright 2023 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/compiler_specific.h (and then
++// significantly trimmed to just the APIs / macros needed by //build/rust/std).
++//
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++#define BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
++
++#include "build/build_config.h"
++
++#if defined(COMPILER_MSVC) && !defined(__clang__)
++#error "Only clang-cl is supported on Windows, see https://crbug.com/988071"
++#endif
++
++#if defined(__has_attribute)
++#define HAS_ATTRIBUTE(x) __has_attribute(x)
++#else
++#define HAS_ATTRIBUTE(x) 0
++#endif
++
++// Annotate a function indicating it should not be inlined.
++// Use like:
++// NOINLINE void DoStuff() { ... }
++#if defined(__clang__) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE [[clang::noinline]]
++#elif defined(COMPILER_GCC) && HAS_ATTRIBUTE(noinline)
++#define NOINLINE __attribute__((noinline))
++#elif defined(COMPILER_MSVC)
++#define NOINLINE __declspec(noinline)
++#else
++#define NOINLINE
++#endif
++
++#endif // BUILD_RUST_ALLOCATOR_COMPILER_SPECIFIC_H_
diff --git a/devel/electron36/files/patch-build_rust_allocator_immediate__crash.h b/devel/electron36/files/patch-build_rust_allocator_immediate__crash.h
new file mode 100644
index 000000000000..7ab0f9d9c34c
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_immediate__crash.h
@@ -0,0 +1,174 @@
+--- build/rust/allocator/immediate_crash.h.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/immediate_crash.h
+@@ -0,0 +1,171 @@
++// Copyright 2021 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++// This file has been copied from //base/immediate_crash.h.
++// TODO(crbug.com/40279749): Avoid code duplication / reuse code.
++
++#ifndef BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++#define BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
++
++#include "build/build_config.h"
++
++// Crashes in the fastest possible way with no attempt at logging.
++// There are several constraints; see http://crbug.com/664209 for more context.
++//
++// - TRAP_SEQUENCE_() must be fatal. It should not be possible to ignore the
++// resulting exception or simply hit 'continue' to skip over it in a debugger.
++// - Different instances of TRAP_SEQUENCE_() must not be folded together, to
++// ensure crash reports are debuggable. Unlike __builtin_trap(), asm volatile
++// blocks will not be folded together.
++// Note: TRAP_SEQUENCE_() previously required an instruction with a unique
++// nonce since unlike clang, GCC folds together identical asm volatile
++// blocks.
++// - TRAP_SEQUENCE_() must produce a signal that is distinct from an invalid
++// memory access.
++// - TRAP_SEQUENCE_() must be treated as a set of noreturn instructions.
++// __builtin_unreachable() is used to provide that hint here. clang also uses
++// this as a heuristic to pack the instructions in the function epilogue to
++// improve code density.
++//
++// Additional properties that are nice to have:
++// - TRAP_SEQUENCE_() should be as compact as possible.
++// - The first instruction of TRAP_SEQUENCE_() should not change, to avoid
++// shifting crash reporting clusters. As a consequence of this, explicit
++// assembly is preferred over intrinsics.
++// Note: this last bullet point may no longer be true, and may be removed in
++// the future.
++
++// Note: TRAP_SEQUENCE Is currently split into two macro helpers due to the fact
++// that clang emits an actual instruction for __builtin_unreachable() on certain
++// platforms (see https://crbug.com/958675). In addition, the int3/bkpt/brk will
++// be removed in followups, so splitting it up like this now makes it easy to
++// land the followups.
++
++#if defined(COMPILER_GCC)
++
++#if BUILDFLAG(IS_NACL)
++
++// Crash report accuracy is not guaranteed on NaCl.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#elif defined(ARCH_CPU_X86_FAMILY)
++
++// TODO(crbug.com/40625592): In theory, it should be possible to use just
++// int3. However, there are a number of crashes with SIGILL as the exception
++// code, so it seems likely that there's a signal handler that allows execution
++// to continue after SIGTRAP.
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++
++#if BUILDFLAG(IS_APPLE)
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Mac.
++#define TRAP_SEQUENCE2_() asm volatile("")
++#else
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++#endif // BUILDFLAG(IS_APPLE)
++
++#elif defined(ARCH_CPU_ARMEL)
++
++// bkpt will generate a SIGBUS when running on armv7 and a SIGTRAP when running
++// as a 32 bit userspace app on arm64. There doesn't seem to be any way to
++// cause a SIGTRAP from userspace without using a syscall (which would be a
++// problem for sandboxing).
++// TODO(crbug.com/40625592): Remove bkpt from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("bkpt #0")
++#define TRAP_SEQUENCE2_() asm volatile("udf #0")
++
++#elif defined(ARCH_CPU_ARM64)
++
++// This will always generate a SIGTRAP on arm64.
++// TODO(crbug.com/40625592): Remove brk from this sequence.
++#define TRAP_SEQUENCE1_() asm volatile("brk #0")
++#define TRAP_SEQUENCE2_() asm volatile("hlt #0")
++
++#else
++
++// Crash report accuracy will not be guaranteed on other architectures, but at
++// least this will crash as expected.
++#define TRAP_SEQUENCE1_() __builtin_trap()
++#define TRAP_SEQUENCE2_() asm volatile("")
++
++#endif // ARCH_CPU_*
++
++#elif defined(COMPILER_MSVC)
++
++#if !defined(__clang__)
++
++// MSVC x64 doesn't support inline asm, so use the MSVC intrinsic.
++#define TRAP_SEQUENCE1_() __debugbreak()
++#define TRAP_SEQUENCE2_()
++
++#elif defined(ARCH_CPU_ARM64)
++
++// Windows ARM64 uses "BRK #F000" as its breakpoint instruction, and
++// __debugbreak() generates that in both VC++ and clang.
++#define TRAP_SEQUENCE1_() __debugbreak()
++// Intentionally empty: __builtin_unreachable() is always part of the sequence
++// (see IMMEDIATE_CRASH below) and already emits a ud2 on Win64,
++// https://crbug.com/958373
++#define TRAP_SEQUENCE2_() __asm volatile("")
++
++#else
++
++#define TRAP_SEQUENCE1_() asm volatile("int3")
++#define TRAP_SEQUENCE2_() asm volatile("ud2")
++
++#endif // __clang__
++
++#else
++
++#error No supported trap sequence!
++
++#endif // COMPILER_GCC
++
++#define TRAP_SEQUENCE_() \
++ do { \
++ TRAP_SEQUENCE1_(); \
++ TRAP_SEQUENCE2_(); \
++ } while (false)
++
++// CHECK() and the trap sequence can be invoked from a constexpr function.
++// This could make compilation fail on GCC, as it forbids directly using inline
++// asm inside a constexpr function. However, it allows calling a lambda
++// expression including the same asm.
++// The side effect is that the top of the stacktrace will not point to the
++// calling function, but to this anonymous lambda. This is still useful as the
++// full name of the lambda will typically include the name of the function that
++// calls CHECK() and the debugger will still break at the right line of code.
++#if !defined(COMPILER_GCC) || defined(__clang__)
++
++#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_()
++
++#else
++
++#define WRAPPED_TRAP_SEQUENCE_() \
++ do { \
++ [] { TRAP_SEQUENCE_(); }(); \
++ } while (false)
++
++#endif // !defined(COMPILER_GCC) || defined(__clang__)
++
++#if defined(__clang__) || defined(COMPILER_GCC)
++
++// __builtin_unreachable() hints to the compiler that this is noreturn and can
++// be packed in the function epilogue.
++#define IMMEDIATE_CRASH() \
++ ({ \
++ WRAPPED_TRAP_SEQUENCE_(); \
++ __builtin_unreachable(); \
++ })
++
++#else
++
++// This is supporting non-chromium user of logging.h to build with MSVC, like
++// pdfium. On MSVC there is no __builtin_unreachable().
++#define IMMEDIATE_CRASH() WRAPPED_TRAP_SEQUENCE_()
++
++#endif // defined(__clang__) || defined(COMPILER_GCC)
++
++#endif // BUILD_RUST_ALLOCATOR_IMMEDIATE_CRASH_H_
diff --git a/devel/electron36/files/patch-build_rust_allocator_lib.rs b/devel/electron36/files/patch-build_rust_allocator_lib.rs
new file mode 100644
index 000000000000..89fddf278294
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_allocator_lib.rs
@@ -0,0 +1,122 @@
+--- build/rust/allocator/lib.rs.orig 2025-05-20 09:16:26 UTC
++++ build/rust/allocator/lib.rs
+@@ -0,0 +1,119 @@
++// Copyright 2025 The Chromium Authors
++// Use of this source code is governed by a BSD-style license that can be
++// found in the LICENSE file.
++
++//! Define the allocator that Rust code in Chrome should use.
++//!
++//! Any final artifact that depends on this crate, even transitively, will use
++//! the allocator defined here.
++//!
++//! List of known issues:
++//!
++//! 1. We'd like to use PartitionAlloc on Windows, but the stdlib uses Windows
++//! heap functions directly that PartitionAlloc can not intercept.
++//! 2. We'd like `Vec::try_reserve` to fail at runtime on Linux instead of
++//! crashing in malloc() where PartitionAlloc replaces that function.
++
++// Required to apply weak linkage to symbols.
++//
++// TODO(https://crbug.com/410596442): Stop using unstable features here.
++// https://github.com/rust-lang/rust/issues/29603 tracks stabilization of the `linkage` feature.
++#![feature(linkage)]
++// Required to apply `#[rustc_std_internal_symbol]` to our alloc error handler
++// so the name is correctly mangled as rustc expects.
++//
++// TODO(https://crbug.com/410596442): Stop using internal features here.
++#![allow(internal_features)]
++#![feature(rustc_attrs)]
++
++// This module is in a separate source file to avoid having to teach `cxxbridge`
++// about conditional compilation.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod allocator_impls_ffi;
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using an allocator from C++.
++#[cfg(rust_allocator_uses_allocator_impls_h)]
++mod cpp_allocator {
++ use super::allocator_impls_ffi::ffi;
++ use std::alloc::{GlobalAlloc, Layout};
++
++ struct Allocator;
++
++ unsafe impl GlobalAlloc for Allocator {
++ unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc(layout.size(), layout.align()) }
++ }
++
++ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
++ unsafe {
++ ffi::dealloc(ptr, layout.size(), layout.align());
++ }
++ }
++
++ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
++ unsafe { ffi::alloc_zeroed(layout.size(), layout.align()) }
++ }
++
++ unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
++ unsafe { ffi::realloc(ptr, layout.size(), layout.align(), new_size) }
++ }
++ }
++
++ #[global_allocator]
++ static GLOBAL: Allocator = Allocator;
++}
++
++/// Module that provides `#[global_allocator]` / `GlobalAlloc` interface for
++/// using the default Rust allocator.
++#[cfg(not(rust_allocator_uses_allocator_impls_h))]
++mod rust_allocator {
++ #[global_allocator]
++ static GLOBAL: std::alloc::System = std::alloc::System;
++}
++
++/// Module that provides global symbols that are needed both by `cpp_allocator`
++/// and `rust_allocator`.
++///
++/// When `rustc` drives linking, then it will define the symbols below. But
++/// Chromium only uses `rustc` to link Rust-only executables (e.g. `build.rs`
++/// scripts) and otherwise uses a non-Rust linker. This is why we have to
++/// manually define a few symbols below. We define those symbols
++/// as "weak" symbols, so that Rust-provided symbols "win" in case where Rust
++/// actually does drive the linking. This hack works (not only for Chromium,
++/// but also for google3 and other projects), but isn't officially supported by
++/// `rustc`.
++///
++/// TODO(https://crbug.com/410596442): Stop using internal features here.
++mod both_allocators {
++ /// As part of rustc's contract for using `#[global_allocator]` without
++ /// rustc-generated shims we must define this symbol, since we are opting in
++ /// to unstable functionality. See https://github.com/rust-lang/rust/issues/123015
++ #[no_mangle]
++ #[linkage = "weak"]
++ static __rust_no_alloc_shim_is_unstable: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ static __rust_alloc_error_handler_should_panic: u8 = 0;
++
++ // Mangle the symbol name as rustc expects.
++ #[rustc_std_internal_symbol]
++ #[allow(non_upper_case_globals)]
++ #[linkage = "weak"]
++ fn __rust_alloc_error_handler(_size: usize, _align: usize) {
++ // TODO(lukasza): Investigate if we can just call `std::process::abort()` here.
++ // (Not really _needed_, but it could simplify code a little bit.)
++ unsafe { ffi::alloc_error_handler_impl() }
++ }
++
++ #[cxx::bridge(namespace = "rust_allocator_internal")]
++ mod ffi {
++ extern "C++" {
++ include!("build/rust/allocator/alloc_error_handler_impl.h");
++ unsafe fn alloc_error_handler_impl();
++ }
++ }
++}
diff --git a/devel/electron36/files/patch-build_rust_cargo__crate.gni b/devel/electron36/files/patch-build_rust_cargo__crate.gni
new file mode 100644
index 000000000000..a1590f727aa3
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_cargo__crate.gni
@@ -0,0 +1,25 @@
+--- build/rust/cargo_crate.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/cargo_crate.gni
+@@ -259,6 +259,12 @@ template("cargo_crate") {
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
+
++ # Don't depend on the chrome-specific #[global_allocator] crate from
++ # third-party code. This avoids some dependency cycle issues. The allocator
++ # crate will still be used if it exists anywhere in the dependency graph for
++ # a given linked artifact.
++ no_allocator_crate = true
++
+ rustc_metadata = _rustc_metadata
+
+ # TODO(crbug.com/40259764): don't default to true. This requires changes to
+@@ -482,6 +488,9 @@ template("cargo_crate") {
+
+ # Don't import the `chromium` crate into third-party code.
+ no_chromium_prelude = true
++
++ # Build scripts do not need to link to chrome's allocator.
++ no_allocator_crate = true
+
+ # The ${_build_script_name}_output target looks for the exe in this
+ # location. Due to how the Windows component build works, this has to
diff --git a/devel/electron36/files/patch-build_rust_rust__macro.gni b/devel/electron36/files/patch-build_rust_rust__macro.gni
new file mode 100644
index 000000000000..0dafc3819aa1
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_rust__macro.gni
@@ -0,0 +1,12 @@
+--- build/rust/rust_macro.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_macro.gni
+@@ -16,6 +16,9 @@ template("rust_macro") {
+ forward_variables_from(invoker, TESTONLY_AND_VISIBILITY)
+ proc_macro_configs = invoker.configs
+ target_type = "rust_proc_macro"
++
++ # Macros are loaded by rustc and shouldn't use chrome's allocation routines.
++ no_allocator_crate = true
+ }
+ }
+
diff --git a/devel/electron36/files/patch-build_rust_rust__target.gni b/devel/electron36/files/patch-build_rust_rust__target.gni
new file mode 100644
index 000000000000..f4ad6f04fc45
--- /dev/null
+++ b/devel/electron36/files/patch-build_rust_rust__target.gni
@@ -0,0 +1,13 @@
+--- build/rust/rust_target.gni.orig 2025-05-20 09:16:26 UTC
++++ build/rust/rust_target.gni
+@@ -339,6 +339,10 @@ template("rust_target") {
+ _rust_deps += [ "//build/rust/std" ]
+ }
+
++ if (!defined(invoker.no_allocator_crate) || !invoker.no_allocator_crate) {
++ _rust_deps += [ "//build/rust/allocator" ]
++ }
++
+ if (_build_unit_tests) {
+ _unit_test_target = "${_target_name}_unittests"
+ if (defined(invoker.unit_test_target)) {
diff --git a/devel/electron36/files/patch-build_rust_std_BUILD.gn b/devel/electron36/files/patch-build_rust_std_BUILD.gn
index 0a5335d58d48..c6c2801bd47d 100644
--- a/devel/electron36/files/patch-build_rust_std_BUILD.gn
+++ b/devel/electron36/files/patch-build_rust_std_BUILD.gn
@@ -1,6 +1,58 @@
---- build/rust/std/BUILD.gn.orig 2025-04-05 13:54:50 UTC
+--- build/rust/std/BUILD.gn.orig 2025-05-20 09:16:26 UTC
+++ build/rust/std/BUILD.gn
-@@ -89,13 +89,20 @@ if (toolchain_has_rust) {
+@@ -15,51 +15,12 @@
+ # allocator functions to PartitionAlloc when `use_partition_alloc_as_malloc` is
+ # true, so that Rust and C++ use the same allocator backend.
+
+-import("//build/buildflag_header.gni")
+ import("//build/config/compiler/compiler.gni")
+ import("//build/config/coverage/coverage.gni")
+ import("//build/config/rust.gni")
+ import("//build/config/sanitizers/sanitizers.gni")
+
+-rust_allocator_uses_partition_alloc = false
+-if (build_with_chromium) {
+- import("//base/allocator/partition_allocator/partition_alloc.gni")
+- rust_allocator_uses_partition_alloc = use_partition_alloc_as_malloc
+-}
+-
+-buildflag_header("buildflags") {
+- header = "buildflags.h"
+- flags = [
+- "RUST_ALLOCATOR_USES_PARTITION_ALLOC=$rust_allocator_uses_partition_alloc",
+- ]
+- visibility = [ ":*" ]
+-}
+-
+ if (toolchain_has_rust) {
+- # If clang performs the link step, we need to provide the allocator symbols
+- # that are normally injected by rustc during linking.
+- #
+- # We also "happen to" use this to redirect allocations to PartitionAlloc,
+- # though that would be better done through a #[global_allocator] crate (see
+- # above).
+- source_set("remap_alloc") {
+- public_deps = []
+- if (rust_allocator_uses_partition_alloc) {
+- public_deps += [ "//base/allocator/partition_allocator:partition_alloc" ]
+- }
+- deps = [ ":buildflags" ]
+- sources = [
+- # `alias.*`, `compiler_specific.h`, and `immediate_crash.*` have been
+- # copied from `//base`.
+- # TODO(crbug.com/40279749): Avoid duplication / reuse code.
+- "alias.cc",
+- "alias.h",
+- "compiler_specific.h",
+- "immediate_crash.h",
+- "remap_alloc.cc",
+- ]
+- }
+-
+ # List of Rust stdlib rlibs which are present in the official Rust toolchain
+ # we are using from the Android team. This is usually a version or two behind
+ # nightly. Generally this matches the toolchain we build ourselves, but if
+@@ -89,13 +50,20 @@ if (toolchain_has_rust) {
# These are no longer present in the Windows toolchain.
stdlib_files += [
"addr2line",
@@ -22,7 +74,7 @@
}
if (toolchain_for_rust_host_build_tools) {
-@@ -115,7 +122,6 @@ if (toolchain_has_rust) {
+@@ -115,7 +83,6 @@ if (toolchain_has_rust) {
# don't need to pass to the C++ linker because they're used for specialized
# purposes.
skip_stdlib_files = [
@@ -30,3 +82,25 @@
"rustc_std_workspace_alloc",
"rustc_std_workspace_core",
"rustc_std_workspace_std",
+@@ -269,8 +236,6 @@ if (toolchain_has_rust) {
+ foreach(libname, stdlib_files + skip_stdlib_files) {
+ deps += [ "rules:$libname" ]
+ }
+-
+- public_deps = [ ":remap_alloc" ]
+ }
+ } else {
+ action("find_stdlib") {
+@@ -396,12 +361,6 @@ if (toolchain_has_rust) {
+ ":stdlib_public_dependent_libs",
+ ]
+ deps = [ ":prebuilt_rustc_copy_to_sysroot" ]
+-
+- # The host builds tools toolchain supports Rust only and does not use
+- # the allocator remapping to point it to PartitionAlloc.
+- if (!toolchain_for_rust_host_build_tools) {
+- deps += [ ":remap_alloc" ]
+- }
+ }
+ }
+ }
diff --git a/devel/esbuild/Makefile b/devel/esbuild/Makefile
index ef8490f708f2..5a5cf1e28b34 100644
--- a/devel/esbuild/Makefile
+++ b/devel/esbuild/Makefile
@@ -1,7 +1,7 @@
PORTNAME= esbuild
DISTVERSIONPREFIX= v
DISTVERSION= 0.25.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel www
# also bump & test ESBUILD_VERSION in net-im/signal-desktop
diff --git a/devel/etcd/Makefile b/devel/etcd/Makefile
index c57df4aa32fe..f4c8c1198146 100644
--- a/devel/etcd/Makefile
+++ b/devel/etcd/Makefile
@@ -1,7 +1,7 @@
PORTNAME= etcd
PORTVERSION= 2.3.8
DISTVERSIONPREFIX= v
-PORTREVISION= 30
+PORTREVISION= 31
CATEGORIES= devel
PKGNAMEPREFIX= coreos-
diff --git a/devel/etcd31/Makefile b/devel/etcd31/Makefile
index 72475ad72f14..bac43d1dfae4 100644
--- a/devel/etcd31/Makefile
+++ b/devel/etcd31/Makefile
@@ -1,7 +1,7 @@
PORTNAME= etcd
PORTVERSION= 3.1.20
DISTVERSIONPREFIX= v
-PORTREVISION= 29
+PORTREVISION= 30
CATEGORIES= devel
PKGNAMEPREFIX= coreos-
PKGNAMESUFFIX= 31
diff --git a/devel/etcd32/Makefile b/devel/etcd32/Makefile
index 7f16a7befee4..e4dc6d3bd60e 100644
--- a/devel/etcd32/Makefile
+++ b/devel/etcd32/Makefile
@@ -1,7 +1,7 @@
PORTNAME= etcd
PORTVERSION= 3.2.32
DISTVERSIONPREFIX= v
-PORTREVISION= 27
+PORTREVISION= 28
CATEGORIES= devel
PKGNAMEPREFIX= coreos-
PKGNAMESUFFIX= 32
diff --git a/devel/etcd33/Makefile b/devel/etcd33/Makefile
index 32e9c747b05f..d7ff157672ac 100644
--- a/devel/etcd33/Makefile
+++ b/devel/etcd33/Makefile
@@ -1,7 +1,7 @@
PORTNAME= etcd
PORTVERSION= 3.3.23
DISTVERSIONPREFIX= v
-PORTREVISION= 26
+PORTREVISION= 27
CATEGORIES= devel
PKGNAMEPREFIX= coreos-
PKGNAMESUFFIX= 33
diff --git a/devel/gh/Makefile b/devel/gh/Makefile
index e0bd9eed629a..76d3fc64ca0c 100644
--- a/devel/gh/Makefile
+++ b/devel/gh/Makefile
@@ -1,6 +1,6 @@
PORTNAME= gh
DISTVERSIONPREFIX= v
-DISTVERSION= 2.72.0
+DISTVERSION= 2.73.0
CATEGORIES= devel
MAINTAINER= dutra@FreeBSD.org
diff --git a/devel/gh/distinfo b/devel/gh/distinfo
index 4e9a65fb2cdc..9efecf2627d4 100644
--- a/devel/gh/distinfo
+++ b/devel/gh/distinfo
@@ -1,5 +1,5 @@
-TIMESTAMP = 1746280225
-SHA256 (go/devel_gh/gh-v2.72.0/v2.72.0.mod) = 825b51a7bf3c0d79f96631e05b688bd271b2c03763d2239c5ba5d2b29d047cc4
-SIZE (go/devel_gh/gh-v2.72.0/v2.72.0.mod) = 9309
-SHA256 (go/devel_gh/gh-v2.72.0/v2.72.0.zip) = 71dbbdd3403085c707a31a1c147c3718444bfb75461fa7838ed036be3a4e1c24
-SIZE (go/devel_gh/gh-v2.72.0/v2.72.0.zip) = 13635896
+TIMESTAMP = 1747848726
+SHA256 (go/devel_gh/gh-v2.73.0/v2.73.0.mod) = 0f5c8efc347eba04e49d52546c60ed88082c08318c630ddc3b06769cc3864106
+SIZE (go/devel_gh/gh-v2.73.0/v2.73.0.mod) = 9309
+SHA256 (go/devel_gh/gh-v2.73.0/v2.73.0.zip) = 8d51f212bf76fd4b9c5d4c75e8a1438e92ed1b475b5deb8191bd89dc1d83c3a9
+SIZE (go/devel_gh/gh-v2.73.0/v2.73.0.zip) = 13649447
diff --git a/devel/ghq/Makefile b/devel/ghq/Makefile
index 6f8bbdf54af8..6cfdbae05353 100644
--- a/devel/ghq/Makefile
+++ b/devel/ghq/Makefile
@@ -1,7 +1,7 @@
PORTNAME= ghq
DISTVERSIONPREFIX= v
DISTVERSION= 1.7.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel
MAINTAINER= driesm@FreeBSD.org
diff --git a/devel/git-bug/Makefile b/devel/git-bug/Makefile
index d51d9f4fd6a8..b36be76727ef 100644
--- a/devel/git-bug/Makefile
+++ b/devel/git-bug/Makefile
@@ -1,7 +1,7 @@
PORTNAME= git-bug
DISTVERSIONPREFIX= v
DISTVERSION= 0.8.0
-PORTREVISION= 13
+PORTREVISION= 14
CATEGORIES= devel
MAINTAINER= lcook@FreeBSD.org
diff --git a/devel/git-codereview/Makefile b/devel/git-codereview/Makefile
index 985a93df1009..e12a96b7403f 100644
--- a/devel/git-codereview/Makefile
+++ b/devel/git-codereview/Makefile
@@ -1,6 +1,7 @@
PORTNAME= git-codereview
DISTVERSIONPREFIX= v
DISTVERSION= 1.15.0
+PORTREVISION= 1
CATEGORIES= devel
MAINTAINER= bofh@FreeBSD.org
diff --git a/devel/git-lfs/Makefile b/devel/git-lfs/Makefile
index a730d1bd6ee6..247081e618f7 100644
--- a/devel/git-lfs/Makefile
+++ b/devel/git-lfs/Makefile
@@ -1,7 +1,7 @@
PORTNAME= git-lfs
DISTVERSIONPREFIX= v
DISTVERSION= 3.6.1
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel
MASTER_SITES= https://github.com/${PORTNAME}/${PORTNAME}/releases/download/v${DISTVERSION}/
diff --git a/devel/gitty/Makefile b/devel/gitty/Makefile
index e2d4ed4a6031..ad05ba7ffca8 100644
--- a/devel/gitty/Makefile
+++ b/devel/gitty/Makefile
@@ -1,7 +1,7 @@
PORTNAME= gitty
DISTVERSIONPREFIX= v
DISTVERSION= 0.7.0
-PORTREVISION= 19
+PORTREVISION= 20
CATEGORIES= devel
MAINTAINER= dch@FreeBSD.org
diff --git a/devel/gllvm/Makefile b/devel/gllvm/Makefile
index 5b67b497563a..491290168049 100644
--- a/devel/gllvm/Makefile
+++ b/devel/gllvm/Makefile
@@ -1,7 +1,7 @@
PORTNAME= gllvm
DISTVERSIONPREFIX= v
DISTVERSION= 1.3.1
-PORTREVISION= 19
+PORTREVISION= 20
CATEGORIES= devel
MAINTAINER= arrowd@FreeBSD.org
diff --git a/devel/go-bindata-assetfs/Makefile b/devel/go-bindata-assetfs/Makefile
index 2fa83edfbb3f..aee47871dd50 100644
--- a/devel/go-bindata-assetfs/Makefile
+++ b/devel/go-bindata-assetfs/Makefile
@@ -1,7 +1,7 @@
PORTNAME= go-bindata-assetfs
DISTVERSIONPREFIX= v
DISTVERSION= 1.0.1
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel www
MAINTAINER= egypcio@FreeBSD.org
diff --git a/devel/go-bindata/Makefile b/devel/go-bindata/Makefile
index b3c209ab047d..7b05739eb7cc 100644
--- a/devel/go-bindata/Makefile
+++ b/devel/go-bindata/Makefile
@@ -1,7 +1,7 @@
PORTNAME= go-bindata
PORTVERSION= 3.1.3
DISTVERSIONPREFIX= v
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= bofh@FreeBSD.org
diff --git a/devel/go-git/Makefile b/devel/go-git/Makefile
index 71594c745a98..2c231ef0e850 100644
--- a/devel/go-git/Makefile
+++ b/devel/go-git/Makefile
@@ -1,7 +1,7 @@
PORTNAME= go-git
DISTVERSIONPREFIX= v
DISTVERSION= 5.10.0
-PORTREVISION= 10
+PORTREVISION= 11
CATEGORIES= devel
MAINTAINER= ports@FreeBSD.org
diff --git a/devel/go-perf/Makefile b/devel/go-perf/Makefile
index 3a7bcc1ff7ec..66e47e8f7103 100644
--- a/devel/go-perf/Makefile
+++ b/devel/go-perf/Makefile
@@ -1,7 +1,7 @@
PORTNAME= go-perf
PORTVERSION= ${MODVERSION:S/-/./g:R}
DISTVERSIONPREFIX= v
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel
MAINTAINER= fuz@FreeBSD.org
diff --git a/devel/go-wire/Makefile b/devel/go-wire/Makefile
index 62b26587ef89..6dde486a430b 100644
--- a/devel/go-wire/Makefile
+++ b/devel/go-wire/Makefile
@@ -1,7 +1,7 @@
PORTNAME= wire
DISTVERSIONPREFIX= v
DISTVERSION= 0.6.0
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= devel
PKGNAMEPREFIX= go-
diff --git a/devel/gocheese/Makefile b/devel/gocheese/Makefile
index 52b12b134f8e..31d22f17d02d 100644
--- a/devel/gocheese/Makefile
+++ b/devel/gocheese/Makefile
@@ -1,6 +1,6 @@
PORTNAME= gocheese
DISTVERSION= 4.2.0
-PORTREVISION= 9
+PORTREVISION= 10
CATEGORIES= devel python
MASTER_SITES= http://www.gocheese.cypherpunks.ru/download/
diff --git a/devel/gocritic/Makefile b/devel/gocritic/Makefile
index d92a870a7390..040b1aaaf70a 100644
--- a/devel/gocritic/Makefile
+++ b/devel/gocritic/Makefile
@@ -1,6 +1,7 @@
PORTNAME= gocritic
DISTVERSIONPREFIX= v
DISTVERSION= 0.13.0
+PORTREVISION= 1
CATEGORIES= devel
MAINTAINER= fuz@FreeBSD.org
diff --git a/devel/gogs/Makefile b/devel/gogs/Makefile
index e28111da2929..744765c0a5c8 100644
--- a/devel/gogs/Makefile
+++ b/devel/gogs/Makefile
@@ -1,7 +1,7 @@
PORTNAME= gogs
DISTVERSIONPREFIX= v
DISTVERSION= 0.12.11
-PORTREVISION= 14
+PORTREVISION= 15
CATEGORIES= devel www
MAINTAINER= ports@FreeBSD.org
diff --git a/devel/golint/Makefile b/devel/golint/Makefile
index e5d0a7ee7b0a..5e10ee707fd9 100644
--- a/devel/golint/Makefile
+++ b/devel/golint/Makefile
@@ -1,6 +1,6 @@
PORTNAME= golint
PORTVERSION= g20190409
-PORTREVISION= 25
+PORTREVISION= 26
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/goprotobuf/Makefile b/devel/goprotobuf/Makefile
index 6b5cb76c4e33..ab02d9814f76 100644
--- a/devel/goprotobuf/Makefile
+++ b/devel/goprotobuf/Makefile
@@ -1,7 +1,7 @@
PORTNAME= goprotobuf
DISTVERSIONPREFIX= v
DISTVERSION= 1.5.4
-PORTREVISION= 8
+PORTREVISION= 9
PORTEPOCH= 1
CATEGORIES= devel
diff --git a/devel/goredo/Makefile b/devel/goredo/Makefile
index bcfff8a65cd5..a3d3484bb0e7 100644
--- a/devel/goredo/Makefile
+++ b/devel/goredo/Makefile
@@ -1,6 +1,6 @@
PORTNAME= goredo
DISTVERSION= 2.6.4
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel
MASTER_SITES= http://www.goredo.cypherpunks.su/download/
diff --git a/devel/goreleaser/Makefile b/devel/goreleaser/Makefile
index eac78b05cf39..aee3e18bcd10 100644
--- a/devel/goreleaser/Makefile
+++ b/devel/goreleaser/Makefile
@@ -1,6 +1,7 @@
PORTNAME= goreleaser
DISTVERSIONPREFIX= v
DISTVERSION= 2.9.0
+PORTREVISION= 1
CATEGORIES= devel
MAINTAINER= fuz@FreeBSD.org
diff --git a/devel/goswagger/Makefile b/devel/goswagger/Makefile
index bc072ef9e235..978ce3336b54 100644
--- a/devel/goswagger/Makefile
+++ b/devel/goswagger/Makefile
@@ -1,7 +1,7 @@
PORTNAME= goswagger
DISTVERSIONPREFIX= v
DISTVERSION= 0.30.4
-PORTREVISION= 16
+PORTREVISION= 17
CATEGORIES= devel
MAINTAINER= ports@FreeBSD.org
diff --git a/devel/gpm/Makefile b/devel/gpm/Makefile
index 152e8bfebff3..567c40940082 100644
--- a/devel/gpm/Makefile
+++ b/devel/gpm/Makefile
@@ -1,7 +1,7 @@
PORTNAME= gpm
PORTVERSION= 1.4.0
DISTVERSIONPREFIX= v
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= lukejee@gmail.com
diff --git a/devel/gvp/Makefile b/devel/gvp/Makefile
index 30849c539716..f6dbbc42a3c3 100644
--- a/devel/gvp/Makefile
+++ b/devel/gvp/Makefile
@@ -1,7 +1,7 @@
PORTNAME= gvp
PORTVERSION= 0.3.0
DISTVERSIONPREFIX= v
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= lukejee@gmail.com
diff --git a/devel/hub/Makefile b/devel/hub/Makefile
index 29f6d41909d3..165512ed6255 100644
--- a/devel/hub/Makefile
+++ b/devel/hub/Makefile
@@ -1,7 +1,7 @@
PORTNAME= hub
PORTVERSION= 2.14.2
DISTVERSIONPREFIX= v
-PORTREVISION= 26
+PORTREVISION= 27
CATEGORIES= devel sysutils
MAINTAINER= egypcio@FreeBSD.org
diff --git a/devel/influx-pkg-config/Makefile b/devel/influx-pkg-config/Makefile
index 2399f66a472c..7c632c4593fb 100644
--- a/devel/influx-pkg-config/Makefile
+++ b/devel/influx-pkg-config/Makefile
@@ -1,7 +1,7 @@
PORTNAME= pkg-config
DISTVERSIONPREFIX= v
DISTVERSION= 0.2.14
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
PKGNAMEPREFIX= influx
diff --git a/devel/jiri/Makefile b/devel/jiri/Makefile
index da8e46ded736..54af2fc5bb7b 100644
--- a/devel/jiri/Makefile
+++ b/devel/jiri/Makefile
@@ -1,6 +1,6 @@
PORTNAME= jiri
PORTVERSION= g${TIMESTAMP:S/-/./g:C/T.*//g}
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MASTER_SITES= LOCAL/swills
DISTFILES= ${PORTNAME}-${PORTVERSION}${EXTRACT_SUFX}
diff --git a/devel/lab/Makefile b/devel/lab/Makefile
index 50cf39a1479a..007c32407657 100644
--- a/devel/lab/Makefile
+++ b/devel/lab/Makefile
@@ -1,7 +1,7 @@
PORTNAME= lab
PORTVERSION= ${MODVERSION:S/-/./g:R}
DISTVERSIONPREFIX= v
-PORTREVISION= 14
+PORTREVISION= 15
CATEGORIES= devel
MAINTAINER= bofh@FreeBSD.org
diff --git a/devel/lets/Makefile b/devel/lets/Makefile
index b9181bb10aaa..dcce2c486d62 100644
--- a/devel/lets/Makefile
+++ b/devel/lets/Makefile
@@ -1,7 +1,7 @@
PORTNAME= lets
DISTVERSIONPREFIX= v
DISTVERSION= 0.0.54
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/libchdr/Makefile b/devel/libchdr/Makefile
index 3a1711fdc544..833df5fb89a1 100644
--- a/devel/libchdr/Makefile
+++ b/devel/libchdr/Makefile
@@ -1,5 +1,5 @@
PORTNAME= libchdr
-DISTVERSION= g20241211
+DISTVERSION= g20250522
CATEGORIES= devel
MAINTAINER= bsdcode@disroot.org
@@ -14,11 +14,13 @@ LIB_DEPENDS= libzstd.so:archivers/zstd
USES= cmake pathfix
USE_GITHUB= yes
GH_ACCOUNT= rtissera
-GH_TAGNAME= cb077337d53392454e7100a0fd07139ca678e527
+GH_TAGNAME= 40f96ee322971eedf2a16bdab6727daa861e8626
USE_LDCONFIG= yes
CMAKE_ARGS= -DBUILD_LTO=${defined(WITH_LTO):?ON:OFF}
-CMAKE_ON= INSTALL_STATIC_LIBS WITH_SYSTEM_ZLIB WITH_SYSTEM_ZSTD
+CMAKE_ON= INSTALL_STATIC_LIBS \
+ WITH_SYSTEM_ZLIB \
+ WITH_SYSTEM_ZSTD
EXTRACT_AFTER_ARGS= --exclude deps/zlib* --exclude deps/zstd* \
--no-same-owner --no-same-permissions
diff --git a/devel/libchdr/distinfo b/devel/libchdr/distinfo
index b2b8f453e2ac..57e12bc37e06 100644
--- a/devel/libchdr/distinfo
+++ b/devel/libchdr/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1735293098
-SHA256 (rtissera-libchdr-g20241211-cb077337d53392454e7100a0fd07139ca678e527_GH0.tar.gz) = 7c612f4b879295bf82d0dc481c0c055fc1cceefe56b5dea1b094b0dde0952392
-SIZE (rtissera-libchdr-g20241211-cb077337d53392454e7100a0fd07139ca678e527_GH0.tar.gz) = 4222519
+TIMESTAMP = 1747910945
+SHA256 (rtissera-libchdr-g20250522-40f96ee322971eedf2a16bdab6727daa861e8626_GH0.tar.gz) = c2dbda74db4a75055c1705cceb69d624be23c4bfa938c8f950a4f1b31d71be3f
+SIZE (rtissera-libchdr-g20250522-40f96ee322971eedf2a16bdab6727daa861e8626_GH0.tar.gz) = 4222469
diff --git a/devel/linenoise-ng/Makefile b/devel/linenoise-ng/Makefile
index 339205a2b7bb..3a6645e512ef 100644
--- a/devel/linenoise-ng/Makefile
+++ b/devel/linenoise-ng/Makefile
@@ -10,6 +10,9 @@ WWW= https://github.com/arangodb/linenoise-ng
LICENSE= BSD3CLAUSE
LICENSE_FILE= ${WRKSRC}/LICENSE
+DEPRECATED= Upstream repo archived Oct 28, 2020
+EXPIRATION_DATE=2025-06-30
+
USES= cmake compiler:c++11-lang
USE_LDCONFIG= yes
diff --git a/devel/liteide/Makefile b/devel/liteide/Makefile
index a2fc429c8a34..c41c38dc528a 100644
--- a/devel/liteide/Makefile
+++ b/devel/liteide/Makefile
@@ -1,7 +1,7 @@
PORTNAME= liteide
DISTVERSIONPREFIX= x
DISTVERSION= 38.2
-PORTREVISION= 14
+PORTREVISION= 15
CATEGORIES= devel editors
MAINTAINER= ports@FreeBSD.org
diff --git a/devel/loccount/Makefile b/devel/loccount/Makefile
index d667b60f9d2e..f6faf2002f2c 100644
--- a/devel/loccount/Makefile
+++ b/devel/loccount/Makefile
@@ -1,6 +1,6 @@
PORTNAME= loccount
DISTVERSION= 2.16
-PORTREVISION= 8
+PORTREVISION= 9
CATEGORIES= devel
MASTER_SITES= http://www.catb.org/~esr/loccount/
diff --git a/devel/mage/Makefile b/devel/mage/Makefile
index 2ff130c9f13d..c3679264823c 100644
--- a/devel/mage/Makefile
+++ b/devel/mage/Makefile
@@ -1,7 +1,7 @@
PORTNAME= mage
DISTVERSIONPREFIX= v
DISTVERSION= 1.15.0
-PORTREVISION= 11
+PORTREVISION= 12
PORTEPOCH= 1
CATEGORIES= devel
diff --git a/devel/modd/Makefile b/devel/modd/Makefile
index 1d70019c5fa2..cb810ed07b0a 100644
--- a/devel/modd/Makefile
+++ b/devel/modd/Makefile
@@ -1,7 +1,7 @@
PORTNAME= modd
DISTVERSIONPREFIX= v
DISTVERSION= 0.8
-PORTREVISION= 27
+PORTREVISION= 28
CATEGORIES= devel sysutils
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/mutagen/Makefile b/devel/mutagen/Makefile
index bb57f1722c0e..d2eee458e5be 100644
--- a/devel/mutagen/Makefile
+++ b/devel/mutagen/Makefile
@@ -1,7 +1,7 @@
PORTNAME= mutagen
DISTVERSIONPREFIX= v
DISTVERSION= 0.18.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel net
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/packr/Makefile b/devel/packr/Makefile
index 1d210a01dac7..e2fda1aae161 100644
--- a/devel/packr/Makefile
+++ b/devel/packr/Makefile
@@ -1,7 +1,7 @@
PORTNAME= packr
DISTVERSIONPREFIX= v
DISTVERSION= 2.8.3
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= ports@FreeBSD.org
diff --git a/devel/prototool/Makefile b/devel/prototool/Makefile
index 3621fe166427..8ddf5adc1f7e 100644
--- a/devel/prototool/Makefile
+++ b/devel/prototool/Makefile
@@ -1,7 +1,7 @@
PORTNAME= prototool
DISTVERSIONPREFIX= v
DISTVERSION= 1.10.0
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= yuri@FreeBSD.org
diff --git a/devel/py-types-jsonschema/Makefile b/devel/py-types-jsonschema/Makefile
index 7e3ea744b61c..bd8876aa5b58 100644
--- a/devel/py-types-jsonschema/Makefile
+++ b/devel/py-types-jsonschema/Makefile
@@ -1,6 +1,5 @@
PORTNAME= types-jsonschema
-PORTVERSION= 4.23.0.20241208
-PORTREVISION= 1
+PORTVERSION= 4.23.0.20250516
CATEGORIES= devel python
MASTER_SITES= PYPI
PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-types-jsonschema/distinfo b/devel/py-types-jsonschema/distinfo
index 9be75d0613ee..c3266f2e0dc7 100644
--- a/devel/py-types-jsonschema/distinfo
+++ b/devel/py-types-jsonschema/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1735662785
-SHA256 (types_jsonschema-4.23.0.20241208.tar.gz) = e8b15ad01f290ecf6aea53f93fbdf7d4730e4600313e89e8a7f95622f7e87b7c
-SIZE (types_jsonschema-4.23.0.20241208.tar.gz) = 14770
+TIMESTAMP = 1747915536
+SHA256 (types_jsonschema-4.23.0.20250516.tar.gz) = 9ace09d9d35c4390a7251ccd7d833b92ccc189d24d1b347f26212afce361117e
+SIZE (types_jsonschema-4.23.0.20250516.tar.gz) = 14911
diff --git a/devel/py-types-jsonschema/files/patch-pyproject.toml b/devel/py-types-jsonschema/files/patch-pyproject.toml
new file mode 100644
index 000000000000..5b7d74e2c6d1
--- /dev/null
+++ b/devel/py-types-jsonschema/files/patch-pyproject.toml
@@ -0,0 +1,23 @@
+--- pyproject.toml.orig 2025-05-22 12:06:21 UTC
++++ pyproject.toml
+@@ -1,12 +1,11 @@ build-backend = "setuptools.build_meta"
+ [build-system]
+ build-backend = "setuptools.build_meta"
+-requires = ["setuptools>=77.0.3"]
++requires = ["setuptools>=61"]
+
+ [project]
+ name = "types-jsonschema"
+ version = "4.23.0.20250516"
+-license = "Apache-2.0"
+-license-files = ["LICENSE"]
++license = { text = "Apache-2.0" }
+ description = "Typing stubs for jsonschema"
+ readme = { text = """\
+ ## Typing stubs for jsonschema
+@@ -55,5 +54,4 @@ dependencies = ['referencing']
+ "Chat" = "https://gitter.im/python/typing"
+
+ [tool.setuptools]
+-packages = ['jsonschema-stubs']
+ include-package-data = false
diff --git a/devel/scc/Makefile b/devel/scc/Makefile
index ec94baf597e2..4c86c1bd7d01 100644
--- a/devel/scc/Makefile
+++ b/devel/scc/Makefile
@@ -1,7 +1,7 @@
PORTNAME= scc
DISTVERSIONPREFIX= v
DISTVERSION= 3.5.0
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= devel
MAINTAINER= adamw@FreeBSD.org
diff --git a/devel/shfmt/Makefile b/devel/shfmt/Makefile
index 5c65096d6fa3..a7a14c171057 100644
--- a/devel/shfmt/Makefile
+++ b/devel/shfmt/Makefile
@@ -1,7 +1,7 @@
PORTNAME= shfmt
DISTVERSIONPREFIX= v
DISTVERSION= 3.11.0
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= devel
MAINTAINER= adamw@FreeBSD.org
diff --git a/devel/soft-serve/Makefile b/devel/soft-serve/Makefile
index aafb7406c6ac..db44e4c18fab 100644
--- a/devel/soft-serve/Makefile
+++ b/devel/soft-serve/Makefile
@@ -1,7 +1,7 @@
PORTNAME= soft-serve
DISTVERSIONPREFIX= v
DISTVERSION= 0.7.6
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= devel
MAINTAINER= ashish@FreeBSD.org
diff --git a/devel/statik/Makefile b/devel/statik/Makefile
index 9932a3f9c73f..6ed7743d01f5 100644
--- a/devel/statik/Makefile
+++ b/devel/statik/Makefile
@@ -1,7 +1,7 @@
PORTNAME= statik
DISTVERSIONPREFIX= v
DISTVERSION= 0.1.2
-PORTREVISION= 25
+PORTREVISION= 26
PORTEPOCH= 1
CATEGORIES= devel
diff --git a/devel/stuffbin/Makefile b/devel/stuffbin/Makefile
index 179d847a3436..b900a22a615a 100644
--- a/devel/stuffbin/Makefile
+++ b/devel/stuffbin/Makefile
@@ -1,7 +1,7 @@
PORTNAME= stuffbin
DISTVERSIONPREFIX= v
DISTVERSION= 1.3.0
-PORTREVISION= 9
+PORTREVISION= 10
CATEGORIES= devel
MAINTAINER= lcook@FreeBSD.org
diff --git a/devel/taskctl/Makefile b/devel/taskctl/Makefile
index 1e2ad472522f..07609f9ec149 100644
--- a/devel/taskctl/Makefile
+++ b/devel/taskctl/Makefile
@@ -1,6 +1,6 @@
PORTNAME= taskctl
PORTVERSION= 1.4.2
-PORTREVISION= 25
+PORTREVISION= 26
CATEGORIES= devel
MAINTAINER= olgeni@FreeBSD.org
diff --git a/devel/tinygo/Makefile b/devel/tinygo/Makefile
index 1bb9a843c810..142190d38f85 100644
--- a/devel/tinygo/Makefile
+++ b/devel/tinygo/Makefile
@@ -1,7 +1,7 @@
PORTNAME= tinygo
DISTVERSIONPREFIX= v
DISTVERSION= 0.19.0
-PORTREVISION= 24
+PORTREVISION= 25
CATEGORIES= devel
MAINTAINER= ports@FreeBSD.org
diff --git a/devel/venom/Makefile b/devel/venom/Makefile
index c0998794b9f1..40b074eb0637 100644
--- a/devel/venom/Makefile
+++ b/devel/venom/Makefile
@@ -1,7 +1,7 @@
PORTNAME= venom
DISTVERSIONPREFIX= v
DISTVERSION= 1.2.0
-PORTREVISION= 8
+PORTREVISION= 9
CATEGORIES= devel
MAINTAINER= bapt@FreeBSD.org
diff --git a/devel/yaegi/Makefile b/devel/yaegi/Makefile
index 2ae86d58bd1c..f2f654be48c0 100644
--- a/devel/yaegi/Makefile
+++ b/devel/yaegi/Makefile
@@ -1,7 +1,7 @@
PORTNAME= yaegi
DISTVERSION= 0.15.1
DISTVERSIONPREFIX= v
-PORTREVISION= 12
+PORTREVISION= 13
CATEGORIES= devel
MAINTAINER= dch@FreeBSD.org
diff --git a/devel/zls/Makefile b/devel/zls/Makefile
index cdab079fa984..a9315e4a3d0e 100644
--- a/devel/zls/Makefile
+++ b/devel/zls/Makefile
@@ -1,9 +1,6 @@
PORTNAME= zls
-DISTVERSION= 0.13.0
+DISTVERSION= 0.14.0
CATEGORIES= devel
-MASTER_SITES= https://raw.githubusercontent.com/ziglang/:langref
-DISTFILES= zig/${DISTVERSION}/doc/langref.html.in:langref
-EXTRACT_ONLY= ${DISTFILES:N*\:langref:C/\:.*//}
MAINTAINER= jbeich@FreeBSD.org
COMMENT= Zig LSP implementation + Zig Language Server
@@ -12,20 +9,19 @@ WWW= https://github.com/zigtools/zls
LICENSE= MIT
LICENSE_FILE= ${WRKSRC}/LICENSE
-BUILD_DEPENDS= zig>=0.13.0:lang/zig
+BUILD_DEPENDS= zig>=0.14.0:lang/zig
RUN_DEPENDS= zig:lang/zig
USE_GITHUB= yes
GH_ACCOUNT= zigtools
-GH_TUPLE= wolfpld:tracy:v0.10:tracy/src/tracy \
- ziglibs:diffz:ef45c00:diffz/../.cache/zig/p/1220102cb2c669d82184fb1dc5380193d37d68b54e8d75b76b2d155b9af7d7e2e76d \
- ziglibs:known-folders:0.7.0-35-g0ad514d:known_folders/../.cache/zig/p/12209cde192558f8b3dc098ac2330fc2a14fdd211c5433afd33085af75caa9183147
+GH_TUPLE= wolfpld:tracy:v0.11.1:tracy/../.cache/zig/p/N-V-__8AAMeOlQEipHjcyu0TCftdAi9AQe7EXUDJOoVe0k-t \
+ ziglibs:diffz:ef45c00:diffz/../.cache/zig/p/N-V-__8AABhrAQAQLLLGadghhPsdxTgBk9N9aLVOjXW3ay0V \
+ ziglibs:known-folders:0.7.0-57-gaa24df4:known_folders/../.cache/zig/p/known_folders-0.0.0-Fy-PJtLDAADGDOwYwMkVydMSTp_aN-nfjCZw6qPQ2ECL \
+ zigtools:zig-lsp-codegen:063a98c:zig_lsp_codegen/../.cache/zig/p/lsp_codegen-0.1.0-CMjjo0ZXCQB-rAhPYrlfzzpU0u0u2MeGvUucZ-_g32eg
MAKE_ENV= DESTDIR="${STAGEDIR}"
CONFIGURE_ARGS= --prefix "${PREFIX}" \
${WITH_DEBUG:D:U-Doptimize=ReleaseFast} \
-Dcpu=${CPUTYPE:Ubaseline} \
- -Ddata_version=${DISTVERSION} \
- -Dversion_data_path=${DISTFILES:M*\:langref:C/\:.*//:S,^,${_DISTDIR},} \
--verbose
NO_INSTALL= yes # strip(1) breaks runtime
PLIST_FILES= bin/${PORTNAME}
diff --git a/devel/zls/distinfo b/devel/zls/distinfo
index 9a39a28628ee..ef1d6a1782b6 100644
--- a/devel/zls/distinfo
+++ b/devel/zls/distinfo
@@ -1,11 +1,11 @@
-TIMESTAMP = 1717891507
-SHA256 (zig/0.13.0/doc/langref.html.in) = 5d43f599f56a1ee0246958552545d13ee4ddeb7c705c05a432554d5eff6e1902
-SIZE (zig/0.13.0/doc/langref.html.in) = 336139
-SHA256 (zigtools-zls-0.13.0_GH0.tar.gz) = 2e8046b6b0de765a4bf4bb828345e2badc8b828bc257dc931d0f56b147684d9f
-SIZE (zigtools-zls-0.13.0_GH0.tar.gz) = 352025
-SHA256 (wolfpld-tracy-v0.10_GH0.tar.gz) = a76017d928f3f2727540fb950edd3b736caa97b12dbb4e5edce66542cbea6600
-SIZE (wolfpld-tracy-v0.10_GH0.tar.gz) = 6023869
+TIMESTAMP = 1741303397
+SHA256 (zigtools-zls-0.14.0_GH0.tar.gz) = 44cae74073b2f75cf627755398afadafaa382cccf7555b5b66b147dcaa6cef0d
+SIZE (zigtools-zls-0.14.0_GH0.tar.gz) = 395229
+SHA256 (wolfpld-tracy-v0.11.1_GH0.tar.gz) = 2c11ca816f2b756be2730f86b0092920419f3dabc7a7173829ffd897d91888a1
+SIZE (wolfpld-tracy-v0.11.1_GH0.tar.gz) = 6125898
SHA256 (ziglibs-diffz-ef45c00_GH0.tar.gz) = d77f03c9d0166d16b32496c76b6c806bc8c090e97c6939bb4d4beddb3f809936
SIZE (ziglibs-diffz-ef45c00_GH0.tar.gz) = 17261
-SHA256 (ziglibs-known-folders-0.7.0-35-g0ad514d_GH0.tar.gz) = c4ee8709154c5bd4c4c4a5eb619d19122c7176ad35ea0b13b89d6c6f61d79bcf
-SIZE (ziglibs-known-folders-0.7.0-35-g0ad514d_GH0.tar.gz) = 6772
+SHA256 (ziglibs-known-folders-0.7.0-57-gaa24df4_GH0.tar.gz) = 92f9b82fb8de11e246efaa7cc999e8dc57d4109bacd4450bd18030d4b8f12bac
+SIZE (ziglibs-known-folders-0.7.0-57-gaa24df4_GH0.tar.gz) = 11937
+SHA256 (zigtools-zig-lsp-codegen-063a98c_GH0.tar.gz) = 44940343c3050ace485004e99bee76bc5b4dd671e52ec22a1fb45579c2ce6058
+SIZE (zigtools-zig-lsp-codegen-063a98c_GH0.tar.gz) = 84081