From patchwork Wed Jun 14 18:08:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 108117 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp155384vqr; Wed, 14 Jun 2023 11:44:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7syfe2gC0C1cbRDrJLpGhaIz4bzzFfx26rHGCjGz02Bc/vw5Q3rmVLTtBifQ62tNoU/aX3 X-Received: by 2002:a05:6a00:15ca:b0:665:bd58:c954 with SMTP id o10-20020a056a0015ca00b00665bd58c954mr3720756pfu.10.1686768257695; Wed, 14 Jun 2023 11:44:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686768257; cv=none; d=google.com; s=arc-20160816; b=Dmz9kpMuRB80s5cos4JwG0CbNNsSKJ1K2elwAVo6XVJ7Kng7Kyx85u7PKwqs156l1G ui6Iygh6qyfQlsV25kxO9+Ofq71LczeGV2RmRM+1LQAc5zvdyFuEvonlaqthZh9awr6G QBK5Isbu19sSW7Zxt92/0BWat5XmrwYxVLMFOlR1zurl5fUGPa7Mr11WCL8ezDrzdXUF 2nIm2gwkDBk+e1pGYyxw8xDn8b//4KQJhLQm73dfvYMNMSQc7Rb+bddxb2FS6GGpjrYF z63nUsWzPdSHk6p1EjjnTQA8akiWR469g00wtzPNzs4SDUp+jmGwNXQlUZunIrjkTVwD 6d0A== 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=hBumrll4Q7alm3AFN39Ok9C2N7fY2B2j8pb2igZiLxo=; b=w7WoF62eR6pnpXtYubpSA3iY92mJJ5m2aWOgVMQbPTHyUr64qphCvaAqdgjaNG/eki bwIEcLN5V90aJrA9Kb5q8KsRnmURdFBhBwqbJcqjuqJRt1rMPjmxt7tGP66UtRez6+10 0/Mr9/6VK2CdySENLqpLIDBEdVPCyWmH3oFGjC41xEXFUDccvtxNP9CPuvBXNLfJ1anj J67HMdK9T72nXgcnT+8ZlPxZUBGxj4ntjlE7MZN/b7+cglbIPxz2+WyqGGcIe+esbvtu H/Ag30P/H8uvXpRGPC2DboG/q228WG4bBJrGCwaMe1aIISewPFVmESSgGKUNqvdlE+kU 6juw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=oT2G6znf; 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 c1-20020a637241000000b005481915c0c6si74018pgn.31.2023.06.14.11.44.03; Wed, 14 Jun 2023 11:44:17 -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=oT2G6znf; 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 S241544AbjFNSL7 (ORCPT + 99 others); Wed, 14 Jun 2023 14:11:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241546AbjFNSLe (ORCPT ); Wed, 14 Jun 2023 14:11:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9981C2D45; Wed, 14 Jun 2023 11:11:03 -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 4EADC60B50; Wed, 14 Jun 2023 18:09:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1D662C433C9; Wed, 14 Jun 2023 18:09:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686766178; bh=ehcluNxu9TSlphXGqNkHOa/SpBNYxUq22Vm5jtRhQQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oT2G6znf/4h74wnGmSfriDkF2nvXPdzTqMI4UMOv+vWu3KFM9VaVXeGXH0g5Vjy7Z SORLaZWOttT/1lVnc56iIxYDSGEfBO2/dwxvZLgyKUDvn9wS0NJRNaoKliVqZKPruh FC30wTiLC7Tp5k0qFdl8brvltePdc0M3OOlTgOxfrGRizWVOgmldXKqq7mTuV+3ykb 3QpJjdx+pyFADdUWuF989LJjFAPWyTNjfCS1yvN6TPdSfITrg81O41ACS5aEbIDsrM TR7hBTRSuNiDqYDj2va8BL3InVnvLJyTdUmE6QddoICDQFNSI5Rj7bDkBLkB2LZAEu fa3Bs9ZYFGmZQ== 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 , Philip Li , 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 4/6] rust: types: make doctests compilable/testable Date: Wed, 14 Jun 2023 20:08:28 +0200 Message-ID: <20230614180837.630180-5-ojeda@kernel.org> In-Reply-To: <20230614180837.630180-1-ojeda@kernel.org> References: <20230614180837.630180-1-ojeda@kernel.org> MIME-Version: 1.0 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768704712753857550?= X-GMAIL-MSGID: =?utf-8?q?1768704712753857550?= 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 Reviewed-by: Alice Ryhl Reviewed-by: Martin Rodriguez Reboredo Reviewed-by: David Gow Reviewed-by: Björn Roy Baron --- 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()));