Message ID | 20230614180837.630180-3-ojeda@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp154221vqr; Wed, 14 Jun 2023 11:41:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ77oOrzFxl87HSrYKE2P756/3fljU/IXvZE3mbbOvOucV+Sq/bdDuuSw7CEgnjKa23F9psd X-Received: by 2002:a17:902:e314:b0:1b1:b0d6:669c with SMTP id q20-20020a170902e31400b001b1b0d6669cmr9814938plc.18.1686768095022; Wed, 14 Jun 2023 11:41:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686768095; cv=none; d=google.com; s=arc-20160816; b=nhikdEhj84fox7pxpRjUbgSXYMwzjJsy/y8NknRv5fwBB+Bx/RsnuXs3Q/H/gLHv31 pGjg06dcIQ7KO+UZOn9AvdyX/hBUXEof7ElCUd8KvSI1+Dce3zyZuo3jrbz1LkLuZyOs c83ai7xWur6suo3Cwiuf86YJ+OROqu5VEIiC0YAgEjIApKusPyyPRkj2YvuBrSBf7JKs YsiCm+Ymmj3uSzusKKzrsbbKha2VFnGIoU7XjSojf/VZccZ99I1CrhHeHOgF9MNL3AWF Dh1hloxX2ZKKgLmCDcJ2maNfOS87k6cyrZWX+/0NNBX0H9rTsSKMJ0W5pc52sOU3H7Qz bZHw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ipjZXb1VzUHl3jjrHU65YZcrCDgPLWvlgsppHU10GVA=; b=JhRiaERBmrmo9aodi+4aKNoU8pvDFRH+jdF4tVItnH4zTOngX6ERrlB8jkXYEUa2cP jtUKVceWlR3dEC7hXdpZEkH9wOPmbRSa1NzB5UEKTt5ol9BLm4Pye+eNYl79xwfYl5H6 xztQsjumqD3duGdYRkycfI554vA68oObOe5euEov7Qzsd/dBGBvCqSjWQCLihwVthgip lp6R9hM8OFyCmB5BXjyr2Wvor7J8D7jzn2pbptNfxt7eLxfejgdFotXNnXe7NSA/WxpE uxT59sSBEKz0Vqc9J8UqnkERXiUO3bt1niC5zlox9LHxrxpYCWyCoppJhDsNEvW+Pkyq PEew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jp5+Lria; 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=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a170903105100b001aad291018fsi3745591plc.350.2023.06.14.11.41.21; Wed, 14 Jun 2023 11:41:35 -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=@kernel.org header.s=k20201202 header.b=jp5+Lria; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236270AbjFNSLZ (ORCPT <rfc822;n2h9z4@gmail.com> + 99 others); Wed, 14 Jun 2023 14:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241008AbjFNSKx (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 14 Jun 2023 14:10:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 330AA2686; Wed, 14 Jun 2023 11:10:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DC2A964593; Wed, 14 Jun 2023 18:09:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A76AC433CB; Wed, 14 Jun 2023 18:09:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686766170; bh=5RT+1Ed3wlNsUFIiAUAkZSAQ11PIAvj/hYAZC9K3F20=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jp5+Lria9yAWeZ9iJIHusdDPiBgUStgV1fZbEIkuGm0YYbXiN2gdl5764EREsXEzj 18FTtiUIgcYWl4Oi1wu1loAaLje/vubVlOBYjTgqvPA3eUTBctLd3cHS8OcRulyh5E K1Z/6A9kX9pacfQa2UCAeVQDnHZm9dJvDviqjtdrWCpex4IzYPToohgXvYwOeCb1hB gD+iCd85RSQKnwREDCJAzRh0OgASYUzVi3Rvk0t+gCje/dyeL5aM27i2ves126vdVu k196MykQcl6X4iLIc06xPHrGbJYp9VIE87x+8Hq6GMXEiQGaRteuzw9INUgXPAMV+e wfis52c4BHgKA== From: Miguel Ojeda <ojeda@kernel.org> To: David Gow <davidgow@google.com>, Brendan Higgins <brendan.higgins@linux.dev>, Miguel Ojeda <ojeda@kernel.org>, Wedson Almeida Filho <wedsonaf@gmail.com>, Alex Gaynor <alex.gaynor@gmail.com> Cc: Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Alice Ryhl <aliceryhl@google.com>, Andreas Hindborg <nmi@metaspace.dk>, Philip Li <philip.li@intel.com>, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev Subject: [PATCH 2/6] rust: str: make doctests compilable/testable Date: Wed, 14 Jun 2023 20:08:26 +0200 Message-ID: <20230614180837.630180-3-ojeda@kernel.org> In-Reply-To: <20230614180837.630180-1-ojeda@kernel.org> References: <20230614180837.630180-1-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768704541876456810?= X-GMAIL-MSGID: =?utf-8?q?1768704541876456810?= |
Series |
KUnit integration for Rust doctests
|
|
Commit Message
Miguel Ojeda
June 14, 2023, 6:08 p.m. UTC
Rust documentation tests are going to be build/run-tested
with the KUnit integration added in a future patch, thus
update them to make them compilable/testable so that we
may start enforcing it.
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
---
rust/kernel/str.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Comments
Miguel Ojeda <ojeda@kernel.org> writes: > Rust documentation tests are going to be build/run-tested > with the KUnit integration added in a future patch, thus > update them to make them compilable/testable so that we > may start enforcing it. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Reviewed-by: Alice Ryhl <aliceryhl@google.com>
On 6/14/23 15:08, Miguel Ojeda wrote: > Rust documentation tests are going to be build/run-tested > with the KUnit integration added in a future patch, thus > update them to make them compilable/testable so that we > may start enforcing it. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- > [...] Reviewed-by: Martin Rodriguez Reboredo <yakoyoku@gmail.com>
> Rust documentation tests are going to be build/run-tested > with the KUnit integration added in a future patch, thus > update them to make them compilable/testable so that we > may start enforcing it. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
On Thu, 15 Jun 2023 at 02:09, Miguel Ojeda <ojeda@kernel.org> wrote: > > Rust documentation tests are going to be build/run-tested > with the KUnit integration added in a future patch, thus > update them to make them compilable/testable so that we > may start enforcing it. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- Reviewed-by: David Gow <davidgow@google.com> Cheers, -- David
------- Original Message ------- On Wednesday, June 14th, 2023 at 20:08, Miguel Ojeda <ojeda@kernel.org> wrote: > Rust documentation tests are going to be build/run-tested > with the KUnit integration added in a future patch, thus > update them to make them compilable/testable so that we > may start enforcing it. > > Signed-off-by: Miguel Ojeda <ojeda@kernel.org> > --- > rust/kernel/str.rs | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs > index c9dd3bf59e34..c41607b2e4fe 100644 > --- a/rust/kernel/str.rs > +++ b/rust/kernel/str.rs > @@ -213,6 +213,7 @@ impl fmt::Display for CStr { > /// > /// ``` > /// # use kernel::c_str; > + /// # use kernel::fmt; > /// # use kernel::str::CStr; > /// # use kernel::str::CString; > /// let penguin = c_str!("🐧"); > @@ -241,6 +242,7 @@ impl fmt::Debug for CStr { > /// > /// ``` > /// # use kernel::c_str; > + /// # use kernel::fmt; > /// # use kernel::str::CStr; > /// # use kernel::str::CString; > /// let penguin = c_str!("🐧"); > @@ -529,7 +531,7 @@ fn write_str(&mut self, s: &str) -> fmt::Result { > /// # Examples > /// > /// ``` > -/// use kernel::str::CString; > +/// use kernel::{str::CString, fmt}; > /// > /// let s = CString::try_from_fmt(fmt!("{}{}{}", "abc", 10, 20)).unwrap(); > /// assert_eq!(s.as_bytes_with_nul(), "abc1020\0".as_bytes()); > -- > 2.41.0 Reviewed-by: Björn Roy Baron <bjorn3_gh@protonmail.com>
diff --git a/rust/kernel/str.rs b/rust/kernel/str.rs index c9dd3bf59e34..c41607b2e4fe 100644 --- a/rust/kernel/str.rs +++ b/rust/kernel/str.rs @@ -213,6 +213,7 @@ impl fmt::Display for CStr { /// /// ``` /// # use kernel::c_str; + /// # use kernel::fmt; /// # use kernel::str::CStr; /// # use kernel::str::CString; /// let penguin = c_str!("🐧"); @@ -241,6 +242,7 @@ impl fmt::Debug for CStr { /// /// ``` /// # use kernel::c_str; + /// # use kernel::fmt; /// # use kernel::str::CStr; /// # use kernel::str::CString; /// let penguin = c_str!("🐧"); @@ -529,7 +531,7 @@ fn write_str(&mut self, s: &str) -> fmt::Result { /// # Examples /// /// ``` -/// use kernel::str::CString; +/// use kernel::{str::CString, fmt}; /// /// let s = CString::try_from_fmt(fmt!("{}{}{}", "abc", 10, 20)).unwrap(); /// assert_eq!(s.as_bytes_with_nul(), "abc1020\0".as_bytes());