git: b352c01459d9 - main - games/veloren-weekly: Fix build with rust 1.78.0

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Mon, 13 May 2024 11:04:03 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b352c01459d9b6243eeeb7443bb632ce7fca943e

commit b352c01459d9b6243eeeb7443bb632ce7fca943e
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2024-05-12 17:05:27 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2024-05-13 11:03:24 +0000

    games/veloren-weekly: Fix build with rust 1.78.0
    
    PR:             278834, 278938
    Approved by:    portmgr (build fix blanket)
---
 games/veloren-weekly/files/patch-rust-1.78.0         | 20 ++++++++++++++++++++
 .../files/patch-rust-1.78.0-disable-simd             | 16 ++++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/games/veloren-weekly/files/patch-rust-1.78.0 b/games/veloren-weekly/files/patch-rust-1.78.0
new file mode 100644
index 000000000000..a5a2315fc547
--- /dev/null
+++ b/games/veloren-weekly/files/patch-rust-1.78.0
@@ -0,0 +1,20 @@
+invalid_mut was renamed to without_provenance_mut
+in https://github.com/rust-lang/rust/commit/b58f647d5488dce73bba517907c44af2c2a618c4
+
+error[E0425]: cannot find function `invalid_mut` in module `core::ptr`
+   --> /wrkdirs/usr/ports/games/veloren-weekly/work/shred-5d52c6fc390dd04c12158633e77591f6523d1f85/src/meta.rs:402:38
+    |
+402 |         let invalid_ptr = core::ptr::invalid_mut::<R>((self as *mut Self).addr());
+    |                                      ^^^^^^^^^^^ not found in `core::ptr`
+
+--- ../shred-5d52c6fc390dd04c12158633e77591f6523d1f85/src/meta.rs.orig	2024-05-07 13:31:09.835758000 +0200
++++ ../shred-5d52c6fc390dd04c12158633e77591f6523d1f85/src/meta.rs	2024-05-07 13:31:24.927663000 +0200
+@@ -399,7 +399,7 @@ impl<T: ?Sized> MetaTable<T> {
+     {
+         let ty_id = TypeId::of::<R>();
+         // use self.addr() for unpredictable address to use for checking consistency below
+-        let invalid_ptr = core::ptr::invalid_mut::<R>((self as *mut Self).addr());
++        let invalid_ptr = core::ptr::without_provenance_mut::<R>((self as *mut Self).addr());
+         let trait_ptr = <T as CastFrom<R>>::cast(invalid_ptr);
+         // assert that address not changed (to catch some mistakes in CastFrom impl)
+         assert_eq!(
diff --git a/games/veloren-weekly/files/patch-rust-1.78.0-disable-simd b/games/veloren-weekly/files/patch-rust-1.78.0-disable-simd
new file mode 100644
index 000000000000..54a9ea7488fa
--- /dev/null
+++ b/games/veloren-weekly/files/patch-rust-1.78.0-disable-simd
@@ -0,0 +1,16 @@
+packed_simd doesn't compile with rust 1.78.0
+Part of the issue is fixed with https://github.com/yoanlcq/vek/pull/95/files
+but it's not enough, packed_simd2 is used here:
+https://gitlab.com/veloren/veloren/-/blob/master/world/src/sim/erosion.rs?ref_type=heads#L16
+
+--- world/Cargo.toml.orig	2024-05-10 18:54:20.494825000 +0200
++++ world/Cargo.toml	2024-05-10 18:54:43.257129000 +0200
+@@ -11,7 +11,7 @@ cli = ["clap", "signal-hook", "indicatif"]
+ bin_compression = ["lz-fear", "deflate", "flate2", "image/jpeg", "num-traits", "fallible-iterator", "rstar", "cli"]
+ cli = ["clap", "signal-hook", "indicatif"]
+ 
+-default = ["simd"]
++#default = ["simd"]
+ 
+ [dependencies]
+ common = { package = "veloren-common", path = "../common" }