Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp3693335rwo; Mon, 24 Jul 2023 15:21:54 -0700 (PDT) X-Google-Smtp-Source: APBJJlEa3KWYk8Yfcskz3H6whlQcQOiyIs8NNOP1s1j9O+PDl+92+9H2AQyECL6Xf6iQHXSFIHLu X-Received: by 2002:aa7:d94e:0:b0:522:2d1b:5a38 with SMTP id l14-20020aa7d94e000000b005222d1b5a38mr3243614eds.10.1690237313739; Mon, 24 Jul 2023 15:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690237313; cv=none; d=google.com; s=arc-20160816; b=ATmP34SVdqnUf1sZVaqgsayjb5MTyPHOQNQIgeeQprTN3H1AwY70FyV0wk6OhSSYI9 WmGqmZWt6LZ7rMpnd8P3NhU3qFAAu38YUj1jSthQBJVcmN7uAPeir4V7ATTHLZi1Mhtx FDHqbgArRNcFGtGwVDx78ztdRnPOTLzDFqwAxHtu7g1mjh70cjN06p0hHETIFO0S9jrj kODJYbHy7Kp6+Eo1BZ11LmnjFso9+myWzIm5RcPDqNMLCG1xjjNgi4bVm4MGeTWYAVK5 aq/GTu1jkhOfG2wJdp7XJ4BC0afEvbdrR6EJVNcHS6zdthFfdn8xjxmthzJ4/GXBSp1+ N9ww== 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:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=mQ0wVbJZR6Qqo1f6a7btQ5EY0YN+6oKaQQ8JxSOeS/w=; fh=cX4cQe/qLh2j2xzU2hFT53NPOhKQe3MBdETDT8Hd1jw=; b=CGnntyVrTYt7q5I3GT4BdrDmBZXP/OLveQjOLFeCVihbsWUYWVVBsA8fuCToki8q/F tVphX8W3LtjSEH8orIH/bMAgc/RXVnlP0Ik7AD+kb2coot3BfCDgmZ+F7vrTYS+tAPZm A5+nRue1bOuKKgPe5WfKKzW8ZsYpBxIlvqEHtIBim+oDJqMhXhDf9npW5T7z7V6Xh+Xh n8wHFuoGsRz/KacNLl7UJ+/2hwif/uKHYezL1ms2j7LmurLYHYBOlMMNnHSxfqcZFE++ nVg5kEG1+ljuIQrzvncSEfqKa68/a7aC65HaYwPxJ8SawHt7MBzh2ZGBi7Y83IIVdH1+ kMjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=gB22Eo3q; 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 t18-20020aa7d4d2000000b0051d882750d2si6966407edr.569.2023.07.24.15.21.29; Mon, 24 Jul 2023 15:21:53 -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=gB22Eo3q; 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 S229949AbjGXVzT (ORCPT + 99 others); Mon, 24 Jul 2023 17:55:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjGXVzR (ORCPT ); Mon, 24 Jul 2023 17:55:17 -0400 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65DA6118; Mon, 24 Jul 2023 14:55:15 -0700 (PDT) Date: Mon, 24 Jul 2023 21:55:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1690235712; x=1690494912; bh=mQ0wVbJZR6Qqo1f6a7btQ5EY0YN+6oKaQQ8JxSOeS/w=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=gB22Eo3q0kUmG8e6tgL+f8mLMNn6WdDfiToEXTVAgaHbWsVdYEeVX6n9+kZTxqXHZ kgPc+e0ujGzBYji5jP3IZ9YITKZhKbQBHHE3KVS8mIkPFgJrqHUo5J2wYgz81IM1h1 GBEYfSMhymndkTxv6iG2TE5fBWDJbTX6C6IDG/CH/y4eQg34mztVIoWoPQt9rAuRH9 B/RJYJkjhHGqSlWJo77J9kEBVSG+Zzl5a3Pdw5s3J7Fh6HI9yB/xlbCjepqEsPM+bl n4dRgL90afLOBXkEMlaSNd5JrDze2btqR2lEarQt12rh4XW20E3ucIjxuOC0jEEtOd mPjkmb/7+U6YQ== To: Martin Rodriguez Reboredo , Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor From: Benno Lossin Cc: Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Alice Ryhl , Andreas Hindborg , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Asahi Lina Subject: Re: [PATCH v2 11/12] rust: init: add `{pin_}chain` functions to `{Pin}Init` Message-ID: In-Reply-To: References: <20230719141918.543938-1-benno.lossin@proton.me> <20230719141918.543938-12-benno.lossin@proton.me> <0b818707-4762-c12d-8624-7d3c4f6841da@gmail.com> <5f22b25d-132d-7cbc-8bca-8333516c1663@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_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 7/24/23 18:07, Martin Rodriguez Reboredo wrote: > On 7/24/23 11:08, Benno Lossin wrote: >> This is a bit confusing to me, because dropping the value on returning `= Err` >> is a safety requirement of `PinInit`. Could you elaborate why this is >> surprising? I can of course add it to the documentation, but I do not se= e >> how it could be implemented differently. Since if you do not drop the va= lue >> here, nobody would know that it is still initialized. >=20 > I knew about the requirement of dropping on `Err`, but what has caught my > attention is that `{pin_}chain` might not abide with it per the doc > comment as it says that `self` is initialized before calling `f`... >=20 > /// First initializes the value using `self` then calls the functio= n > /// `f` with the initialized value. >=20 > But one can not know what would happen when `f` fails, specially if > such failure can be ignored or it's only temporarily. >=20 > So then, the best course IMO is to mention that in some way the value is > still being initialized, kinda setting it up, and that it will be dropped > when an error is returned. WDYT? I see, then I will just expand the documentation. --=20 Cheers, Benno