Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2201778rwl; Thu, 13 Apr 2023 03:10:41 -0700 (PDT) X-Google-Smtp-Source: AKy350ab1+Ri1AfxIZSiVxYXb/cMBjjbAhku8JdyAiujPlwbwSa8yJaZv4Iaseseoo3PBFyHGbRB X-Received: by 2002:a17:907:6297:b0:8aa:c090:a9ef with SMTP id nd23-20020a170907629700b008aac090a9efmr2431592ejc.55.1681380641443; Thu, 13 Apr 2023 03:10:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681380641; cv=none; d=google.com; s=arc-20160816; b=So76iWM/O598eLWGm8jZRiMyuEZ0pPLE5LT/JpETMItY5ntMhk07LRoP9ITEL5PDGc mmWnpdwqmyytjibM/ZqqKVWRg1npP0UYB9wSWe/UX/Q5Y7hl5bWq3TLWxqoFSpUDPk3k rNLx3lkDAzosxcOHM7dm8uhrqBzEo/TvRVA06b7UHmS0fptqF9VcqotKx2PZaBsIzXr8 DS/5zXxpgApl3UYzNXFivwz2Zz1Vb9co9V3GYui5tD2iaz7NVW8rInYDdjGKpuTEZapS TtnaZjgz/zqFPxL2J5ogtbClL8s2oBU/a2hx74oyppyQPrMCXGW+5qhoTBOaeY5han3E Ix0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:message-id:subject:cc:from:to:dkim-signature:date; bh=/LzrCvKWuttehRbr4lZ5bedwD/eeW7ZCBjqk7BUNs+k=; b=CR96E7nKdL9hBJ3wn8hY/p5rQFy5w0ikEimJcdD7Lv9MT10zNKJLI6esKMhhNy98IB 7ZL3VG+lXSyOJvhBUSQdoO1uqV5LPU2A/3WxuL2tqDdR1OHEBFH2ZDNoua0RxjYHXylv 6bwFsBDn84FgWSWuLpcmWFwuv/rYBVDZnvwwQAy3Pf9SGyV4gKZcvB8PV0HM4l+DPMGu WbFpp9ElrCQbnRoqpOGFuTMNOPsxVXVUxqijFbWD31dk90WxuHW4gyP2/GU1m80BRC+J MgLPjRAuFD6gWB+Uau3mrS/fUktb8cd386ja+xyhfmSISZ/4RgxlDzeAMg73IPC6U3yV 3aTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=Xn5XEEgY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id vp22-20020a17090712d600b0094ea22d6a5esi1262700ejb.846.2023.04.13.03.10.16; Thu, 13 Apr 2023 03:10:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=Xn5XEEgY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbjDMKCb (ORCPT + 99 others); Thu, 13 Apr 2023 06:02:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjDMKC3 (ORCPT ); Thu, 13 Apr 2023 06:02:29 -0400 X-Greylist: delayed 3953 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 13 Apr 2023 03:02:24 PDT Received: from mail-40133.protonmail.ch (mail-40133.protonmail.ch [185.70.40.133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79F69769F for ; Thu, 13 Apr 2023 03:02:24 -0700 (PDT) Date: Thu, 13 Apr 2023 10:02:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1681380142; x=1681639342; bh=/LzrCvKWuttehRbr4lZ5bedwD/eeW7ZCBjqk7BUNs+k=; h=Date:To:From:Cc:Subject:Message-ID:Feedback-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector; b=Xn5XEEgYc1xZID1fuj344NeCVTTfaQ56EKzp+TREShH8fUdswG1dNguf1vEBJfjIm 7SsZADL3IhkWKFRTQ1S92wSHIh6fwxWljZFn9QKmu8Bf30Bi4UbJ3p5rja22y8tgkV Q7UKKKX+0S+5v6x9mI92EM4WF7Bsoh8ePyuoRoLyq4OrorvzpocLm9EqLbLKmRqeKy fDAiaFXlgnmUljLmLkNRzCvIWbpHEEHgPAXBUKrLbK3vKGQ8+0LGjWKL91rNnJTCm5 66//yBv3ZMDx4Ct77hsN12n5OxMLlVN2l4jMHX6+eVEf9mQpZX//aPCTb0Q01kv+f9 i+HBgf55RXPfg== To: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= From: Benno Lossin Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Benno Lossin Subject: [PATCH] rust: init: broaden the blanket impl of `Init` Message-ID: <20230413100157.740697-1-benno.lossin@proton.me> Feedback-ID: 71780778:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This makes it possible to use `T` as a `impl Init` for every error type `E` instead of just `Infallible`. Signed-off-by: Benno Lossin --- @Miguel: you can squash this patch into 90e53c5e70a69 or put it on top of rust-next. rust/kernel/init.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/init.rs b/rust/kernel/init.rs index a1298c8bbda0..4ebfb08dab11 100644 --- a/rust/kernel/init.rs +++ b/rust/kernel/init.rs @@ -1190,8 +1190,8 @@ pub fn uninit() -> impl Init, E>= { } // SAFETY: Every type can be initialized by-value. -unsafe impl Init for T { - unsafe fn __init(self, slot: *mut T) -> Result<(), Infallible> { +unsafe impl Init for T { + unsafe fn __init(self, slot: *mut T) -> Result<(), E> { unsafe { slot.write(self) }; Ok(()) } base-commit: 1944caa8e8dcb2d93d99d8364719ad8d07aa163f -- 2.39.2