From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 7944ECAC0 for ; Mon, 18 Sep 2023 15:41:46 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 59C9E28D for ; Mon, 18 Sep 2023 15:41:16 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Mon, 18 Sep 2023 15:41:14 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 7012C47F45 for ; Mon, 18 Sep 2023 15:41:14 +0200 (CEST) From: Gabriel Goller To: pbs-devel@lists.proxmox.com Date: Mon, 18 Sep 2023 15:41:07 +0200 Message-Id: <20230918134109.179258-1-g.goller@proxmox.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.391 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH pathpatterns 0/2] remove unsafe std::mem::transmute X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Sep 2023 13:41:46 -0000 In the `MatchList` trait we have a function `matches`, which uses the unsafe `std::mem::transmute` function to 'force-cast' to a different type [0]. We can avoid this by adding a lifetime to the `MatchList` trait and the `&self` parameter. This only requires a single change in `proxmox-backup` to work. [0]: https://doc.rust-lang.org/nomicon/transmutes.html pathpatterns: Gabriel Goller (1): match_list: remove unsafe std::mem::transmute src/match_list.rs | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) proxmox-backup: Gabriel Goller (1): datastore: catalog: added lifetime to find function pbs-datastore/src/catalog.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.39.2