From patchwork Tue Jul 18 05:27:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 121768 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1521424vqt; Mon, 17 Jul 2023 22:33:05 -0700 (PDT) X-Google-Smtp-Source: APBJJlESLQSEt9CRGQJufDCvDB/p1PQYldDYL5aU20CQpIpJ3YxFuA8RhP/24keUZqh3G8L7pWEU X-Received: by 2002:a05:6512:110e:b0:4fb:242:6dfa with SMTP id l14-20020a056512110e00b004fb02426dfamr16437003lfg.57.1689658384885; Mon, 17 Jul 2023 22:33:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689658384; cv=none; d=google.com; s=arc-20160816; b=0LvhS18bpw7+30gBGupipZc2FpPUzzkBzdZcf0YnObO0PqYnQ1UNodeB69jUP3ER3q a69gV+DtU+HyCNe8xTnNzBbcfXlqUuavtPsP0dkVHDuDo83bOhtR3BIyroiJI1mbf2Wc ihMGS5BKcOyeSkxASv7Fdk0qEZUxfyh6C/p8fMFOP3dnKTbjBrZRGNWUnMMYRQSm1Ody izgT8ei1Xjjiw8UXwf52EjX9Febt89J3DtzfthjRs6gXrA/RxbGwGBo2AVksStdmWBI5 K+lBMDV/BC+s3h1Xan37nN6oC9RY2KIydBlqzrLGzUi11lTqBEPx78WqBmk/9VZUVxsA 54DA== 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=Ivw5oiMeao4TBJNfaM4Kz2iholDTGcvzBIg/V5ndSyc=; fh=idY8ZpQobwn4LBSZ5YdQwasJlU+OywLSGnM0rkTCwe0=; b=W7nE2kIBKisfDJ7roLKE3k25m72z3bnWQXFIU2LgE7OlT7QTh3Y75zt4u4eNdt+dCX gm8+hKpBoDFV+BZlU1pjIhRx43vycnFbttMCtoTX7lkW4xUZmJm+BN295f9HjlPacsiH mxAV+VAwBd3fAlb4t+1n7MEfchjK5CxvCiEBodiXGmZvwXzYowydlzIB/PTgiV4zS3Be pXGLdCzwlpdF3CW4L2G4HJ/VLAyQALg+uS/IYJS8MVo7Yki/qglY6nmwMvJK8jsdOGh5 kKuoSLRW5RUPSnE/pKxfSTJxJH3fQ25pAYssxku8O30OyEkinetx01U73ynfvVXvIckz rD+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mg7gawPh; 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 g12-20020aa7d1cc000000b005217412e3b1si602877edp.463.2023.07.17.22.32.41; Mon, 17 Jul 2023 22:33:04 -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=mg7gawPh; 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 S230336AbjGRF3Q (ORCPT + 99 others); Tue, 18 Jul 2023 01:29:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230477AbjGRF3H (ORCPT ); Tue, 18 Jul 2023 01:29:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 160CE10C0; Mon, 17 Jul 2023 22:28:41 -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 2C4F261381; Tue, 18 Jul 2023 05:28:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DD072C433C8; Tue, 18 Jul 2023 05:28:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689658119; bh=pDq8zAwwItzO8pDih79tVM9FL2q7j+cY2RORNTyXvJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mg7gawPhf5h44Q4Lw0VZmHcJu2Psn4WiMq6k3UMWA4Ilx/OzR/RGky3KmujN/7FNC b33Qsf9zyf83HOZ6EkiFugr99E16qCDkgwaeZfKr1GYFgHrfFWYvExq411QL5fCNAG WohVVmv+EsMuyCaTkAnG7fqPjF8zck7E6NxCZEGUXD9Gx5UelQfYBW8oADw19m6mPu zXdvohtqknr88s3QWR17HvhJkX8pwezvICB1X+92qfinUi/i90IGehr8v+aQkZbnEc mOb1CM4ck5yPM396PR/EqqqGgZ9Ivbffy3Qh8Xr3ZGwv2a7Rfz3zYCZn3FYx2rBiWL +swgakWgxA4lA== From: Miguel Ojeda To: David Gow , Brendan Higgins , Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor Cc: Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Alice Ryhl , Andreas Hindborg , kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Martin Rodriguez Reboredo Subject: [PATCH v2 5/7] rust: types: make doctests compilable/testable Date: Tue, 18 Jul 2023 07:27:50 +0200 Message-ID: <20230718052752.1045248-6-ojeda@kernel.org> In-Reply-To: <20230718052752.1045248-1-ojeda@kernel.org> References: <20230718052752.1045248-1-ojeda@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771735230140361632 X-GMAIL-MSGID: 1771735230140361632 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. Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: David Gow Reviewed-by: Björn Roy Baron Reviewed-by: Alice Ryhl Signed-off-by: Miguel Ojeda --- rust/kernel/types.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rust/kernel/types.rs b/rust/kernel/types.rs index 1e5380b16ed5..696d6c5a3b9d 100644 --- a/rust/kernel/types.rs +++ b/rust/kernel/types.rs @@ -109,7 +109,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {} /// In the example below, we have multiple exit paths and we want to log regardless of which one is /// taken: /// ``` -/// # use kernel::ScopeGuard; +/// # use kernel::types::ScopeGuard; /// fn example1(arg: bool) { /// let _log = ScopeGuard::new(|| pr_info!("example1 completed\n")); /// @@ -127,7 +127,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {} /// In the example below, we want to log the same message on all early exits but a different one on /// the main exit path: /// ``` -/// # use kernel::ScopeGuard; +/// # use kernel::types::ScopeGuard; /// fn example2(arg: bool) { /// let log = ScopeGuard::new(|| pr_info!("example2 returned early\n")); /// @@ -148,7 +148,7 @@ unsafe fn from_foreign(_: *const core::ffi::c_void) -> Self {} /// In the example below, we need a mutable object (the vector) to be accessible within the log /// function, so we wrap it in the [`ScopeGuard`]: /// ``` -/// # use kernel::ScopeGuard; +/// # use kernel::types::ScopeGuard; /// fn example3(arg: bool) -> Result { /// let mut vec = /// ScopeGuard::new_with_data(Vec::new(), |v| pr_info!("vec had {} elements\n", v.len()));