Message ID | 20221228174623.144199-1-carlos.bilbao@amd.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2008941wrt; Wed, 28 Dec 2022 09:47:57 -0800 (PST) X-Google-Smtp-Source: AMrXdXtgR2xr/ZydcKcjNJWRoPKyY9IG8hdH96Ib5Mc/7mtyJlXmAo0cG/i1Ppiq4f/3xjIImEVN X-Received: by 2002:a17:90a:1b23:b0:225:e670:e4aa with SMTP id q32-20020a17090a1b2300b00225e670e4aamr17137246pjq.17.1672249677302; Wed, 28 Dec 2022 09:47:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1672249677; cv=pass; d=google.com; s=arc-20160816; b=iKmH6/EH+4b5iVFqPYeBzlgFqtFosJzwBdRpCoqXBsexZD/nJ7zTLWsmErUW1+uvQN nIylKMaoIk5oQVEqHmPtXbHksfuelizeXNCok1vPOdrUFP+NlAkzCKlDmCujHtCNHP4C Wx6A46fB+wI5inucBQeX+JCBdvUM139SUU6oEzBhru41kaEWH12v8+Tmsxysp+7YxNf7 hb8IL+fZinZasvWT5KL/MGyrDd0jxD0HoWpgJW3atb+tE1WtlZMFt35SRR9WC2of+LUc cCzHXZVdsGsaKowwM3M2nW74CYjL3jomeIb6u0g/ZrcZgK0TTG2Fix4oOcIwOdW68ItH 5ozg== ARC-Message-Signature: i=2; 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=YW3onDaQGxlrWy7S5FEzVO5Irq1vH1a64bWVVAnaKGo=; b=Zgmq9j9K+wz2GxOr+Ot02suOzfqM7ZPEYvz0g2cmWGFwq3X8MqfhhNwT1LEyrMP5Ml lUKpwHWMtJEVRFJr9lpA0Bl4coFx6rttwFQI2qFiA9pHc0GnxX6KszvUKgJMrWVNQbPw LtiXSeh3AayzKfb2XTH2+9f9PAvSKEmCFH9JiMNg+yTpiOgPoBLNeA3z85zuPlmqCD41 Q8e49lJ6ziIvbBEFCMdMgS+GyA3JdW8fhAKZLTI84YwkqJB1lL5PIcqbrT/a38Su/kav U3CNjVyCofei5Jxdtyd5Muk5FgusReeY3JnVB5qPaYclR/epep1hYL5rqGCs6pZss7dE 5qOg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=IKgK1Qeo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e21-20020a637455000000b0047697539353si18013017pgn.656.2022.12.28.09.47.44; Wed, 28 Dec 2022 09:47:57 -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=@amd.com header.s=selector1 header.b=IKgK1Qeo; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233379AbiL1Rqa (ORCPT <rfc822;eddaouddi.ayoub@gmail.com> + 99 others); Wed, 28 Dec 2022 12:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232137AbiL1Rq2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 28 Dec 2022 12:46:28 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2072.outbound.protection.outlook.com [40.107.220.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC1D6295; Wed, 28 Dec 2022 09:46:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OhpX04r8Vrja47mbPMQzj8J6N2ykSLMy88+jh7x+OeZ0O4V8FeblW/3C2eWGrxrWt8P4Y0HLDfOhLc6b33/QjYRebW7gBs2QrorIwGlEvyuggppzi59a/18TFIaBRSzZ/FKuHpoBDoCBnUAKHMFljeJ3Src1Ua5lLxZ5eA0mH2lsIpRyp07UDDoVkBx10dMAZdI/X6L7l8Cf1Pqia78GJjNTgaJ/X9vFPwmZ0T7xu1RzaJRwwFRz5wzPqa0FZA6RB/6ugLQO+Ws0Gi41PCEbkJcGL4+Sc1IoQgAGTkh4+QDsLhpcxjmwrJdkWrEeysar79XnftO5fkTQTKIzMXrR/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YW3onDaQGxlrWy7S5FEzVO5Irq1vH1a64bWVVAnaKGo=; b=M9KHgnOWN78vRml2IzwSCblp9qjTwxFUcp/h/+wHqNs8PyoNv8c99hCPi9Xq/1cJz5WQSNb8LXXL05aupnvsj0WGQW6AoxulScuvJAvYmui3l8Rrb66uADOv8zptUQb8UgKnwYX3breZEjJbr+TGxLwaIUOng8Qy9ZtP/8lmNtctYzGUlyxJi5BjU3JoFrWxqu+i7iD0JqkxK7zcV/HedlCgn8qMC10YSYxIIE3EN4cmc+JvVjOeGuPUCY68i71usN/FMFS6q8jDf58ljWXFcH9ksIwyHnXDvvsDzgF1sGYtw35Xq/EelMDOFfvEt8mzPTwePFI99P79FBA7PrsVNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YW3onDaQGxlrWy7S5FEzVO5Irq1vH1a64bWVVAnaKGo=; b=IKgK1QeonQfHR1DCB1WNNcC0InqUOLDN0AO8e8ATDuq2w+/fTrxtygRkIvO+2ZVjrq6fYQf6enpjIn7PSm8QwiptcQo8TS7s5F0Jdb7Ju+qvySsY27jYwmMCz6a/WAMRd9SReIA+B2Klt3qaMMxiXHSsTWzrMw+1QyP/S1VccL4= Received: from CY5P221CA0003.NAMP221.PROD.OUTLOOK.COM (2603:10b6:930:b::21) by MN2PR12MB4208.namprd12.prod.outlook.com (2603:10b6:208:1d0::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5944.13; Wed, 28 Dec 2022 17:46:25 +0000 Received: from CY4PEPF0000C971.namprd02.prod.outlook.com (2603:10b6:930:b:cafe::dd) by CY5P221CA0003.outlook.office365.com (2603:10b6:930:b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5966.17 via Frontend Transport; Wed, 28 Dec 2022 17:46:25 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CY4PEPF0000C971.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5944.10 via Frontend Transport; Wed, 28 Dec 2022 17:46:25 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 11:46:24 -0600 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.34; Wed, 28 Dec 2022 11:46:24 -0600 Received: from iron-maiden.amd.com (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2375.34 via Frontend Transport; Wed, 28 Dec 2022 11:46:23 -0600 From: Carlos Bilbao <carlos.bilbao@amd.com> To: <ojeda@kernel.org>, <corbet@lwn.net>, <akiyks@gmail.com>, <jani.nikula@linux.intel.com>, <rdunlap@infradead.org> CC: <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <konstantin@linuxfoundation.org>, Carlos Bilbao <carlos.bilbao@amd.com> Subject: [PATCH v5 0/2] docs: Integrate rustdoc into Rust documentation Date: Wed, 28 Dec 2022 11:46:21 -0600 Message-ID: <20221228174623.144199-1-carlos.bilbao@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221207173053.1463800-1-carlos.bilbao@amd.com> References: <20221207173053.1463800-1-carlos.bilbao@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000C971:EE_|MN2PR12MB4208:EE_ X-MS-Office365-Filtering-Correlation-Id: eee8f716-0230-415b-1e4a-08dae8fb70c3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gDzxy7hgYvI0Am5XXooHXUaJ5EoLoxH/PeSs/csYQyOb6hLw2O5hRwNdVyD8sMetrA0oEIY0nx5lV/MifFpbJWiU0hDgannbZCNWD10c2Uxs7J/IYVunthbhP42YG0q9glnHl4M5yVQafDdowhDurZL18tQr/AcfaEqDi4l8obO5tWXoo5dQ/Kl41Hku5TTgDqebVKNfyrnj09/KmqW+QXu7rzeFRsQI0Ge2u7P3B78lUg3B1XCOg1oj+CAlPO/Ls1e6vZoU5X9+NuJYq4rLxW3Gwf/twobMEu1/pZI+AGOqy/nEGVkevxQuS2JLNOYdlw5Ze4pd+2fwMRKkNtocg5ruzjVfge/aYdbSTWhnpJmMy4BkP21x1VXtzYJCDO88FeteIbvBtZ8S3/xwJMewG5XjFic+2/vD/KWtmaielM4tf+QfiGTm+ysFdSa/UN8IWZuO3lSK8Fqe7QYnyt/iJ+fKeJDTJ0jpS6PGvUqsM4CUk0qdYubgouCBb3d3p+CSIRgmWx3KD2bJsoDF/uCD/bxb+e/1SdQiFKK2KpwJXp3RwE6NW2YaUl6jVWoVvHJJAykMn7QpY3wG+wTKxTXbA1smJfT0jfczEFxCZGcSxydO2Yo57U01G6Hmoje+RZPTv3wgQ7OTYeXuG+04CTXZnyIhb/Nb3zmDGEZPKVp7oT1oJGIEbUQh4HtuShxeOy+ksVvEMSQhSOdKpHQY8ae6EKSrFtd0j4vLzj37HZr5JH8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(346002)(396003)(136003)(39860400002)(451199015)(36840700001)(46966006)(40470700004)(2906002)(5660300002)(8936002)(316002)(41300700001)(70586007)(70206006)(4326008)(8676002)(81166007)(478600001)(7696005)(356005)(82740400003)(26005)(186003)(110136005)(82310400005)(36756003)(36860700001)(426003)(2616005)(44832011)(83380400001)(86362001)(47076005)(40480700001)(40460700003)(1076003)(54906003)(336012)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2022 17:46:25.1523 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: eee8f716-0230-415b-1e4a-08dae8fb70c3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CY4PEPF0000C971.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4208 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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: <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?1751577734161048980?= X-GMAIL-MSGID: =?utf-8?q?1753480877408376137?= |
Series |
docs: Integrate rustdoc into Rust documentation
|
|
Message
Carlos Bilbao
Dec. 28, 2022, 5:46 p.m. UTC
Include HTML output generated with rustdoc into the Linux kernel documentation on Rust. Carlos Bilbao: docs: Move rustdoc output, cross-reference it docs: Integrate rustdoc generation into htmldocs --- Changes since V4: - Limit rustdoc note only to html outputs. Changes since V3: - Added Reviewed-Bys from Akira Yokosawa. - PATCH 1/2: Avoid error 404 adding tag `rustdoc` for Sphinx. - PATCH 1/2: Don't use "here" as link text, describe destination instead. - PATCH 2/2: Check CONFIG_RUST in a way that allows us to skip generation. - PATCH 2/2: Reoder Sphinx runs so they complete even if rustdoc fails. Changes since V2: - Split v2 into two-patch series. - Add "only:: html" directive in Documentation/rust/index.rst reference Changes since V1: - Work on top of v6.1-rc1. - Don't use rustdoc.rst, instead add link to Documentation/rust/index.rst. - In Documentation/Makefile, replace @make rustdoc for $(Q)$(MAKE) rustdoc. - Don't do LLVM=1 for all rustdoc generation within `make htmldocs`. - Add spaces on definition of RUSTDOC_OUTPUT, for consistency. --- Documentation/Makefile | 8 ++++++++ Documentation/rust/index.rst | 8 ++++++++ rust/Makefile | 15 +++++++++------ 3 files changed, 25 insertions(+), 6 deletions(-)
Comments
Carlos Bilbao <carlos.bilbao@amd.com> writes: > Include HTML output generated with rustdoc into the Linux kernel > documentation on Rust. > > Carlos Bilbao: > docs: Move rustdoc output, cross-reference it > docs: Integrate rustdoc generation into htmldocs OK, so I just gave this a try... - It forces the generation of a kernel configuration, something that the docs build has never done until now. What are our changes of eliminating that? - It did a bunch of other building, starting with objtool - again, never needed for the docs build before. In the end, it died with: > BINDGEN rust/bindings/bindings_generated.rs > Failed to run rustfmt: No such file or directory (os error 2) (non-fatal, continuing) > BINDGEN rust/bindings/bindings_helpers_generated.rs > error: Found argument '--blacklist-type' which wasn't expected, or isn't valid in this context > > Did you mean '--blocklist-type'? Perhaps this is because I ignored the warnings about my Rust toolchain being too new? (Rust 1.65.0, bindgen 0.63.0). I get that only one version is really supported, but it would be nice to fail a bit more gracefully if at all possible. Anyway, I've unapplied these for now; thoughts on all this? Thanks, jon
On 1/2/23 17:53, Jonathan Corbet wrote: > Carlos Bilbao <carlos.bilbao@amd.com> writes: > >> Include HTML output generated with rustdoc into the Linux kernel >> documentation on Rust. >> >> Carlos Bilbao: >> docs: Move rustdoc output, cross-reference it >> docs: Integrate rustdoc generation into htmldocs > OK, so I just gave this a try... > > - It forces the generation of a kernel configuration, something that the > docs build has never done until now. What are our changes of > eliminating that? Yes, this means "make htmldocs" will require kernel .config, but only if we want CONFIG_RUST=y. AFAIK this is a limitation of Rust in the kernel at the moment, not something particular to this patch. > > - It did a bunch of other building, starting with objtool - again, never > needed for the docs build before. Yes, building rustdoc requires building new things, no way around that either, IMHO. > > In the end, it died with: > >> BINDGEN rust/bindings/bindings_generated.rs >> Failed to run rustfmt: No such file or directory (os error 2) (non-fatal, continuing) >> BINDGEN rust/bindings/bindings_helpers_generated.rs >> error: Found argument '--blacklist-type' which wasn't expected, or isn't valid in this context >> >> Did you mean '--blocklist-type'? > Perhaps this is because I ignored the warnings about my Rust toolchain > being too new? (Rust 1.65.0, bindgen 0.63.0). I get that only one Yes, it is important to have the expected Rust toolchain. You can try running: rustup override set $(scripts/min-tool-version.sh rustc) there's more information about this on the Rust Quick Start [1]. It may be annoying but you will need this for any future Rust-kernel work too. > version is really supported, but it would be nice to fail a bit more > gracefully if at all possible. > > Anyway, I've unapplied these for now; thoughts on all this? My two cents is that these are limitations of Rust in the kernel, at least on its current state, and so adding rustdoc to the Documentation was going to come with them. But if someone has any ideas to make it less painful, I'm all ears too :) > > Thanks, > > jon Thanks, Carlos [1] https://github.com/Rust-for-Linux/linux/blob/rust/Documentation/rust/quick-start.rst
On Tue, Jan 3, 2023 at 12:54 AM Jonathan Corbet <corbet@lwn.net> wrote: > > - It forces the generation of a kernel configuration, something that the > docs build has never done until now. What are our changes of > eliminating that? We could workaround it by providing a fixed, preset config that does not interfere with the usual `.config`. We would still need to compile some things like we normally would do, though (see next point). > - It did a bunch of other building, starting with objtool - again, never > needed for the docs build before. Yeah, rustdoc, like the compiler, requires dependencies to be available to understand the code. Thus some things need to be compiled, like for the normal build. This is definitely different than the current docs, of course, which is why I raised these questions back then. > In the end, it died with: > > > BINDGEN rust/bindings/bindings_generated.rs > > Failed to run rustfmt: No such file or directory (os error 2) (non-fatal, continuing) This one is unrelated -- it happens when rustfmt is not installed, so that those interested in only building (but not developing) the kernel can avoid it. We could hide the message, though for developers it is useful to know. This is one instance where knowing in the build system whether the user intends to developer the kernel or not could be useful (e.g. we could hide it for some of the distribution/packaging targets); but I would prefer to simply make rustfmt mandatory, since in principle there could be a rustfmt bug that makes a behavioral change, and it would simplify things (it comes with the compiler anyway). > > BINDGEN rust/bindings/bindings_helpers_generated.rs > > error: Found argument '--blacklist-type' which wasn't expected, or isn't valid in this context > > > > Did you mean '--blocklist-type'? > > Perhaps this is because I ignored the warnings about my Rust toolchain > being too new? (Rust 1.65.0, bindgen 0.63.0). I get that only one Yeah, that is due to bindgen 0.63.0 removing [1] some flags deprecated [2] in 0.58.0. [1] https://github.com/rust-lang/rust-bindgen/blob/v0.63.0/CHANGELOG.md#removed-1 [2] https://github.com/rust-lang/rust-bindgen/blob/v0.58.0/CHANGELOG.md#deprecated-1 > version is really supported, but it would be nice to fail a bit more > gracefully if at all possible. Do you mean failing in the `scripts/rust_is_available.sh` step instead of warning? We could also add versioning information to that script, so that it knows more about which versions work etc., but I guess at that point it would be best to simply start supporting several versions, which may be a bit too early to split CI runs on that since it would require some degree of testing. Cheers, Miguel
Carlos Bilbao <carlos.bilbao@amd.com> writes: > On 1/2/23 17:53, Jonathan Corbet wrote: >> Perhaps this is because I ignored the warnings about my Rust toolchain >> being too new? (Rust 1.65.0, bindgen 0.63.0). I get that only one > > Yes, it is important to have the expected Rust toolchain. You can try > running: > > rustup override set $(scripts/min-tool-version.sh rustc) > > there's more information about this on the Rust Quick Start [1]. It may be > annoying but you will need this for any future Rust-kernel work too. I get this part. I do wish it would fail a bit more gracefully, but I *was* warned. (I got away with building the 6.1 stuff with my out-of-spec toolchain, but luck always runs out at some point :) >> version is really supported, but it would be nice to fail a bit more >> gracefully if at all possible. >> >> Anyway, I've unapplied these for now; thoughts on all this? > > My two cents is that these are limitations of Rust in the kernel, at least > on its current state, and so adding rustdoc to the Documentation was > going to come with them. But if someone has any ideas to make it less > painful, I'm all ears too :) I'm worrying now that I asked you to do the wrong thing, sorry. If building the Rust docs by default is going to make building the docs in general harder (and break it for some people), then we need to not do that. Unless this can be made to work without forcing users to create a kernel configuration or breaking the build if the right toolchain isn't present, then we need to go back to having a separate make subcommand to build the Rust docs. My apologies, it wasn't my purpose to make extra useless work for you, honest... Thanks again for working on this, jon
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> writes: >> - It did a bunch of other building, starting with objtool - again, never >> needed for the docs build before. > > Yeah, rustdoc, like the compiler, requires dependencies to be > available to understand the code. Thus some things need to be > compiled, like for the normal build. Does it really need objtool? A certain amount of extra building is OK as long as it doesn't radically slow down the (already glacial) docs build. I'd like it to not *break* the docs build if the right dependencies aren't there, though. >> version is really supported, but it would be nice to fail a bit more >> gracefully if at all possible. > > Do you mean failing in the `scripts/rust_is_available.sh` step instead > of warning? We could also add versioning information to that script, > so that it knows more about which versions work etc., but I guess at > that point it would be best to simply start supporting several > versions, which may be a bit too early to split CI runs on that since > it would require some degree of testing. It seems like that step should fail regardless, not just for the docs build, no? Otherwise, though, it would suffice to turn a failure to build the Rust docs into a warning-level event for the docs build; I'm mostly concerned about it breaking the build as a whole. Supporting multiple Rust versions would be nice, but it's up to you to decide when you think you can do that; I don't think the docs build should drive it. Thanks, jon
On Wed, Jan 4, 2023 at 1:25 AM Jonathan Corbet <corbet@lwn.net> wrote: > > Does it really need objtool? No, it does not. That is a byproduct of using the `prepare` target to setup Rust for the descend, but we could rearrange some things for `rustdoc`. > A certain amount of extra building is OK as long as it doesn't radically > slow down the (already glacial) docs build. I'd like it to not *break* > the docs build if the right dependencies aren't there, though. I agree if we go with a fixed/preset/configless approach, because in that case we will always have `CONFIG_RUST=y` and therefore the generation of Rust docs is really just an attempt that may or may not fail (or we could only attempt to do so if the dependencies are met exactly as expected). On the other hand, if we went with the current setup, where a config is used, then if the user has specified `CONFIG_RUST=y`, I think it is fair to fail, since the operation cannot be completed, just like the normal build. Of course, we could also do the "just attempt it" approach and print a loud message if it failed, but I think, as a user, would still prefer as a user if it just failed. > It seems like that step should fail regardless, not just for the docs > build, no? The bindgen step should fail the same way for both normal builds and docs, indeed. I think I understand now what you meant by "fail more gracefully". I thought you meant fail with a better/proper message given versioning information or similar, but you primarily meant avoid breaking the entire docs build if the Rust part fails, right? Cheers, Miguel
Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> writes: > I think I understand now what you meant by "fail more gracefully". I > thought you meant fail with a better/proper message given versioning > information or similar, but you primarily meant avoid breaking the > entire docs build if the Rust part fails, right? Both would be nice, but not breaking the docs build would be at the top of my list. Thanks, jon
On 1/4/23 08:53, Jonathan Corbet wrote: > Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> writes: > >> I think I understand now what you meant by "fail more gracefully". I >> thought you meant fail with a better/proper message given versioning >> information or similar, but you primarily meant avoid breaking the >> entire docs build if the Rust part fails, right? > Both would be nice, but not breaking the docs build would be at the top > of my list. There's a bunch of simple workarounds we can use to keep going even if rustdoc fails, if that is agreeable. I'd test but maybe something like: ifeq ($(CONFIG_RUST),y) $(Q)$(MAKE) rustdoc || true endif or: ifeq ($(CONFIG_RUST),y) $(Q)$(MAKE) -k rustdoc endif or: ifeq ($(CONFIG_RUST),y) -$(Q)$(MAKE) -k rustdoc endif > Thanks, > > jon Thanks, Carlos