summaryrefslogtreecommitdiff
path: root/gnu/packages/patches
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2025-01-09 10:54:36 +0200
committerEfraim Flashner <efraim@flashner.co.il>2025-01-09 10:54:36 +0200
commit66a1a1fe22aff54973ab5c33957a338b33b8274c (patch)
tree4b6def312debbbc5020294bf469568ef638c0c5c /gnu/packages/patches
parent7f27dc47c52886b785359799b6dc67b61f638544 (diff)
parent986245daca2fb50d58cf0f2b9273f0d670d38af2 (diff)
Merge remote-tracking branch 'origin/rust-team'
Change-Id: Ib21a0ea59fb2ae4e802552057227c636f24a6f8c
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r--gnu/packages/patches/maturin-no-cross-compile.patch32
-rw-r--r--gnu/packages/patches/mrustc-patches.patch19
-rw-r--r--gnu/packages/patches/rust-cargo-edit-remove-ureq.patch33
-rw-r--r--gnu/packages/patches/rust-onenote-parser-for-clamav-deps.patch88
-rw-r--r--gnu/packages/patches/rust-onenote-parser-for-clamav-parse-in-memory-buffer.patch52
-rw-r--r--gnu/packages/patches/rust-onenote-parser-for-clamav-property-type.patch30
-rw-r--r--gnu/packages/patches/rust-webbrowser-remove-unsupported-os.patch24
-rw-r--r--gnu/packages/patches/rustc-1.54.0-src.patch304
8 files changed, 210 insertions, 372 deletions
diff --git a/gnu/packages/patches/maturin-no-cross-compile.patch b/gnu/packages/patches/maturin-no-cross-compile.patch
index 98af33d3c7..d391d4028c 100644
--- a/gnu/packages/patches/maturin-no-cross-compile.patch
+++ b/gnu/packages/patches/maturin-no-cross-compile.patch
@@ -2,36 +2,46 @@ Remove dependencies on xwin and zig. We're not offering cross-compilation
options using these crates.
diff --git a/Cargo.toml b/Cargo.toml
-index 6704e46..ff126a9 100644
+index 24305db..c7641f9 100644
--- a/Cargo.toml
+++ b/Cargo.toml
-@@ -83,16 +83,6 @@ version = "0.1.16"
+@@ -95,16 +95,6 @@ version = "0.1.24"
[dependencies.cargo-options]
version = "0.7.2"
-[dependencies.cargo-xwin]
--version = "0.16.2"
+-version = "0.18.3"
-optional = true
-default-features = false
-
-[dependencies.cargo-zigbuild]
--version = "0.18.0"
+-version = "0.19.7"
-optional = true
-default-features = false
-
[dependencies.cargo_metadata]
- version = "0.18.0"
+ version = "0.19.0"
+
+@@ -364,10 +354,6 @@ version = "7.0.0"
-@@ -321,8 +311,6 @@ version = "5.0.0"
[features]
cli-completion = ["dep:clap_complete_command"]
- cross-compile = [
+-cross-compile = [
- "zig",
- "xwin",
- ]
+-]
default = [
"full",
-@@ -341,7 +329,6 @@ log = ["tracing-subscriber"]
+ "rustls",
+@@ -375,7 +361,6 @@ default = [
+ faster-tests = []
+ full = [
+ "cli-completion",
+- "cross-compile",
+ "scaffolding",
+ "upload",
+ ]
+@@ -384,7 +369,6 @@ log = []
native-tls = [
"dep:native-tls",
"ureq?/native-tls",
@@ -39,7 +49,7 @@ index 6704e46..ff126a9 100644
"dep:rustls-pemfile",
]
password-storage = [
-@@ -351,7 +338,6 @@ password-storage = [
+@@ -394,7 +378,6 @@ password-storage = [
rustls = [
"dep:rustls",
"ureq?/tls",
@@ -47,7 +57,7 @@ index 6704e46..ff126a9 100644
"dep:rustls-pemfile",
]
scaffolding = [
-@@ -369,5 +355,3 @@ upload = [
+@@ -416,5 +399,3 @@ upload = [
"wild",
"dep:dirs",
]
diff --git a/gnu/packages/patches/mrustc-patches.patch b/gnu/packages/patches/mrustc-patches.patch
new file mode 100644
index 0000000000..626945e2a1
--- /dev/null
+++ b/gnu/packages/patches/mrustc-patches.patch
@@ -0,0 +1,19 @@
+diff --git a/rustc-1.54.0-src.patch b/rustc-1.54.0-src.patch
+index 088c723a..d322fd0d 100644
+--- a/rustc-1.54.0-src.patch
++++ b/rustc-1.54.0-src.patch
+@@ -302,14 +302,3 @@
+ use self::generic as arch;
+
+ pub use self::arch::{vec128_storage, vec256_storage, vec512_storage};
+-
+---- src/llvm-project/llvm/include/llvm/Support/Signals.h
+-+++ src/llvm-project/llvm/include/llvm/Support/Signals.h
+-@@ -14,6 +14,7 @@
+- #ifndef LLVM_SUPPORT_SIGNALS_H
+- #define LLVM_SUPPORT_SIGNALS_H
+-
+-+#include <cstdint>
+- #include <string>
+-
+- namespace llvm {
diff --git a/gnu/packages/patches/rust-cargo-edit-remove-ureq.patch b/gnu/packages/patches/rust-cargo-edit-remove-ureq.patch
deleted file mode 100644
index 99c58103c7..0000000000
--- a/gnu/packages/patches/rust-cargo-edit-remove-ureq.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-This is modeled after the upstream commit which removes ureq as a dependency.
-
-diff --git a/Cargo.toml b/Cargo.toml
-index 5a787e1..27171c7 100644
---- a/Cargo.toml
-+++ b/Cargo.toml
-@@ -201,26 +201,3 @@ test-external-apis = []
- upgrade = ["cli"]
- vendored-libgit2 = ["git2/vendored-libgit2"]
- vendored-openssl = ["git2/vendored-openssl"]
--
--[target."cfg(any(target_arch = \"x86_64\", target_arch = \"arm\", target_arch = \"x86\", target_arch = \"aarch64\"))".dependencies.ureq]
--version = "2.7.1"
--features = [
-- "tls",
-- "json",
-- "socks",
-- "socks-proxy",
--]
--default-features = false
--
--[target."cfg(not(any(target_arch = \"x86_64\", target_arch = \"arm\", target_arch = \"x86\", target_arch = \"aarch64\")))".dependencies.native-tls]
--version = "^0.2"
--
--[target."cfg(not(any(target_arch = \"x86_64\", target_arch = \"arm\", target_arch = \"x86\", target_arch = \"aarch64\")))".dependencies.ureq]
--version = "2.7.1"
--features = [
-- "native-tls",
-- "json",
-- "socks",
-- "socks-proxy",
--]
--default-features = false
diff --git a/gnu/packages/patches/rust-onenote-parser-for-clamav-deps.patch b/gnu/packages/patches/rust-onenote-parser-for-clamav-deps.patch
new file mode 100644
index 0000000000..24d5692573
--- /dev/null
+++ b/gnu/packages/patches/rust-onenote-parser-for-clamav-deps.patch
@@ -0,0 +1,88 @@
+From f940d8c8fa087554583158d50df071af89c516db Mon Sep 17 00:00:00 2001
+From: Simon Lamon <32477463+silamon@users.noreply.github.com>
+Date: Sat, 19 Nov 2022 20:32:07 +0100
+Subject: [PATCH] chore: upgrade dependencies (#9)
+
+Co-authored-by: Markus Siemens <markus@m-siemens.de>
+---
+ Cargo.toml.orig | 8 ++++----
+ src/errors.rs | 6 +++---
+ src/reader.rs | 2 +-
+ src/utils.rs | 5 ++---
+ 4 files changed, 10 insertions(+), 11 deletions(-)
+
+diff --git a/Cargo.toml.orig b/Cargo.toml.orig
+index 9afddd0..e302436 100644
+--- a/Cargo.toml.orig
++++ b/Cargo.toml.orig
+@@ -14,15 +14,15 @@ categories = ["parser-implementations"]
+ backtrace = []
+
+ [dependencies]
+-bytes = "0.5"
++bytes = "1.2.0"
+ encoding_rs = "0.8.31"
+ enum-primitive-derive = "0.2.2"
+-itertools = "0.9.0"
++itertools = "0.10.3"
+ num-traits = "0.2"
+ paste = "1.0"
+ thiserror = "1.0"
+-uuid = "0.8"
+-widestring = "0.4.3"
++uuid = "1.1.2"
++widestring = "1.0.2"
+
+ [dev-dependencies]
+ insta = "1.21.1"
+diff --git a/src/errors.rs b/src/errors.rs
+index 91477b3..50079a3 100644
+--- a/src/errors.rs
++++ b/src/errors.rs
+@@ -51,8 +51,8 @@ impl From<std::string::FromUtf16Error> for Error {
+ }
+ }
+
+-impl From<widestring::MissingNulError<u16>> for Error {
+- fn from(err: widestring::MissingNulError<u16>) -> Self {
++impl From<widestring::error::MissingNulTerminator> for Error {
++ fn from(err: widestring::error::MissingNulTerminator) -> Self {
+ ErrorKind::from(err).into()
+ }
+ }
+@@ -128,6 +128,6 @@ pub enum ErrorKind {
+ #[error("UTF-16 string is missing null terminator: {err}")]
+ Utf16MissingNull {
+ #[from]
+- err: widestring::MissingNulError<u16>,
++ err: widestring::error::MissingNulTerminator,
+ },
+ }
+diff --git a/src/reader.rs b/src/reader.rs
+index 64730d0..318c280 100644
+--- a/src/reader.rs
++++ b/src/reader.rs
+@@ -40,7 +40,7 @@ impl<'a> Reader<'a> {
+ }
+
+ pub(crate) fn bytes(&self) -> &[u8] {
+- self.0.bytes()
++ self.0.chunk()
+ }
+
+ pub(crate) fn remaining(&self) -> usize {
+diff --git a/src/utils.rs b/src/utils.rs
+index fd77181..074ff50 100644
+--- a/src/utils.rs
++++ b/src/utils.rs
+@@ -12,8 +12,7 @@ impl Utf16ToString for &[u8] {
+ .map(|v| u16::from_le_bytes([v[0], v[1]]))
+ .collect();
+
+- let value = U16CString::from_vec_with_nul(data)?;
+-
+- Ok(value.to_string()?)
++ let value = U16CString::from_vec_truncate(data);
++ Ok(value.to_string().unwrap())
+ }
+ }
diff --git a/gnu/packages/patches/rust-onenote-parser-for-clamav-parse-in-memory-buffer.patch b/gnu/packages/patches/rust-onenote-parser-for-clamav-parse-in-memory-buffer.patch
new file mode 100644
index 0000000000..77adc550ca
--- /dev/null
+++ b/gnu/packages/patches/rust-onenote-parser-for-clamav-parse-in-memory-buffer.patch
@@ -0,0 +1,52 @@
+From 8b450447e58143004b68dd21c11b710fdb79be92 Mon Sep 17 00:00:00 2001
+From: Micah Snyder <micasnyd@cisco.com>
+Date: Mon, 3 Jul 2023 21:44:57 -0700
+Subject: [PATCH] Add ability to parse section from in memory buffer
+
+Resolves: https://github.com/msiemens/onenote.rs/issues/12
+---
+ src/onenote/mod.rs | 23 ++++++++++++++++++++++-
+ 1 file changed, 22 insertions(+), 1 deletion(-)
+
+diff --git a/src/onenote/mod.rs b/src/onenote/mod.rs
+index de172c9..8bcb62b 100644
+--- a/src/onenote/mod.rs
++++ b/src/onenote/mod.rs
+@@ -6,8 +6,9 @@ use crate::onestore::parse_store;
+ use crate::reader::Reader;
+ use std::ffi::OsStr;
+ use std::fs::File;
+-use std::io::{BufReader, Read};
++use std::io::{BufReader, Read, Cursor};
+ use std::path::Path;
++use std::str::FromStr;
+
+ pub(crate) mod content;
+ pub(crate) mod embedded_file;
+@@ -76,6 +77,26 @@ impl Parser {
+ Ok(Notebook { entries: sections })
+ }
+
++ /// Parse a OneNote section buffer.
++ ///
++ /// The `data` argument must contain a OneNote section.
++ pub fn parse_section_buffer(&mut self, data: &[u8], file_name: &Path) -> Result<Section> {
++ let packaging = OneStorePackaging::parse(&mut Reader::new(data))?;
++ let store = parse_store(&packaging)?;
++
++ if store.schema_guid() != guid!({1F937CB4-B26F-445F-B9F8-17E20160E461}) {
++ return Err(ErrorKind::NotASectionFile {
++ file: file_name.to_string_lossy().into_owned(),
++ }
++ .into());
++ }
++
++ section::parse_section(
++ store,
++ file_name.to_string_lossy().into_owned(),
++ )
++ }
++
+ /// Parse a OneNote section file.
+ ///
+ /// The `path` argument must point to a `.one` file that contains a
diff --git a/gnu/packages/patches/rust-onenote-parser-for-clamav-property-type.patch b/gnu/packages/patches/rust-onenote-parser-for-clamav-property-type.patch
new file mode 100644
index 0000000000..ff94fa2630
--- /dev/null
+++ b/gnu/packages/patches/rust-onenote-parser-for-clamav-property-type.patch
@@ -0,0 +1,30 @@
+From 29c08532252b917543ff268284f926f30876bb79 Mon Sep 17 00:00:00 2001
+From: Matt Jolly <Matt.Jolly@footclan.ninja>
+Date: Mon, 24 Jun 2024 17:34:05 +1000
+Subject: [PATCH] PropertType: Specify type for custom discriminant values
+
+We use custom discriminant values for enum variants for "PropertType" without specifying the type.
+This causes it to default to "isize" which on 64bit platforms is big enough to hold the 32bit constants,
+but causes overflow when isize is 32bit.
+
+This issue was uncovered due to build failures on arm for Gentoo Linux as a dependency of ClamAV.
+
+Bug: https://bugs.gentoo.org/927214
+Signed-off-by: Matt Jolly <kangie@gentoo.org>
+Co-authored-by: Steven Newbury <steve@snewbury.org.uk>
+---
+ src/one/property/mod.rs | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/one/property/mod.rs b/src/one/property/mod.rs
+index 42841c6..fcc0481 100644
+--- a/src/one/property/mod.rs
++++ b/src/one/property/mod.rs
+@@ -23,6 +23,7 @@ mod references;
+ pub(crate) mod simple;
+ pub(crate) mod time;
+
++#[repr(u32)]
+ #[derive(Debug, Copy, Clone, PartialEq)]
+ #[allow(dead_code)]
+ #[allow(clippy::enum_clike_unportable_variant)]
diff --git a/gnu/packages/patches/rust-webbrowser-remove-unsupported-os.patch b/gnu/packages/patches/rust-webbrowser-remove-unsupported-os.patch
deleted file mode 100644
index 9fea1e1665..0000000000
--- a/gnu/packages/patches/rust-webbrowser-remove-unsupported-os.patch
+++ /dev/null
@@ -1,24 +0,0 @@
---- Cargo.toml 2023-05-07 13:39:13.029066693 +0100
-+++ Cargo.toml 2023-05-07 13:39:22.545138206 +0100
-@@ -67,21 +67,3 @@
- [target."cfg(target_arch = \"wasm32\")".dependencies.web-sys]
- version = "0.3"
- features = ["Window"]
--
--[target."cfg(target_os = \"android\")".dependencies.jni]
--version = "0.21"
--
--[target."cfg(target_os = \"android\")".dependencies.ndk-context]
--version = "0.1"
--
--[target."cfg(target_os = \"android\")".dev-dependencies.ndk-glue]
--version = ">= 0.3, <= 0.7"
--
--[target."cfg(target_os = \"ios\")".dependencies.objc]
--version = "0.2.7"
--
--[target."cfg(target_os = \"ios\")".dependencies.raw-window-handle]
--version = "0.5.0"
--
--[target."cfg(target_os = \"macos\")".dependencies.core-foundation]
--version = "0.9"
diff --git a/gnu/packages/patches/rustc-1.54.0-src.patch b/gnu/packages/patches/rustc-1.54.0-src.patch
deleted file mode 100644
index d322fd0d49..0000000000
--- a/gnu/packages/patches/rustc-1.54.0-src.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-# mrustc is much better at enum packing, so causes almost all of these to be smaller by one pointer
---- compiler/rustc_ast/src/ast.rs
-+++ compiler/rustc_ast/src/ast.rs
-@@ -1075,7 +1075,7 @@ pub struct Expr {
- }
-
- // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Expr, 104);
-
- impl Expr {
-@@ -2779,7 +2779,7 @@ pub enum AssocItemKind {
- MacCall(MacCall),
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(AssocItemKind, 72);
-
- impl AssocItemKind {
-@@ -2831,7 +2831,7 @@ pub enum ForeignItemKind {
- MacCall(MacCall),
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(ForeignItemKind, 72);
-
- impl From<ForeignItemKind> for ItemKind {
-
---- compiler/rustc_hir/src/hir.rs
-+++ compiler/rustc_hir/src/hir.rs
-@@ -3048,7 +3048,7 @@ impl<'hir> Node<'hir> {
- }
-
- // Some nodes are used a lot. Make sure they don't unintentionally get bigger.
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))]
- mod size_asserts {
- rustc_data_structures::static_assert_size!(super::Block<'static>, 48);
- rustc_data_structures::static_assert_size!(super::Expr<'static>, 64);
-
---- compiler/rustc_middle/src/mir/interpret/error.rs
-+++ compiler/rustc_middle/src/mir/interpret/error.rs
-@@ -449,7 +449,7 @@ impl dyn MachineStopType {
- }
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- static_assert_size!(InterpError<'_>, 64);
-
- pub enum InterpError<'tcx> {
-
---- compiler/rustc_middle/src/mir/mod.rs
-+++ compiler/rustc_middle/src/mir/mod.rs
-@@ -2200,7 +2200,7 @@ pub enum AggregateKind<'tcx> {
- Generator(DefId, SubstsRef<'tcx>, hir::Movability),
- }
-
--#[cfg(target_arch = "x86_64")]
-+#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64"))]
- static_assert_size!(AggregateKind<'_>, 48);
-
- #[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
-
---- compiler/rustc_middle/src/thir.rs
-+++ compiler/rustc_middle/src/thir.rs
-@@ -144,7 +144,7 @@ pub enum StmtKind<'tcx> {
- }
-
- // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Expr<'_>, 144);
-
- /// The Thir trait implementor lowers their expressions (`&'tcx H::Expr`)
-
---- compiler/rustc_mir/src/interpret/operand.rs
-+++ compiler/rustc_mir/src/interpret/operand.rs
-@@ -32,7 +32,7 @@ pub enum Immediate<Tag = ()> {
- ScalarPair(ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>),
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Immediate, 56);
-
- impl<Tag> From<ScalarMaybeUninit<Tag>> for Immediate<Tag> {
-@@ -87,7 +87,7 @@ pub struct ImmTy<'tcx, Tag = ()> {
- pub layout: TyAndLayout<'tcx>,
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
-
- impl<Tag: Copy> std::fmt::Display for ImmTy<'tcx, Tag> {
-
---- compiler/rustc_mir/src/interpret/place.rs
-+++ compiler/rustc_mir/src/interpret/place.rs
-@@ -88,7 +88,7 @@ pub enum Place<Tag = ()> {
- Local { frame: usize, local: mir::Local },
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Place, 64);
-
- #[derive(Copy, Clone, Debug)]
-@@ -97,7 +97,7 @@ pub struct PlaceTy<'tcx, Tag = ()> {
- pub layout: TyAndLayout<'tcx>,
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(PlaceTy<'_>, 80);
-
- impl<'tcx, Tag> std::ops::Deref for PlaceTy<'tcx, Tag> {
-
-#
-# Disable std_detect's detection logic (use the same logic as miri)
-#
---- library/stdarch/crates/std_detect/src/detect/mod.rs
-+++ library/stdarch/crates/std_detect/src/detect/mod.rs
-@@ -86,7 +86,7 @@ mod bit;
- mod cache;
-
- cfg_if! {
-- if #[cfg(miri)] {
-+ if #[cfg(any(miri, rust_compiler = "mrustc"))] {
- // When running under miri all target-features that are not enabled at
- // compile-time are reported as disabled at run-time.
- //
-
-#
-# Disable crc32fast's use of stdarch
-#
---- vendor/crc32fast/src/specialized/mod.rs
-+++ vendor/crc32fast/src/specialized/mod.rs
-@@ -1,5 +1,6 @@
- cfg_if! {
- if #[cfg(all(
-+ not(rust_compiler = "mrustc"),
- crc32fast_stdarchx86,
- any(target_arch = "x86", target_arch = "x86_64")
- ))] {
-
-#
-# Backport which is required to support arm64 on macOS 12
-# See: https://github.com/alexcrichton/curl-rust/commit/0aea09c428b9bc2bcf46da0fc33959fe3f03c74a
-#
---- vendor/curl/src/lib.rs
-+++ vendor/curl/src/lib.rs
-@@ -82,6 +82,9 @@ pub mod easy;
- pub mod multi;
- mod panic;
-
-+#[cfg(test)]
-+static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
-+
- /// Initializes the underlying libcurl library.
- ///
- /// The underlying libcurl library must be initialized before use, and must be
-@@ -102,46 +105,62 @@ pub fn init() {
- /// Used to prevent concurrent or duplicate initialization.
- static INIT: Once = Once::new();
-
-- /// An exported constructor function. On supported platforms, this will be
-- /// invoked automatically before the program's `main` is called.
-- #[cfg_attr(
-- any(target_os = "linux", target_os = "freebsd", target_os = "android"),
-- link_section = ".init_array"
-- )]
-- #[cfg_attr(target_os = "macos", link_section = "__DATA,__mod_init_func")]
-- #[cfg_attr(target_os = "windows", link_section = ".CRT$XCU")]
-- static INIT_CTOR: extern "C" fn() = init_inner;
-+ INIT.call_once(|| {
-+ #[cfg(need_openssl_init)]
-+ openssl_probe::init_ssl_cert_env_vars();
-+ #[cfg(need_openssl_init)]
-+ openssl_sys::init();
-+
-+ unsafe {
-+ assert_eq!(curl_sys::curl_global_init(curl_sys::CURL_GLOBAL_ALL), 0);
-+ }
-+
-+ #[cfg(test)]
-+ {
-+ INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
-+ }
-+
-+ // Note that we explicitly don't schedule a call to
-+ // `curl_global_cleanup`. The documentation for that function says
-+ //
-+ // > You must not call it when any other thread in the program (i.e. a
-+ // > thread sharing the same memory) is running. This doesn't just mean
-+ // > no other thread that is using libcurl.
-+ //
-+ // We can't ever be sure of that, so unfortunately we can't call the
-+ // function.
-+ });
-+}
-
-+/// An exported constructor function. On supported platforms, this will be
-+/// invoked automatically before the program's `main` is called. This is done
-+/// for the convenience of library users since otherwise the thread-safety rules
-+/// around initialization can be difficult to fulfill.
-+///
-+/// This is a hidden public item to ensure the symbol isn't optimized away by a
-+/// rustc/LLVM bug: https://github.com/rust-lang/rust/issues/47384. As long as
-+/// any item in this module is used by the final binary (which `init` will be)
-+/// then this symbol should be preserved.
-+#[used]
-+#[doc(hidden)]
-+#[cfg_attr(
-+ any(target_os = "linux", target_os = "freebsd", target_os = "android"),
-+ link_section = ".init_array"
-+)]
-+#[cfg_attr(target_os = "macos", link_section = "__DATA,__mod_init_func")]
-+#[cfg_attr(target_os = "windows", link_section = ".CRT$XCU")]
-+pub static INIT_CTOR: extern "C" fn() = {
- /// This is the body of our constructor function.
- #[cfg_attr(
- any(target_os = "linux", target_os = "android"),
- link_section = ".text.startup"
- )]
-- extern "C" fn init_inner() {
-- INIT.call_once(|| {
-- #[cfg(need_openssl_init)]
-- openssl_sys::init();
--
-- unsafe {
-- assert_eq!(curl_sys::curl_global_init(curl_sys::CURL_GLOBAL_ALL), 0);
-- }
--
-- // Note that we explicitly don't schedule a call to
-- // `curl_global_cleanup`. The documentation for that function says
-- //
-- // > You must not call it when any other thread in the program (i.e.
-- // > a thread sharing the same memory) is running. This doesn't just
-- // > mean no other thread that is using libcurl.
-- //
-- // We can't ever be sure of that, so unfortunately we can't call the
-- // function.
-- });
-+ extern "C" fn init_ctor() {
-+ init();
- }
-
-- // We invoke our init function through our static to ensure the symbol isn't
-- // optimized away by a bug: https://github.com/rust-lang/rust/issues/47384
-- INIT_CTOR();
--}
-+ init_ctor
-+};
-
- unsafe fn opt_str<'a>(ptr: *const libc::c_char) -> Option<&'a str> {
- if ptr.is_null() {
-@@ -158,3 +177,20 @@ fn cvt(r: curl_sys::CURLcode) -> Result<(), Error> {
- Err(Error::new(r))
- }
- }
-+
-+#[cfg(test)]
-+mod tests {
-+ use super::*;
-+
-+ #[test]
-+ #[cfg(any(
-+ target_os = "linux",
-+ target_os = "macos",
-+ target_os = "windows",
-+ target_os = "freebsd",
-+ target_os = "android"
-+ ))]
-+ fn is_initialized_before_main() {
-+ assert!(INITIALIZED.load(std::sync::atomic::Ordering::SeqCst));
-+ }
-+}
-
-# PPV-Lite also needs to know that we're pretending to be miri
---- vendor/ppv-lite86/src/lib.rs
-+++ vendor/ppv-lite86/src/lib.rs
-@@ -9,14 +9,14 @@ mod soft;
- mod types;
- pub use self::types::*;
-
--#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
-+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler = "mrustc")))]
- pub mod x86_64;
--#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
-+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler = "mrustc")))]
- use self::x86_64 as arch;
-
--#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
-+#[cfg(any(miri, rust_compiler = "mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
- pub mod generic;
--#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
-+#[cfg(any(miri, rust_compiler = "mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
- use self::generic as arch;
-
- pub use self::arch::{vec128_storage, vec256_storage, vec512_storage};