UPDATE: lang/rust 1.78.0 > 1.81.0

This commit is contained in:
purplerain 2024-09-19 05:52:57 +00:00
parent 86226f36ee
commit c1886eef17
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
25 changed files with 336 additions and 152 deletions

View file

@ -4,7 +4,7 @@ https://github.com/rust-lang/rust/issues/90064
Index: compiler/rustc_mir_transform/src/abort_unwinding_calls.rs
--- compiler/rustc_mir_transform/src/abort_unwinding_calls.rs.orig
+++ compiler/rustc_mir_transform/src/abort_unwinding_calls.rs
@@ -91,6 +91,7 @@ impl<'tcx> MirPass<'tcx> for AbortUnwindingCalls {
@@ -92,6 +92,7 @@ impl<'tcx> MirPass<'tcx> for AbortUnwindingCalls {
// registered for it.
if !call_can_unwind {
cleanups_to_remove.push(id);

View file

@ -4,7 +4,7 @@ aarch64: make -Z branch-protection=bti,pac-ret the default
Index: compiler/rustc_session/src/options.rs
--- compiler/rustc_session/src/options.rs.orig
+++ compiler/rustc_session/src/options.rs
@@ -1545,6 +1545,24 @@ options! {
@@ -1618,6 +1618,24 @@ options! {
// - src/doc/rustc/src/codegen-options/index.md
}
@ -29,7 +29,7 @@ Index: compiler/rustc_session/src/options.rs
options! {
UnstableOptions, Z_OPTIONS, dbopts, "Z", "unstable",
@@ -1570,9 +1588,9 @@ options! {
@@ -1641,9 +1659,9 @@ options! {
(default: no)"),
box_noalias: bool = (true, parse_bool, [TRACKED],
"emit noalias metadata for box (default: yes)"),

View file

@ -1,22 +0,0 @@
Backport https://github.com/rust-lang/rust/pull/123779
Index: library/std/src/os/unix/net/addr.rs
--- library/std/src/os/unix/net/addr.rs.orig
+++ library/std/src/os/unix/net/addr.rs
@@ -107,6 +107,16 @@ impl SocketAddr {
addr: libc::sockaddr_un,
mut len: libc::socklen_t,
) -> io::Result<SocketAddr> {
+ if cfg!(target_os = "openbsd") {
+ // on OpenBSD, getsockname(2) returns the actual size of the socket address,
+ // and not the len of the content. Figure out the length for ourselves.
+ // https://marc.info/?l=openbsd-bugs&m=170105481926736&w=2
+ let sun_path: &[u8] =
+ unsafe { mem::transmute::<&[libc::c_char], &[u8]>(&addr.sun_path) };
+ len = core::slice::memchr::memchr(0, sun_path)
+ .map_or(len, |new_len| (new_len + sun_path_offset(&addr)) as libc::socklen_t);
+ }
+
if len == 0 {
// When there is a datagram from unnamed unix socket
// linux returns zero bytes of address

View file

@ -3,7 +3,7 @@ argv0 isn't suitable as current_exe() in all cases.
Index: library/std/src/sys/pal/unix/os.rs
--- library/std/src/sys/pal/unix/os.rs.orig
+++ library/std/src/sys/pal/unix/os.rs
@@ -391,14 +391,17 @@ pub fn current_exe() -> io::Result<PathBuf> {
@@ -382,14 +382,17 @@ pub fn current_exe() -> io::Result<PathBuf> {
if argv[0].is_null() {
return Err(io::const_io_error!(
io::ErrorKind::Uncategorized,

View file

@ -3,7 +3,7 @@ Workaround for sparc64: bootstrap segfaults without -O3
Index: src/bootstrap/bootstrap.py
--- src/bootstrap/bootstrap.py.orig
+++ src/bootstrap/bootstrap.py
@@ -977,6 +977,9 @@ class RustBuild(object):
@@ -999,6 +999,9 @@ class RustBuild(object):
if "RUSTFLAGS_BOOTSTRAP" in env:
env["RUSTFLAGS"] += " " + env["RUSTFLAGS_BOOTSTRAP"]

View file

@ -5,7 +5,7 @@ try to reduce memory usage on aarch64 and i386:
Index: src/bootstrap/src/bin/rustc.rs
--- src/bootstrap/src/bin/rustc.rs.orig
+++ src/bootstrap/src/bin/rustc.rs
@@ -150,6 +150,18 @@ fn main() {
@@ -150,6 +150,19 @@ fn main() {
{
cmd.arg("-Ztls-model=initial-exec");
}
@ -13,14 +13,15 @@ Index: src/bootstrap/src/bin/rustc.rs
+ if target.unwrap().contains("aarch64-unknown-openbsd")
+ && crate_name == Some("rustc")
+ {
+ cmd.arg("-Z").arg("fewer-names");
+ }
+ if target.unwrap().contains("i686-unknown-openbsd")
+ && crate_name == Some("rustc_middle")
+ {
+ cmd.arg("-Z").arg("fewer-names");
+ cmd.arg("-C").arg("codegen-units=64");
+ }
} else if std::env::var("MIRI").is_err() {
+ cmd.arg("-Z").arg("fewer-names");
+ }
+ if target.unwrap().contains("i686-unknown-openbsd")
+ && crate_name == Some("rustc_middle")
+ {
+ cmd.arg("-Z").arg("fewer-names");
+ cmd.arg("-C").arg("codegen-units=64");
+ }
+
} else {
// Find any host flags that were passed by bootstrap.
// The flags are stored in a RUSTC_HOST_FLAGS variable, separated by spaces.

View file

@ -3,7 +3,7 @@ Disable "Bootstrap" test by default (it requires network).
Index: src/bootstrap/src/core/build_steps/test.rs
--- src/bootstrap/src/core/build_steps/test.rs.orig
+++ src/bootstrap/src/core/build_steps/test.rs
@@ -2910,7 +2910,7 @@ pub struct Bootstrap;
@@ -2999,7 +2999,7 @@ pub struct Bootstrap;
impl Step for Bootstrap {
type Output = ();

View file

@ -4,7 +4,7 @@ https://github.com/rust-lang/rust/issues/39900
Index: src/bootstrap/src/lib.rs
--- src/bootstrap/src/lib.rs.orig
+++ src/bootstrap/src/lib.rs
@@ -1216,7 +1216,6 @@ impl Build {
@@ -1214,7 +1214,6 @@ Executed at: {executed_at}"#,
.args()
.iter()
.map(|s| s.to_string_lossy().into_owned())

View file

@ -8,7 +8,7 @@ Index: src/etc/rust-lldb
RUST_LLDB="$RUSTC_SYSROOT/lib/rustlib/$host/bin/lldb"
-lldb=lldb
+lldb=lldb-16
+lldb=lldb-17
if [ -f "$RUST_LLDB" ]; then
lldb="$RUST_LLDB"
else

View file

@ -1,8 +1,8 @@
libgit2: force embedded version
Index: vendor/libgit2-sys/build.rs
--- vendor/libgit2-sys/build.rs.orig
+++ vendor/libgit2-sys/build.rs
Index: vendor/libgit2-sys-0.17.0+1.8.1/build.rs
--- vendor/libgit2-sys-0.17.0+1.8.1/build.rs.orig
+++ vendor/libgit2-sys-0.17.0+1.8.1/build.rs
@@ -26,6 +26,7 @@ fn main() {
let ssh = env::var("CARGO_FEATURE_SSH").is_ok();
let vendored = env::var("CARGO_FEATURE_VENDORED").is_ok();

View file

@ -0,0 +1,21 @@
https://github.com/sfackler/rust-openssl/pull/2287
Index: vendor/openssl-0.10.57/src/conf.rs
--- vendor/openssl-0.10.57/src/conf.rs.orig
+++ vendor/openssl-0.10.57/src/conf.rs
@@ -8,7 +8,7 @@ foreign_type_and_impl_send_sync! {
pub struct ConfRef;
}
-#[cfg(not(boringssl))]
+#[cfg(not(any(boringssl,libressl400)))]
mod methods {
use super::Conf;
use crate::cvt_p;
@@ -61,5 +61,5 @@ mod methods {
}
}
}
-#[cfg(not(boringssl))]
+#[cfg(not(any(boringssl,libressl400)))]
pub use methods::*;

View file

@ -0,0 +1,15 @@
https://github.com/sfackler/rust-openssl/pull/2287
Index: vendor/openssl-sys-0.9.102/build/cfgs.rs
--- vendor/openssl-sys-0.9.102/build/cfgs.rs.orig
+++ vendor/openssl-sys-0.9.102/build/cfgs.rs
@@ -65,6 +65,9 @@ pub fn get(openssl_version: Option<u64>, libressl_vers
if libressl_version >= 0x3_09_00_00_0 {
cfgs.push("libressl390");
}
+ if libressl_version >= 0x4_00_00_00_0 {
+ cfgs.push("libressl400");
+ }
} else {
let openssl_version = openssl_version.unwrap();

View file

@ -0,0 +1,20 @@
https://github.com/sfackler/rust-openssl/pull/2287
Index: vendor/openssl-sys-0.9.102/src/handwritten/conf.rs
--- vendor/openssl-sys-0.9.102/src/handwritten/conf.rs.orig
+++ vendor/openssl-sys-0.9.102/src/handwritten/conf.rs
@@ -1,7 +1,13 @@
use super::super::*;
+const_ptr_api! {
+ extern "C" {
+ pub fn NCONF_new(meth: #[const_ptr_if(libressl400)] CONF_METHOD) -> *mut CONF;
+ }
+}
+
extern "C" {
- pub fn NCONF_new(meth: *mut CONF_METHOD) -> *mut CONF;
+ #[cfg(not(libressl400))]
pub fn NCONF_default() -> *mut CONF_METHOD;
pub fn NCONF_free(conf: *mut CONF);
}

View file

@ -0,0 +1,13 @@
https://github.com/sfackler/rust-openssl/pull/2287
Index: vendor/openssl-sys-0.9.102/src/handwritten/types.rs
--- vendor/openssl-sys-0.9.102/src/handwritten/types.rs.orig
+++ vendor/openssl-sys-0.9.102/src/handwritten/types.rs
@@ -458,6 +458,7 @@ pub struct X509V3_CTX {
subject_cert: *mut c_void,
subject_req: *mut c_void,
crl: *mut c_void,
+ #[cfg(not(libressl400))]
db_meth: *mut c_void,
db: *mut c_void,
#[cfg(ossl300)]

View file

@ -0,0 +1,26 @@
https://github.com/sfackler/rust-openssl/pull/2227
Index: vendor/openssl-sys-0.9.102/src/handwritten/x509.rs
--- vendor/openssl-sys-0.9.102/src/handwritten/x509.rs.orig
+++ vendor/openssl-sys-0.9.102/src/handwritten/x509.rs
@@ -1,10 +1,16 @@
use super::super::*;
use libc::*;
-#[repr(C)]
-pub struct X509_VAL {
- pub notBefore: *mut ASN1_TIME,
- pub notAfter: *mut ASN1_TIME,
+cfg_if! {
+ if #[cfg(libressl400)] {
+ pub enum X509_VAL {}
+ } else {
+ #[repr(C)]
+ pub struct X509_VAL {
+ pub notBefore: *mut ASN1_TIME,
+ pub notAfter: *mut ASN1_TIME,
+ }
+ }
}
pub enum X509_NAME_ENTRY {}

View file

@ -0,0 +1,23 @@
https://github.com/sfackler/rust-openssl/pull/2276
Index: vendor/openssl-sys-0.9.102/src/handwritten/x509_vfy.rs
--- vendor/openssl-sys-0.9.102/src/handwritten/x509_vfy.rs.orig
+++ vendor/openssl-sys-0.9.102/src/handwritten/x509_vfy.rs
@@ -9,10 +9,15 @@ extern "C" {
pub fn X509_LOOKUP_meth_free(method: *mut X509_LOOKUP_METHOD);
}
+const_ptr_api! {
+ extern "C" {
+ pub fn X509_LOOKUP_hash_dir() -> #[const_ptr_if(libressl400)] X509_LOOKUP_METHOD;
+ pub fn X509_LOOKUP_file() -> #[const_ptr_if(libressl400)] X509_LOOKUP_METHOD;
+ }
+}
+
extern "C" {
pub fn X509_LOOKUP_free(ctx: *mut X509_LOOKUP);
- pub fn X509_LOOKUP_hash_dir() -> *mut X509_LOOKUP_METHOD;
- pub fn X509_LOOKUP_file() -> *mut X509_LOOKUP_METHOD;
pub fn X509_LOOKUP_ctrl(
ctx: *mut X509_LOOKUP,
cmd: c_int,

View file

@ -1,14 +1,14 @@
The LibreSSL version in -current isn't explicitly supported.
Index: vendor/openssl-sys/build/main.rs
--- vendor/openssl-sys/build/main.rs.orig
+++ vendor/openssl-sys/build/main.rs
@@ -300,7 +300,7 @@ See rust-openssl documentation for more information:
(3, 8, 0) => ('3', '8', '0'),
(3, 8, 1) => ('3', '8', '1'),
Index: vendor/openssl-sys-0.9.102/build/main.rs
--- vendor/openssl-sys-0.9.102/build/main.rs.orig
+++ vendor/openssl-sys-0.9.102/build/main.rs
@@ -304,7 +304,7 @@ See rust-openssl documentation for more information:
(3, 8, _) => ('3', '8', 'x'),
(3, 9, 0) => ('3', '9', '0'),
(3, 9, _) => ('3', '9', 'x'),
- _ => version_error(),
+ _ => ('3', '8', 'x'),
+ _ => ('4', '0', 'x'),
};
println!("cargo:libressl=true");

View file

@ -1,9 +1,9 @@
https://github.com/sfackler/rust-openssl/pull/2124
Index: vendor/openssl/build.rs
--- vendor/openssl/build.rs.orig
+++ vendor/openssl/build.rs
@@ -81,6 +81,9 @@ fn main() {
Index: vendor/openssl-0.10.57/build.rs
--- vendor/openssl-0.10.57/build.rs.orig
+++ vendor/openssl-0.10.57/build.rs
@@ -73,6 +73,9 @@ fn main() {
for var in vars.split(',') {
println!("cargo:rustc-cfg=osslconf=\"{}\"", var);
}

View file

@ -1,9 +1,9 @@
Part of https://github.com/sfackler/rust-openssl/pull/2121
Index: vendor/openssl/src/lib.rs
--- vendor/openssl/src/lib.rs.orig
+++ vendor/openssl/src/lib.rs
@@ -218,6 +218,15 @@ fn cvt_p_const<T>(r: *const T) -> Result<*const T, Err
Index: vendor/openssl-0.10.57/src/lib.rs
--- vendor/openssl-0.10.57/src/lib.rs.orig
+++ vendor/openssl-0.10.57/src/lib.rs
@@ -204,6 +204,15 @@ fn cvt_p<T>(r: *mut T) -> Result<*mut T, ErrorStack> {
}
#[inline]

View file

@ -1,8 +1,8 @@
Add some endbr64 instructions: required for rustc binary on amd64 with IBT.
Index: vendor/psm/src/arch/x86_64.s
--- vendor/psm/src/arch/x86_64.s.orig
+++ vendor/psm/src/arch/x86_64.s
Index: vendor/psm-0.1.21/src/arch/x86_64.s
--- vendor/psm-0.1.21/src/arch/x86_64.s.orig
+++ vendor/psm-0.1.21/src/arch/x86_64.s
@@ -26,6 +26,7 @@ TYPE(rust_psm_stack_direction)
FUNCTION(rust_psm_stack_direction):
/* extern "sysv64" fn() -> u8 (%al) */