Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2361072rwl; Thu, 13 Apr 2023 05:36:47 -0700 (PDT) X-Google-Smtp-Source: AKy350aFiZRMxq8/wDVSFktvOJPLUy+mQQFMtAPOjBf4KL971mFFZl8N/0RTAsCHSi4vqqI9hhwO X-Received: by 2002:a17:903:2288:b0:1a5:167f:620f with SMTP id b8-20020a170903228800b001a5167f620fmr2689706plh.15.1681389407541; Thu, 13 Apr 2023 05:36:47 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1681389407; cv=pass; d=google.com; s=arc-20160816; b=NtC4nNjKCuH33J6JnwwvQ6FLud2bf49o8m1yQEahhUkDAdeA/5dUKz+MivuHRSMJah ie0AM14/LUUAOAsoaT/tGoTU85zMFbohMbgUKa3zBHvxTAwlkJGxXcGR1S9pXPTuOckB aZREZKMZvE5OmH7AVEYs0bNFfxF1iHzkSZhTUI7+XmyvXx5v928nCaTRdn/HaIaY7pxI O93VvHLYws1lKIeX0QJXenbvyMwRYPQUDJY2IUPfu6kObvf90D4T0/a8IZPy2ulMv/GE WlaDLaSxS7E9TMJttw2nt+6zygQCiZ+hKpxQa6QwGDEL5nQTlamuO0vhTBFo8fNnA8H8 2NuQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=BVZwvtbSlJvHeYYL4sRBXvG6tfbiExH/YROdtaGa9sk=; b=tObv8B7ITP+7E7L2j+CnMiBo7pGKBXL8v9Z24JZk5KELgrOxE6cL23n29JyrKXpkRr h/JQT9Ao7rCXOFsQytSnsqy4rPl/QkYL9ju9G29+fTWJlEr/S8jKd3HtDAS8u9d1aeFr INTdzkNso0iEAXRxRY4qFMbzMubpxx5lDhbJX0vL6/YvLqonTMiarq/U6HDFkveVrBIO 1cUR7EIM29BWYn9jfe4yZG2RcAd/Zwx4Xcz6DsGebRWyosh+WsYHi1dOTCAT/Wubemw1 X4+w44uzDpuFfngs9wOJgjLU/yPkNNOnwM8lKJgzHXL5QbjLw1OObY1IYVN14zLzW92p Vy8w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@garyguo.net header.s=selector1 header.b=YOUOapf+; arc=pass (i=1 spf=pass spfdomain=garyguo.net dkim=pass dkdomain=garyguo.net dmarc=pass fromdomain=garyguo.net); 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a17090341d100b001a6955c6318si75135ple.440.2023.04.13.05.36.35; Thu, 13 Apr 2023 05:36:47 -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=@garyguo.net header.s=selector1 header.b=YOUOapf+; arc=pass (i=1 spf=pass spfdomain=garyguo.net dkim=pass dkdomain=garyguo.net dmarc=pass fromdomain=garyguo.net); 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229888AbjDMMdb (ORCPT + 99 others); Thu, 13 Apr 2023 08:33:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229530AbjDMMd3 (ORCPT ); Thu, 13 Apr 2023 08:33:29 -0400 Received: from GBR01-CWL-obe.outbound.protection.outlook.com (mail-cwlgbr01on2115.outbound.protection.outlook.com [40.107.11.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A068A2688; Thu, 13 Apr 2023 05:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TL8Ko6GL7ea5eHYkAFrlSUbR21zHDAV7jdzVJbR5VdWKIpYL9GnQ1U2/sNJ+sWVBfo7Nm3F1EmXB150oRNghZvr7egGtkH0evnHzAFJL3wNmfM5ALLmZ8M5hS2TSOnVaztexF4jYvSlOf0+FMsP8nNLP050/aAH4NluQ0llfqwMS58GB666YnfjAn48X/rjd5eoLFO9MNozakm7bV75BTUO1faQisUvdVbxBsKkEXus8x4g4oQur+lAqdocyKo2RtEGsMICDcKpaEFF2f+IxV8rL6rwls39vR7BuYJdIgPEUUSVDsiXZeoJJOFWmT/2Tz0G1EOFGl0+sSIyiF6S50Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BVZwvtbSlJvHeYYL4sRBXvG6tfbiExH/YROdtaGa9sk=; b=Au3uHkiYZuiwUfTOlYHTwZSKYxUBnJ+e7KU4mDM2AI9mRy8IIVb3KinwI69itwgB8n1waYUpVCRWAVbapokViK4G3UxC22HC32fAztCIEUiOgI2G1U60k079Y1fPQ73lLhxDio+S54l/FcEPU/lfZIqZTI0a91NLe6RhW/x0wpnM93n31R8cWn4DNksEb+hpmUZ82dGPzdPZgTkZlzHtJs7YfiVj+WwVS+VGtTBvk5hEpM/ZLbJOPPm52Xt/OngfmMAt6HnoHoWpL7XiJ8H/3xPaSQlTlplQoQ+x4UrEJNwqzBXL8lygDEzAh2unDW0g9YofVOG+lBji0FGl0J5UzA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=garyguo.net; dmarc=pass action=none header.from=garyguo.net; dkim=pass header.d=garyguo.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=garyguo.net; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BVZwvtbSlJvHeYYL4sRBXvG6tfbiExH/YROdtaGa9sk=; b=YOUOapf+kNd+yXFk6bgPSfR83EvDiojrHftaMAicvxObjMhcNqJ7Ab6V5eyXUY/jXKOkkKlLsjsz3UT8qA7+hd3rfKNUF3M9hC8OuqyT+WBn/zeazRtWIsqXTpdgS5RLTDo3Lb2oHX5pbG6wOyvV6tXo8k3yWbu9mH7cxzpSm3E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=garyguo.net; Received: from LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:253::10) by CWLP265MB7008.GBRP265.PROD.OUTLOOK.COM (2603:10a6:400:1fe::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6298.30; Thu, 13 Apr 2023 12:33:25 +0000 Received: from LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM ([fe80::e1a3:5e38:b483:8161]) by LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM ([fe80::e1a3:5e38:b483:8161%6]) with mapi id 15.20.6298.030; Thu, 13 Apr 2023 12:33:25 +0000 Date: Thu, 13 Apr 2023 13:33:22 +0100 From: Gary Guo To: Benno Lossin Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , =?UTF-8?B?QmrDtnJu?= Roy Baron , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: Re: [PATCH] rust: init: broaden the blanket impl of `Init` Message-ID: <20230413133322.12d58380.gary@garyguo.net> In-Reply-To: <20230413100157.740697-1-benno.lossin@proton.me> References: <20230413100157.740697-1-benno.lossin@proton.me> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO4P265CA0005.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ad::17) To LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:253::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LO2P265MB5183:EE_|CWLP265MB7008:EE_ X-MS-Office365-Filtering-Correlation-Id: 16e8f172-be96-4141-b3a5-08db3c1b46bf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sV2m93CI0n/y6l3VypvlrmHFojYezn/RYv4/LR/ntVZ1TP6DR0PweFsb299l5PUIBEzpeOUfryfDFlauqQ/gDZHeAe787gBiFP0KncVGkGHWM3M2Ss474Jl8iH4PRYlg0hKhFl4P1en/MOitRc5XGdVti/3Gkd9sijFhDAkTGne3GE0HDrbfo+bgNNulvL9st8dm9OdTsBfVu4WhZYIZ/aTV9m3evOmzpr0DxPof60T+BfLqVa8L0FkICDX1333E+r+uQQ2yJUIu0qcDuAEJSTTo2rvMHTQcC/8tVdMXsJKEir/LldOXoQmqWMBoSUOvr+24IWVRbLKT1Ae7zQ4DPkOSK2s/+N1aa1TDWgZIQVoy2k89jcxQ8MtX90mEunJDKdP6RgufYF/C0k5ObYD/1XoG6lEUT95uH0oLAqx7RsXyOv5WFghlfEgKcD2fkRWZ/JCg2LXsG4D2KZ0U7zU3SIQ7KECNBSXCYNoZMvA5rHXmsIyVlSR1rke1v5OdkS1DmRwfkK/krHszeTtdB4Rcp2r8wGbUabu7X36vR4OSEUpVkBqvsleM6/jxBHsJ0yO1YGS2z6CokNTTF+fOR5W9ur0G7790rpd0L1yZSB+jf8I= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230028)(136003)(396003)(366004)(376002)(346002)(39830400003)(451199021)(54906003)(478600001)(83380400001)(38100700002)(2616005)(6506007)(186003)(1076003)(36756003)(86362001)(6512007)(26005)(6486002)(6666004)(2906002)(41300700001)(66556008)(316002)(66476007)(66946007)(6916009)(4326008)(8676002)(8936002)(5660300002)(81973001);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?sVIk7ajJPJliOtzKNQCMTMGmpAlf/m6ruRY2xhfRa7hflCaOh+2L/jLbraOk?= =?us-ascii?Q?6uWK5MmYvQgeLbjGcmdQGEs/bDEbBTBcb6A7ouyzF13611o626XNz0Ww9I4i?= =?us-ascii?Q?CfjX9pz1BqnplRaw/x+IXww5lyVBCSw5Ze5O/w2c57ilCKmjp46O6bL10TR5?= =?us-ascii?Q?s9rzjTse5c/pbxqbApItxKRTKI+5Go+pvxB1yE3Pp5yynBjkwty8fyHKdUG7?= =?us-ascii?Q?D0wp89O2Ko1YsnJOZcHSM2oxN2dH6snKnj/EMQ7gfNL5gvztQwoqgUPvDaiw?= =?us-ascii?Q?x3Eao5nOS/UNM6w+Lq1mDU00MBPhVvRZP/63gFwOC2JjUMMRVYB7xTEKkKvX?= =?us-ascii?Q?sAT8wBZ+t8q/ZJQcVwap+vL2QBfm24z/xUV8W8w+lcjPOTNVbciZq1JZ/KDg?= =?us-ascii?Q?BwpbZpLdhn6CIY3ZWtKIktR/pHLkl+sDVyzKb7pxnJwP+L/h1gR9BDXFbZyH?= =?us-ascii?Q?HAcxDptNd2/T7YYMtjTINuOwOd2BBfB7iovnLZR4tl0+NzvN+wM6nJwLvyis?= =?us-ascii?Q?UNHU9TioKMlLwlNcxILSrUgR+ANAjsXtW8huglMdK13HW5APB/k8qi+USCK3?= =?us-ascii?Q?/R/pwec6Z96n8b/0SHLg1Qsc63ysLYcMq7xfJS2Bmf6MYTbhQ/Kc4NTnbbI1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c9MJQUh9Fk2eR9XWtIeeLykd4KcZYfc3X?= =?us-ascii?Q?6S+cKsHW8mb5dpXrPbtgQfWjq3PJoDJQkY4nHpxe?= X-OriginatorOrg: garyguo.net X-MS-Exchange-CrossTenant-Network-Message-Id: 16e8f172-be96-4141-b3a5-08db3c1b46bf X-MS-Exchange-CrossTenant-AuthSource: LO2P265MB5183.GBRP265.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Apr 2023 12:33:25.3618 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: bbc898ad-b10f-4e10-8552-d9377b823d45 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 7VCDAHObTdkJDzZDFSNLI/keGtM9aNEvvQ042pudQS8Lo+coZ/aw2eYWnCQS7Dkrf+pDNv3h/lwORD2nUMtvDg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CWLP265MB7008 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_DNSWL_NONE, 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 On Thu, 13 Apr 2023 10:02:17 +0000 Benno Lossin wrote: > 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 Reviewed-by: Gary Guo > --- > > @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 > >