Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1201864rwd; Wed, 31 May 2023 10:42:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6R3fJ0hsPOsTJCf/Kp4m+grY6eJZYjG3nH1twrkL+rZwl5Ks+CLoSdgMjPcSElu4D2h+Jg X-Received: by 2002:a05:6a20:430e:b0:10f:472f:ffbb with SMTP id h14-20020a056a20430e00b0010f472fffbbmr16989278pzk.7.1685554931121; Wed, 31 May 2023 10:42:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685554931; cv=none; d=google.com; s=arc-20160816; b=EyQOd9yiL3FCMD7+sGgs+dXNniBQnHh9nfC15ieoLibHreGMNWnW1SDJ6Ap4vgP35y Rj3pqXb2PnWr5ORQBzI2IyDfPx6A6mTfngYXKyDdbPK6hBGJp2/mBCAj2xaur8mhPt9I kRUfUAAsHoLUJsKZ9/9IJx+fn0J62ENzX9DXWBb6fv0ZYYmAn9/cUb6sL2a+m2IGP40V i8TbLAovyOn2EOnPNv4uK9V5MgRT9pHIQ1IrUoPfBXf4VvEy2sMSO/RRCTlJhU/lfv/Z ZzGiXpsPEU3bXe0nAA7ODyYI26KDVk7RRINZCFA/7ajPmnToMFaLwJhN6dnVzZdTfI35 gSdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=j5hNAeMykYH6m+pjlK4ZKQGtK0LDuyxxmWVTG0iy4gk=; b=VME3SSC2m+KTYrR4jDcbMK+xiCdDYTV6w7OPh9WlZ/df0tQ2q/qI+efxBYifApl+pZ azdrpDPtx95k8D7KJ0EqZ0gISdTZk67Z6HH41h8a0MIbuVKdeNm5T/PhciGiRfcR9i4j lsrYR5kH6x/6nlb84igpzzwdBoFVmD/ZAfhuQ4JCvlIi2jGeTgO4UCdaVFa6KNqqcEYM 6sT+Wa/GPz2kSCkoI6c5+/n7EM9em8h24VWBYm6WZfCFXe0lkDa0cr1r71OJd59k+0ZZ ggZZIceaOXDg8g99dLbpTz7vZi8VtcvDpCT7defaJURZZl1dXMefeVOgCPMDIPgNbVFy DGtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=RgBb769D; 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 1-20020a630101000000b0053f25281d14si1312120pgb.546.2023.05.31.10.41.51; Wed, 31 May 2023 10:42:11 -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=@gmail.com header.s=20221208 header.b=RgBb769D; 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 S230115AbjEaRKK (ORCPT + 99 others); Wed, 31 May 2023 13:10:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230291AbjEaRKF (ORCPT ); Wed, 31 May 2023 13:10:05 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70112135; Wed, 31 May 2023 10:10:04 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id 3f1490d57ef6-ba8cd61ee2dso1815361276.1; Wed, 31 May 2023 10:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685553003; x=1688145003; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=j5hNAeMykYH6m+pjlK4ZKQGtK0LDuyxxmWVTG0iy4gk=; b=RgBb769DkAHCjoOyku0LjFwuuuVlYaimpuChbm/e6uqQonNgWj6Wkw86cPMdU6eXz3 IKYl4uH6w2nuanrD3CiroKb7ap7n18bm2RMoeLg/lKSqp/8MdBmzkuXUOIldyx2OkRT3 ZzxCY3GKi2PQtdVqYrIBrp+fD4+xUvumOR+8v200q+Pmz6dY7YhinaEm8VmIbSzMeb3H S0ZI1aUrGebHJfqc29jWbkXjDdoLXBgdVvnvhT1Hd/QL3kg3qRFs8A5YuV4dpOsgxydk 6tsP9dzvIlUb7JwM8sIneb6X4//FQJ755f8Khi6Ktc4kjIQAgt/l6LC7qbc8+/mXs584 Hgaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685553003; x=1688145003; h=content-transfer-encoding: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=j5hNAeMykYH6m+pjlK4ZKQGtK0LDuyxxmWVTG0iy4gk=; b=R36eYezjeLlKLMvrBQGZQEMD+y/cSHl/5Cnoot47kI5bpa3QIxxOYbJTvyschm2XZK vtPZBlINl3dhMhkLbQvlVVVsZHLLsxzisLzliDtokBLRPyhnnlz9LMlPWLfQqzS+iaQx /qciYJAaDQWV7SmaItmNtQKzs98+ShBW5s7AsVWypxf2pJy7PQkNAG4kOmAoat5EflE3 ixPhaZC+aUT6Urc8DfxFgxKxJcE1oEPO4Is1aplbqDhcSm6gE3dMAH3W01+RGkguQDIE yJEk2TQYTBizLOz78vlkYRS7iEfXLG7SglTEK3wJZkN54UA/xPYtWcZF1ybDMOp7JlTJ Ph8A== X-Gm-Message-State: AC+VfDyTPRttT8shWm6cun4nBbTz1JU3U3oc68Q+fVnAuwjaUPUr2zTs d3E2RQajyB86rycF6RddSRsmJMcZlCF0RVWvXvA= X-Received: by 2002:a25:e64f:0:b0:bac:fd8d:94b5 with SMTP id d76-20020a25e64f000000b00bacfd8d94b5mr18876773ybh.13.1685553003652; Wed, 31 May 2023 10:10:03 -0700 (PDT) MIME-Version: 1.0 References: <20230503141016.683634-1-aliceryhl@google.com> In-Reply-To: <20230503141016.683634-1-aliceryhl@google.com> From: Miguel Ojeda Date: Wed, 31 May 2023 19:09:52 +0200 Message-ID: Subject: Re: [PATCH v2] rust: str: add conversion from `CStr` to `CString` To: Alice Ryhl Cc: Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Martin Rodriguez Reboredo , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev 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,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Wed, May 3, 2023 at 4:10=E2=80=AFPM Alice Ryhl wr= ote: > > These methods can be used to copy the data in a temporary c string into > a separate allocation, so that it can be accessed later even if the > original is deallocated. > > The API in this change mirrors the standard library API for the `&str` > and `String` types. The `ToOwned` trait is not implemented because it > assumes that allocations are infallible. > > Reviewed-by: Benno Lossin > Signed-off-by: Alice Ryhl Applied to `rust-next` -- thanks everyone! Cheers, Miguel