Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3956379rwb; Mon, 16 Jan 2023 15:53:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXtJztINy3IPWbDAXGsuaq/o9gUzOiLjffPYSkTdnvCB6KVkl1RshCruI2oHf2XjsyPZZ1XE X-Received: by 2002:a17:90a:4fa4:b0:226:f7d7:50f4 with SMTP id q33-20020a17090a4fa400b00226f7d750f4mr23422503pjh.21.1673913236207; Mon, 16 Jan 2023 15:53:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673913236; cv=none; d=google.com; s=arc-20160816; b=kdf2J6RL38dr3Dlzx5Q7gex6nDKewtJQb3d8BGYiTcIRloX00evD21Tb58VSuIcXA0 P4rBG2K2cg/vzHq7OfIjrpEZpCyThiniQG8UO15lfAt0ntA/vM3H8DDDbg3/1GOWIUsu Tr5RdNR4tj8ec57kf7IE+acLOAjpPdrMej3qCjZ8wt8GB5Fvdu20UZmBJ15YUl0ryyfq bWprqcEQU6EGqvErOS024+PzF5mbp1HNSAdOWPd5ByGoCQvQxNhLRt+RmvbE8JB6UH0M AT+4AzfRRc8GphVe9BEdLvcG2809BRCMxFoL92mYcIYqFpprmsgoLlzvvE4J3wH5g5OO 7cJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2eGx37EmHA0N0W9tODp3iY+Jtr51iEGe4dAXEDxPGHg=; b=ni2VAkzlYpEBRTxGmW3Kbqh0en9kJR/Yf3+166f1F8rLV4SXSIKQPzNToB7AOUESol M909A5Q+dCGWnPFpbaB1jSoKk1l4kh2iFpgh4f5OUI6AQPfra/UNOU829MJCPV/gmdEW 2VVhHtJimci9okYs1DeroC01eOIYzi1+W7yPWnJcCkYTFpU9KvZd2ULwXK3wgi6bc8dv FNYNBccmWyj16ylsD9h2MOy45YjIq6rsAGWf/cCyfaz3tv4cokuoMGHnYF4YG+OMhtZt rINMwC6Fpqi+ujmUcU/k8PhL0zgixKi7CibJ2W5VcImJnalmrbNHPD31Ok0tkrGw0txt QK9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XRlIs7dh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq14-20020a17090b380e00b00226ef87dce3si795085pjb.98.2023.01.16.15.53.49; Mon, 16 Jan 2023 15:53:56 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=XRlIs7dh; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235193AbjAPXfN (ORCPT + 49 others); Mon, 16 Jan 2023 18:35:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235520AbjAPXew (ORCPT ); Mon, 16 Jan 2023 18:34:52 -0500 Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 963E14EF3; Mon, 16 Jan 2023 15:32:12 -0800 (PST) Received: by mail-yb1-xb2f.google.com with SMTP id a9so15320807ybb.3; Mon, 16 Jan 2023 15:32:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=2eGx37EmHA0N0W9tODp3iY+Jtr51iEGe4dAXEDxPGHg=; b=XRlIs7dhg5iCvVEvX8TYR7BIQKWSK4S519EMsig4S5hCPso4dy7drqtAvz6p3eSBk9 TL9nFCr1BHLTa/c154LoKHJxh3bg+zI74O6EVrr1xoP5MHfNiypcPqxsnhkkbpIrQQuu GuWKMCHBBY+Op8eDdAMcV3jZ9tpnlV19zXWNLzGzC2eag5zGIn5UzTLIzWQjAHb/tdvM 7wxakp2+ndRz65RdQfgyxVWNNJmSobFZOgUKAOcopDU5EfuHSHDddPDacsMHVDQ+zjtT uRXhjiCzOw6fHAgZVPkK1SYmMuYnLCvGN2G2NxAQLlTxyju4nGP5M6+7QwQeF08oh2SS 2Grg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=2eGx37EmHA0N0W9tODp3iY+Jtr51iEGe4dAXEDxPGHg=; b=lzxOOobC0PcGkH3//gyBHvUWgbVEoN1yogqG1l1lgA8tu+9dfCwZ2kikry20T+BBMt RAlJ7HjnGd4vUGuTNmJ7B6c26UTQNIxAMgg2FOtataFQysNxBfoVxz//CORrp0NxzGnt kvxTb+Oig8xjH4EgzDWvWfp+r5IEVtWeHrPEAmK2htrbkYPrmb8aINeF703QQyolE0t8 khEhPL2Mzt/Mdjdo0fDlV9dbPtrHGxPvxgSLkAS4Tv7ihQCzPn2cMeio8oGFlWIZ/ogq NBhq35zE8qpHXnIn8NP8Qis5nrbpeAdWXp8AFBqyT6TZbbRyUK1lnSOCz/vXS/H9gvfr VR1Q== X-Gm-Message-State: AFqh2koKhuVuFtPKpp1BwzHWApwwe+bZwrs24ySNUU3hvYmhyKVb6XY3 v5x8dGDjsBYlzuJiRyFlhpp69ZewAW4PB4uriZOTsc0PSFkIU6qi X-Received: by 2002:a25:ca51:0:b0:7bf:b130:9e24 with SMTP id a78-20020a25ca51000000b007bfb1309e24mr195541ybg.328.1673911931888; Mon, 16 Jan 2023 15:32:11 -0800 (PST) MIME-Version: 1.0 References: <20221206010519.39075-1-ojeda@kernel.org> In-Reply-To: <20221206010519.39075-1-ojeda@kernel.org> From: Miguel Ojeda Date: Tue, 17 Jan 2023 00:32:00 +0100 Message-ID: Subject: Re: [PATCH v1] rust: alloc: remove the `borrow` module (`ToOwned`, `Cow`) To: ojeda@kernel.org Cc: Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Josh Triplett Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 Tue, Dec 6, 2022 at 2:05 AM wrote: > > From: Miguel Ojeda > > The `Cow` type [1] requires that its generic parameter type implements > the `ToOwned` trait [2], which provides a method to create owned data > from borrowed data, usually by cloning. > > However, it is infallible, and thus in most cases it is not useful for > the kernel. [3] > > Therefore, introduce `cfg(no_borrow)` to remove the `borrow` module > (which contains `ToOwned` and `Cow`) from `alloc`. > > Link: https://doc.rust-lang.org/alloc/borrow/enum.Cow.html [1] > Link: https://doc.rust-lang.org/alloc/borrow/trait.ToOwned.html [2] > Link: https://lore.kernel.org/rust-for-linux/20221204103153.117675b1@GaryWorkstation/ [3] > Cc: Gary Guo > Cc: Wedson Almeida Filho > Cc: Josh Triplett > Signed-off-by: Miguel Ojeda Applied to rust-next, thanks all! Cheers, Miguel