From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DD6D933F5A3 for ; Mon, 20 Apr 2026 14:58:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776697112; cv=none; b=QZg325CiLh0/d9bBUT1rmZYfgqDIpHlbSgUcs++aYWSZ2ClcssuST0uu+3RXtsmMoT2sZg2YJPrp9cx5aKKkNKgFoShtofghJoR1H7pV17rd8GZ7DBgacixazcq/9EzJrJPHBRl9klWkWh2lGJhZg4VLfSJQ/jObRbYGsqdb3P0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776697112; c=relaxed/simple; bh=La7BzzpXqI58WrZF9FvO0D48PeMdGO8j5VSs9KxLCTg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PkKJb6ZPq9MIqklsMrU69n8nRLpnqvM3TK8CGLMak+seVVv8LBn6DK45cGL8nFL65S8O52VRs2A91ONpAyt5g9BtNzJHWqADJfB64Kq8uqx3HMmFE7k0ddsDYcOhmxSKv7JH4gcbjIIjnBMQWPe1d8QiEgF4zIOgXXUDwRvEYgk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b9cVgZ/K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b9cVgZ/K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF491C19425; Mon, 20 Apr 2026 14:58:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776697112; bh=La7BzzpXqI58WrZF9FvO0D48PeMdGO8j5VSs9KxLCTg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b9cVgZ/Kii5tzN0kiFYjzJQDlqJq1EzzDTocWGQAhTEVu9gWpo6r75m5wzYC7kc2Q mlTxD2/h5rQkUsyFvochm4otITVTeunfuwBp0YP4rSPeKIJ++GOEHIyAHtP5heYslQ I1pGZFW+7ku1j6uJFBDblHBQmBgCkAHW+/u2GtOr04mu+xUQNpde9ewk1xobuxQ+zr Kxi3fy0x3cQldFFgMGKv/HMev8aRQ9dh8HoDOu3h8g47qAt4gnQGALqz2WNBIOlL1o ruE86xk0azuanl9dciaJWtilf+9HPMN6WkwEy07IrM0lqILNq0pMXQGID8/PiF2b3O Odiafe7pyBvTw== From: Sasha Levin To: stable@vger.kernel.org Cc: Tamir Duberstein , Daniel Almeida , Fiona Behrens , Trevor Gross , Sasha Levin Subject: [PATCH 7.0.y] scripts: generate_rust_analyzer.py: define scripts Date: Mon, 20 Apr 2026 10:58:30 -0400 Message-ID: <20260420145830.1151150-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026042045-drool-wheat-4281@gregkh> References: <2026042045-drool-wheat-4281@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Tamir Duberstein [ Upstream commit 36c619f6bd793493294becb10a02fea370b67a91 ] Add IDE support for host-side scripts written in Rust. This support has been missing since these scripts were initially added in commit 9a8ff24ce584 ("scripts: add `generate_rust_target.rs`"), thus add it. Change the existing instance of extension stripping to `pathlib.Path.stem` to maintain code consistency. Fixes: 9a8ff24ce584 ("scripts: add `generate_rust_target.rs`") Cc: stable@vger.kernel.org Reviewed-by: Daniel Almeida Reviewed-by: Fiona Behrens Reviewed-by: Trevor Gross Link: https://patch.msgid.link/20260122-rust-analyzer-scripts-v1-1-ff6ba278170e@kernel.org Signed-off-by: Tamir Duberstein [ changed `[std]` dep to `["std"]` and kept untyped `is_root_crate()` ] Signed-off-by: Sasha Levin --- scripts/generate_rust_analyzer.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_analyzer.py index f9b545104f21f..2fca0e70757ee 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -188,6 +188,18 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit append_crate_with_generated("uapi", ["core", "ffi", "pin_init"]) append_crate_with_generated("kernel", ["core", "macros", "build_error", "pin_init", "ffi", "bindings", "uapi"]) + scripts = srctree / "scripts" + makefile = (scripts / "Makefile").read_text() + for path in scripts.glob("*.rs"): + name = path.stem + if f"{name}-rust" not in makefile: + continue + append_crate( + name, + path, + ["std"], + ) + def is_root_crate(build_file, target): try: return f"{target}.o" in open(build_file).read() @@ -203,7 +215,7 @@ def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs, core_edit for folder in extra_dirs: for path in folder.rglob("*.rs"): logging.info("Checking %s", path) - name = path.name.replace(".rs", "") + name = path.stem # Skip those that are not crate roots. if not is_root_crate(path.parent / "Makefile", name) and \ -- 2.53.0