Unverified Commit 7ccc3e71 authored by Tom van Dijk's avatar Tom van Dijk
Browse files

celeste: fix rustc 1.85.0 errors

ZHF: #457852
parent ec54d2a3
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
From 96ec13b49ee2fcb2869f87b1f9e8c6cfc92275df Mon Sep 17 00:00:00 2001
From: Tom van Dijk <18gatenmaker6@gmail.com>
Date: Fri, 14 Nov 2025 18:55:40 +0100
Subject: [PATCH] rust 2024 fixes

---
 src/main.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs
index 127f649..5ef526e 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -103,7 +103,7 @@ fn main() {
         }
     } else {
         // Set `RUST_BACKTRACE` so we get a better backtrace for reporting.
-        env::set_var("RUST_BACKTRACE", "1");
+        unsafe { env::set_var("RUST_BACKTRACE", "1"); }
 
         // Run the command and get the stderr, checking for a backtrace.
         let mut args = vec!["run-gui"];
-- 
2.51.0
+7 −0
Original line number Diff line number Diff line
@@ -31,6 +31,9 @@ rustPlatform.buildRustPackage rec {

  cargoHash = "sha256-OBGDnhpVLOPdYhofWfeaueklt7KBkLhM02JNvuvUQ2Q=";

  # rust 2024 requires that you put an unsafe block around std::env::set_var
  patches = [ ./missing-unsafe-block.patch ];

  postPatch = ''
    pushd $cargoDepsCopy/librclone-sys-*
    oldHash=$(sha256sum build.rs | cut -d " " -f 1)
@@ -45,6 +48,10 @@ rustPlatform.buildRustPackage rec {
      --replace "{{ env_var('DESTDIR') }}/usr" "${placeholder "out"}"
    # buildRustPackage takes care of installing the binary
    sed -i "#/bin/celeste#d" justfile

    # fix: as of rust 1.85, it is required that you specify edition 2024 for let chains
    substituteInPlace Cargo.toml \
      --replace-warn 'edition = "2021"' 'edition = "2024"'
  '';

  RUSTC_BOOTSTRAP = 1;