From nobody Thu Dec 18 00:05:32 2025 Received: from mail-qt1-f172.google.com (mail-qt1-f172.google.com [209.85.160.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C4A378F44; Wed, 12 Mar 2025 01:17:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742267; cv=none; b=Xn10GNfcTvG+fVj86SRO8OAuL33IgqwTukODbAyyvKzlU8b70jzlsFFfgSGoBORcTCmmTO82bC/mJynk1mlAKxALV+mDHQfPbpe9jWPmv58usXHFACkPZBLtTnfyGwbw6iUNtBFt+mj9CA/QzQRn8ul+rOmm7079FwfiB/TTtec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742267; c=relaxed/simple; bh=7JsCd3EOBXCQwCMcOkbL4ce9rxRBvKLTXnVJe2yA+YU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hQ0tpKLqRhTj/kEtzVw4Ea4icqDWl09N4Q8f/hprz6cI30LYOtSpX6vOcu5jn0lpuW96CKbkisOeNIDZ3stfezzX678drPNTS/PGntdvPtIyDYP+55x4W94BfNjHetBK8G/crsu95DnS9uuBxqAGyDG1jaC5NY5av3F8Lk7H/Ys= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Tf0hqtIr; arc=none smtp.client-ip=209.85.160.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Tf0hqtIr" Received: by mail-qt1-f172.google.com with SMTP id d75a77b69052e-475a77bbd8cso59639861cf.3; Tue, 11 Mar 2025 18:17:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741742264; x=1742347064; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=G5Rh0FzO9cRqB5f6DNBFASVAyk0HPfSHAFbCNAH2RxU=; b=Tf0hqtIrOgGs+niA/umr8WaiZo6lhSHzXcFzeeDvbRWML4gBjfbKd1BP0rPov3j7Ly NwHXQ+xGrwGZWVOhoHv1WUE6lWQvQh6j+0W4fzyiw0NTnIldHwH7bn9y3LeD66N4jXs8 26E3g53lZfoEsmULdduW9H8pB5rjovu5JMmMEAXG2H34XTKwLwt/+Kpbi9HZWy19/ZWX XplbjK37Gp1DZFRWO8l944GMohDSSPvxdgh8GCfzXFlrricRbW1LZLAswOUDcIaG5DiN /EgEvzq1NQPIrOY/jIVu3QnwGuARCNMcGkZyEIWXtxDCIXhtKol8xBPg1+4HT3p4/vz6 l03A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741742264; x=1742347064; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G5Rh0FzO9cRqB5f6DNBFASVAyk0HPfSHAFbCNAH2RxU=; b=jVrvBw1RIRR3Nr8N+ZAMJIq97Ow4Zl1WGAUeJ5Gh1NhZf3PcADhdia7IXHsLrHScZB gzQFzazorqU2pKl/+tzCHGyxDlFbf1h2nrZTTLattxkokUlKfzlvAfkr6uHPVBabuUd9 g7dsGkFg5MLbiGZUzyhPRrhPVcOfHfeSG2fuVqakAegpHgowm/4IXf7rW25hlVZTwb1x 1qH/Ing1kkOjGD8VJqhrqVx2CcQSWPsoYa/pmwUkmqxhrVX6BOj3gxWDANihQMWUzhAY mXXuRoU4b1MhEbnQxbrF238lGGRxJ2FOBj5Aq7cc8uQgeB3xpYgStZu5kD66EPtG73ca 69pg== X-Forwarded-Encrypted: i=1; AJvYcCVL8ih0F/JqWiUfTc+rd44L9zkVQ6fZHGIfw18Ni0iefvMkBbvJz0XpWl9fu5daAReEbYIYMWJ/csGtQ/8=@vger.kernel.org X-Gm-Message-State: AOJu0YwzwfdoDD/XqnvflYSbrJPZD/vySdCwbhrzyeQ/CH3ipVEp7aIQ rWYtcdRQzcAKJnIKQfZSyMbGS4aaPmSM2MfXeeuD7oSAAdH1oguU X-Gm-Gg: ASbGnct3agjIV9CULbnP4ArvytU8qJuURjLIF1citGkTS3mVBYTJnI/6Q2m9ixekONj ATjgaUWOZfoLrLosHMMgPFNrHxmoeInNfyl7NENIVZsc49zHXuhqLJ0ZNpHAGgJ9rn90gXrs/Q0 OnIHLEp6Zp/V0BABREd1yq0E1d+iplgmohMthtAVZwNQA/eViGzyQMmOUTM7cmm+crdehW6v2oF mAladGua95Act6h5tnrGSsgSU0FhEZ37qQStjNfJlEIkeNBg3upe5C7X2eBAPUE8GP2lOsFazCB T/oGTeDR0ky9YH+rHbsTBatIQh8xB5LPvSn0Q2iVHXrinKpAXS7OfRa8nKR8EZ0ArHWf X-Google-Smtp-Source: AGHT+IHWYnvrpKGUXD//62os29Qg48MfBZgnjZLZluSfIaQ6e/1FlaBNu9MsF6Sj8CWwqQJ/sps7iQ== X-Received: by 2002:a05:6214:d6d:b0:6e6:6a6e:7596 with SMTP id 6a1803df08f44-6e900694192mr289407166d6.39.1741742264121; Tue, 11 Mar 2025 18:17:44 -0700 (PDT) Received: from tamird-mac.local ([2600:4041:5be7:7c00:2017:ee95:21ab:177f]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e8f70915ebsm78599976d6.49.2025.03.11.18.17.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 18:17:43 -0700 (PDT) From: Tamir Duberstein Date: Tue, 11 Mar 2025 21:17:22 -0400 Subject: [PATCH v2 1/7] scripts: generate_rust_analyzer.py: add missing whitespace Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-rust-analyzer-host-v2-1-30220e116511@gmail.com> References: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> In-Reply-To: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Boris-Chengbiao Zhou , Kees Cook , Fiona Behrens Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wirth , Tamir Duberstein X-Mailer: b4 0.15-dev Add a space before the `/` operator for consistency with surrounding code and code formatting tools. Add a second newline between top-level items in accordance with PEP 8[1]: > Surround top-level function and class definitions with two blank lines. This change was made by a code formatting tool. Link: https://peps.python.org/pep-0008/ [1] Signed-off-by: Tamir Duberstein Reviewed-by: Fiona Behrens --- scripts/generate_rust_analyzer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index adae71544cbd..15a690ae2edb 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -103,7 +103,7 @@ def generate_crates(srctree, objtree, sysroot_src, exte= rnal_src, cfgs): ): append_crate( display_name, - srctree / "rust"/ display_name / "lib.rs", + srctree / "rust" / display_name / "lib.rs", deps, cfg=3Dcfg, ) @@ -178,5 +178,6 @@ def main(): =20 json.dump(rust_project, sys.stdout, sort_keys=3DTrue, indent=3D4) =20 + if __name__ =3D=3D "__main__": main() --=20 2.48.1 From nobody Thu Dec 18 00:05:32 2025 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C48113A3F7; Wed, 12 Mar 2025 01:17:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742268; cv=none; b=GxKjVrms8gUbXepiTtaMfipmlVJ30yuW7JvACh2ZAjCz95ou9qA8NqLQae/4ibZoeRdBf0OUd++rtthqe0r76MdqHOCUTAfTqyeT950CBjGg/VF0o15bpWoS61dLPie12ogrTSCoAIQ6kqnxO/mmYQy55md7+3MmxiHHMUTHfb8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742268; c=relaxed/simple; bh=RyaLkXl9kX5iA7WcKe4mmQYs2dDyrXegysm2+y1UChM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BNwH2OgVy5MCpxr5quLkmKHRzBSSrhqv63bikJ55F0fPFeFoeO9WpWxqq2xGRZP5ptZf2/V+YLlnO6z4wtiAPQv6T59khN+GhXymQ9Otnc/bkB2A/cGFMAaumm9A5sSTLHknBmgvA21114LXDzUfni8JZd6KctQ8CXAeZ1Pniso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F6/axH7g; arc=none smtp.client-ip=209.85.219.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F6/axH7g" Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6e8efefec89so49552996d6.3; Tue, 11 Mar 2025 18:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741742265; x=1742347065; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=JkdJVLyC+3pFRj2tgwQ7Jhglb327o4ms0rKwM8mHQQI=; b=F6/axH7gfTRAliFNIU5dGWoyvW2opW1wsUjuUgyoxyjXsdoGb1eGjZ7z7kFVLQDJqW 4O2EPZ5k1XMP/v/FesDLCkpw7/HE5GAr3VNuU6CJ6t01ZmeJwRDEOIvhwMpdjprVIZqQ as9iz72vlXifJtU0Xmj2J2HaKBLh1YdBwKkOjiPy78PqnC9RnAiOY9rMP8INSlbtheQH M3/hV5j3r+BEMIM50RAtAuxKrlSDWeh0wN26Kn/8uG8J7ZqAnXVTwKgO7+KePEJTdFkn eMq3s4oeQHkH39b13q8h8dmgZO6PFmXOjWJbff3SUg3odzc1+BxRCd+po9UDhF8BqIFY c2Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741742265; x=1742347065; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JkdJVLyC+3pFRj2tgwQ7Jhglb327o4ms0rKwM8mHQQI=; b=VG2Tw7T9G95eA1cq/MPRKTbPXhkdMiwbljuj6b6KmwfDoTGf8qafQfhsYCH4/YMOY+ tzJ2eSHxr2myfV07tO78qF3rlT0aScUPXTBE+kJu/6tBv0qJS8JgKZb0yxRjE9gLI6ne ke1jwj/VHLrIf4F+tVhVe6wwILTqAvNPwd3QX2L133Ezrzm99XhUH3KkXSiEmS+sPlJw tOM0+QJsPkhhm6Dy8KsMP1QCO4nPy01GFbgeDBp1RJ+sNTLEDC/U/EYjRnDeYZECIqLt o6v2BPMOW3kT4+jX5+ZLULf2HcQyRrqWTs3STd7ETBNkqhoK3K8MzKAVT8taN4XZ9PoM ipHQ== X-Forwarded-Encrypted: i=1; AJvYcCUKvIQAzcGf9ATNft52qSF5zvnKBNsEiubjOayELwuEt2PN3MU/Jhpz32HtsgHJoy2WZAfgX+hOjoGTsbY=@vger.kernel.org X-Gm-Message-State: AOJu0YyY41WkLcCcHMeLFjgqxwgMHU0hUXzmIFPmVXdfH9MoYlK039l4 2D2r3v/xjAFVmrBf6bdyBvyvWLiw0NqZwbEQJtEk85CazIpB6jKA X-Gm-Gg: ASbGnctG8m6o2/S3duGXn3noxdMs9y0saBDs+Z5+i/OgZ9LSkS2TyHHUJ4PEslGT/jR 7iRCPVdQxTndFbrY7LKFtlSsH3hl9i3ern2X9rputdlbIIarZ4+9IDoSZ05C+qfDMTJyb2kpYiP 3ahdEuNbZ9p1ndcPW9CFR5m1+sfk7X/JnmRzXMUbr1pfi9dmaPaIxYthEjwA9USZzCcfW5N4xOK RUzXvXbvoFNnuuiPOm7Tpw+PAqqYlHCyWyfrJUN1KGrfJYHdvylznwy3X1pUTE624A9JJw4fLkY sTavXfpGS9LtKAsdk9fLdW2NStONUu03o2oRopfgDA0bUBw3iQ62Uu6LvpIB8/IiujSK X-Google-Smtp-Source: AGHT+IF9FkWR3X8MdeEN/67lwUSToC8vl31IgxHkLMLzSQfJrUYX/49zCPEgsyHxtLO51GjTUroPVg== X-Received: by 2002:ad4:5e8e:0:b0:6e6:6c7f:1116 with SMTP id 6a1803df08f44-6ea2dd25c19mr74281316d6.24.1741742265336; Tue, 11 Mar 2025 18:17:45 -0700 (PDT) Received: from tamird-mac.local ([2600:4041:5be7:7c00:2017:ee95:21ab:177f]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e8f70915ebsm78599976d6.49.2025.03.11.18.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 18:17:44 -0700 (PDT) From: Tamir Duberstein Date: Tue, 11 Mar 2025 21:17:23 -0400 Subject: [PATCH v2 2/7] scripts: generate_rust_analyzer.py: use double quotes Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-rust-analyzer-host-v2-2-30220e116511@gmail.com> References: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> In-Reply-To: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Boris-Chengbiao Zhou , Kees Cook , Fiona Behrens Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wirth , Tamir Duberstein X-Mailer: b4 0.15-dev Replace inconsistent use of single quotes with double quotes. This change was made by a code formatting tool. Signed-off-by: Tamir Duberstein Reviewed-by: Fiona Behrens --- scripts/generate_rust_analyzer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index 15a690ae2edb..5913934ecb5a 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -154,8 +154,8 @@ def generate_crates(srctree, objtree, sysroot_src, exte= rnal_src, cfgs): =20 def main(): parser =3D argparse.ArgumentParser() - parser.add_argument('--verbose', '-v', action=3D'store_true') - parser.add_argument('--cfgs', action=3D'append', default=3D[]) + parser.add_argument("--verbose", "-v", action=3D"store_true") + parser.add_argument("--cfgs", action=3D"append", default=3D[]) parser.add_argument("srctree", type=3Dpathlib.Path) parser.add_argument("objtree", type=3Dpathlib.Path) parser.add_argument("sysroot", type=3Dpathlib.Path) --=20 2.48.1 From nobody Thu Dec 18 00:05:32 2025 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B792B1514F6; Wed, 12 Mar 2025 01:17:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742270; cv=none; b=bASxPyyiF9Q6qEPiXkCqLH4fQBUvfFb6dadySUUDfjhh65x7wvwmLT8cLCr1mgvbNFe0INkFskUmzvBsVKUNpXMAoR/hku3SLAuKY4knlcDjKSduhOOg76Lk5LVE2/QH1ON5qko0z39akyCNIG9wxJzfn1lsURAkB12AwxsiQl0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742270; c=relaxed/simple; bh=ii7HkPP2VjrirJm2gQ2k/s32b8ke3rasYD/JaFl7XYo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Jaw5HBSC2dEnHTrHxJN7pHIeiPCBEuZXMxrVeibWOQKhJQfeF8E/fXr2uauq0wh26y2we4eo6RK2hOoDC2PPG4V/Jo17KrWjCtAcUA8O7iNih5TWwNmfD/KpTzicLOA3DBxRAeztqeNSCsYotsHVmoSSrA3Tb8lZ5Ql//9gFmVw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cNSL63Bs; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cNSL63Bs" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-7c08f9d0ef3so366426585a.2; Tue, 11 Mar 2025 18:17:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741742267; x=1742347067; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=gKVJ7yGzZjAMydSlkvLD1F4j47gCT43sXLOSNESzcL4=; b=cNSL63Bs7Ru0gjEhD049PDHLydUxy1dutq8Jab2pXU+SToU1SXnl7d2I6cz31lE37k MRYGYUI5TGsMCxNx1tVKscpx4C/FMLX2FuloWIKF3iz9GdcqPRgCGYucuaHCyqPzdy2v TdQVZOdcHDVq//q1wREn3G6f8FZyET6db9PU6OkkeZG393aBSgchynGUZ6eq4TaZuqQ3 nZW6+JY7YZS2RL3peGTIhjaOO0T3MDK3XrkvdsyM7AzzFp1psckTr2JOl6ZBNb8JTf1x 4hgzTvkk9HbHu+tnzYUDYGfgFc5Q4yBGObW14kYRebRxsSBkbwlkBtNXtAaEHiL0ievc Mrrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741742267; x=1742347067; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gKVJ7yGzZjAMydSlkvLD1F4j47gCT43sXLOSNESzcL4=; b=uWspiwRT6d3GRsXbsyxz5dVk+kA7YHKR5yqPn2bo/uQqMXwWQI2bBALi3DmPuO0+I1 R+I88orVMgwPWF1Jbo1MPPnCJyV4+5Yylf+Xxha8Dsk22q7vYa+xcBAmIsKSZmZN2u9L NiWY6sw52vvFZVIA/9iMg4ihyKDsEaoDOAmhNF7ayX7lMambt8bbsVtr8jDL9pGcg0w6 Intuwe3kgMmpNEpZoGBvHJJ4LjHxmDlXTMnOaYTL0zMYnxrQpxwDaXp6R+tWnjAK8TAu Bp66MxO+bObwfFMFIKPKalZoTY9Czuf8qxiPAc5NrbpItq1au5zBmymTL0Q0sQrveNvP eYDw== X-Forwarded-Encrypted: i=1; AJvYcCVjN91A0TMBqz8pCjxzj2l9IGUpo6DSdE13sBTuFTmx7cLX5vEZ2wV+rBsRtwg6Cyq15vrtqY8c0/HJ4ek=@vger.kernel.org X-Gm-Message-State: AOJu0YyhjlyX50f6EZX7sH7r0ZwRNThJO/rtPSCRXHcbJIiR+sbUCkKe PS1tKonpsiexLu87lX/bQ/ztppljoNYU214QRPurCRobUVT93hA8 X-Gm-Gg: ASbGncsFyCPPs4Aep342ijUwueshvS416mFC6JAizP71BgMu2JTerIKb8tVHyIfzh9e qg4MfGalhvgjn7VPSjbhkUpB6vhuUmvdoAxZXqxAxBXw10/gX6lFj5+f2GVPUFghCW6zN1cAXUu YKRC3vrtzqzB+85RftvPIK/Is89NRMf+v0Lqt4cyM/vabeX0gKAn9cd2ChUO8zdZsYoZb2QakRw p3RR97tNh9SUKnA8/PPwDiWYgoLt7N75DzYkO2bFDsH0QVlNCte7XdX1Uq+IPoWuHtLgQKj7+oD /jm5K+tuYxNu/ojPGT+zgLRjIftXBKtd9bYkoKM/uyFc3RfeZjR8XzyeUKHN+RYFa6glQ0bNpBu YbFU= X-Google-Smtp-Source: AGHT+IG5ORfCJOzgcdUss93D6cWamWh6VoM1zsW/4khQKAMUvlMX4gzceAAHmAvtzBrlQcd3jXbrRw== X-Received: by 2002:a05:6214:20c4:b0:6e6:4969:f005 with SMTP id 6a1803df08f44-6e9006c8314mr251458936d6.30.1741742267519; Tue, 11 Mar 2025 18:17:47 -0700 (PDT) Received: from tamird-mac.local ([2600:4041:5be7:7c00:2017:ee95:21ab:177f]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e8f70915ebsm78599976d6.49.2025.03.11.18.17.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 18:17:46 -0700 (PDT) From: Tamir Duberstein Date: Tue, 11 Mar 2025 21:17:24 -0400 Subject: [PATCH v2 3/7] scripts: generate_rust_analyzer.py: add trailing comma Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-rust-analyzer-host-v2-3-30220e116511@gmail.com> References: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> In-Reply-To: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Boris-Chengbiao Zhou , Kees Cook , Fiona Behrens Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wirth , Tamir Duberstein X-Mailer: b4 0.15-dev Add missing trailing comma on multi-line function call as suggested by PEP-8: > The pattern is to put each value (etc.) on a line by itself, always > adding a trailing comma, and add the close parenthesis/bracket/brace > on the next line. This change was made by a code formatting tool. Signed-off-by: Tamir Duberstein Reviewed-by: Fiona Behrens --- scripts/generate_rust_analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index 5913934ecb5a..7e78b926e61f 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -165,7 +165,7 @@ def main(): =20 logging.basicConfig( format=3D"[%(asctime)s] [%(levelname)s] %(message)s", - level=3Dlogging.INFO if args.verbose else logging.WARNING + level=3Dlogging.INFO if args.verbose else logging.WARNING, ) =20 # Making sure that the `sysroot` and `sysroot_src` belong to the same = toolchain. --=20 2.48.1 From nobody Thu Dec 18 00:05:32 2025 Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CA2D318D620; Wed, 12 Mar 2025 01:17:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742273; cv=none; b=XduTagHrVzlzBqObUFNyv/0amOhp/5fH4+NLO8xG909IDa3NI0Z/NWyMiAo1TNTThgc4IQknG36XflAp988SlQrSQeLjiM5Qq8pVj+O7RNwPEd8wdBHXq6ulhlhYnz0qdMLF4UDZtBn38icZ0/KGl5qRvcmUzzx6DEhkZKwoNaA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742273; c=relaxed/simple; bh=5dDQA5D/gR2vmA0gkSFwao6lTiRWguhvgjQ73yi0p+Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WVltZXbxNG1gS8HVpHEKN7Dv5GXifGhDBGE6k1mPh95auT6Zy7NhG+JTY49+3VUG8pcHtkitxmRN775TZaFeOqF6fnhiOv4+//Ijf7ru3zmOc+v4HtNzNU86Sl9TqJmObVd7YUXq82An8AIyr2ph9LL+VBMAXxymt7Lc1zPTLp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=g3/ZMoZt; arc=none smtp.client-ip=209.85.219.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="g3/ZMoZt" Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6e1b11859a7so25057546d6.1; Tue, 11 Mar 2025 18:17:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741742271; x=1742347071; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=m2itTq1SSlF79a/hGU5ocuI4Vhx+F2V+KNp8dEd6SR0=; b=g3/ZMoZtvsrq6KK36/fWo3LHls0h/NoHGWNuB7sCZusOxvUKZA1tRQOvbM5/tAYykF rLhSkWJ8yLyhvTZ3iv4dWVSZEydR+l4XH8f9+vXxowi0EeaymSNgwODrwoVV0MIy8bJx qCqwOnZMKszQJ2nnGZ1yfwnxtXd/GCRaUOPBUZ+SsV2Jwc2HaImQTUwDzKLjPI6QMtDm yVWxx8pU54aTZvTtL9VMiR+o/2T7V7ysL3y8p9Jgh6AepSN7RAnC3FFNba93ddnA/Zr4 ZJC0zyN/7uNXDX3gy5AV6lDOtV4uQ/0fcor3dOiQp5UvLLrIGKrdnUTocsRXZoey+A7G pVeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741742271; x=1742347071; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=m2itTq1SSlF79a/hGU5ocuI4Vhx+F2V+KNp8dEd6SR0=; b=ons5TRFBvJmvcZNmJUQNiuKjnjhg3w92imBjuib/kA+Y+jZ74DBC+SrV/XQH9v94sp Dpx+mMLP81o3Ukzn7NHi7QctmFM40EQ3o1G3cYL5ebkrMBMoWTltWQVJSfuU26wuk3md gkegy/SpLVd/8ovNB+PvzxQBgytPdvswDfYql/rGT5UjGN7Vp4WWE8jDl2rJx7DN03KA KU9nBPfT8kiiJJIugDwEaIvYd7yjQAO5rNpNZcHKh27Ev5s+GNcW5Q7pMHck6RRCUBtj u0iayIJExtOMXlBe2M+W0WOhcz94AwvtrOUrc5jxyk0jIXGk+B55Cf6DC967rUL49uUy pUgA== X-Forwarded-Encrypted: i=1; AJvYcCUtQPOJ4IGXW0Xrc7EQwnskh/VdByRKoABvbw5ihU2Lr6SV51MO/c2olaYx6RgZpb5ay3M/Igs3YmdaQE8=@vger.kernel.org X-Gm-Message-State: AOJu0YxjV9WiadRaEXNSR24f1SuKEqDB8LGQh200+xzzJEuGx5JiHiXl 4FrCDvavObXePxHBkeh2o4q96eXSo58vqDzs28RnwmvuqNSO6csh X-Gm-Gg: ASbGncs9Y8ROGF6o7a+ewCMJCV73RDTx+xWFNSXGQFs17iAAl9vJU0wzGzh04P3VVwV +FZjb/aCCyY3mc0ARY1Q8qG8kkj/WOrVpDprF5ykn130mztrIM0ejCxla3vPGhqjpNHFpTkooDX nfmWHP/+5fVOS4yRY7DkW9jUj/JF4U1rumf/FVduBQLx9J7plyk8NyVXUhOvjcpVjPE/7wXhlQ5 i7Ewzg7Vs3mdisFRKcno3zKBLTygrF6+zvksUO6UwII1LbIRkI5Wy0SHX7coPB+84zD3WXBN5qF JLHVVyz1RRROvrib6kYr+GyMcUjNuX+tXA6Mu3DN0+I6/3eK7cyrTqXEOYfn5bycpMdH X-Google-Smtp-Source: AGHT+IHrAU88zv7Ui2gPgx5uNuZPtI72/BbweNltdl5+vyguKtR6MZtvMg18shtbOcta+Y2wIAC5Zg== X-Received: by 2002:a05:6214:250e:b0:6e8:f88f:b96b with SMTP id 6a1803df08f44-6e90060157cmr255208806d6.9.1741742270592; Tue, 11 Mar 2025 18:17:50 -0700 (PDT) Received: from tamird-mac.local ([2600:4041:5be7:7c00:2017:ee95:21ab:177f]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e8f70915ebsm78599976d6.49.2025.03.11.18.17.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 18:17:49 -0700 (PDT) From: Tamir Duberstein Date: Tue, 11 Mar 2025 21:17:25 -0400 Subject: [PATCH v2 4/7] scripts: generate_rust_analyzer.py: add type hints Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-rust-analyzer-host-v2-4-30220e116511@gmail.com> References: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> In-Reply-To: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Boris-Chengbiao Zhou , Kees Cook , Fiona Behrens Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wirth , Tamir Duberstein X-Mailer: b4 0.15-dev Python type hints allow static analysis tools like mypy to detect type errors during development, improving the developer experience. Python type hints have been present in the kernel since 2019 at the latest; see commit 6ebf5866f2e8 ("kunit: tool: add Python wrappers for running KUnit tests"). Run `uv tool run mypy --strict scripts/generate_rust_analyzer.py` to verify. This removes `"is_proc_macro": false` from `rust-project.json` in exchange for stricter types. This field is interpreted as false if absent[1] so this doesn't change the behavior of rust-analyzer. Link: https://github.com/rust-lang/rust-analyzer/blob/8d01570b5e812a49daa1f= 08404269f6ea5dd73a1/crates/project-model/src/project_json.rs#L372-L373 [1] Signed-off-by: Tamir Duberstein --- scripts/generate_rust_analyzer.py | 130 ++++++++++++++++++++++++++++------= ---- 1 file changed, 96 insertions(+), 34 deletions(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index 7e78b926e61f..c73ea8d116a4 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -10,8 +10,10 @@ import os import pathlib import subprocess import sys +import typing as T =20 -def args_crates_cfgs(cfgs): + +def args_crates_cfgs(cfgs: T.Iterable[str]) -> dict[str, list[str]]: crates_cfgs =3D {} for cfg in cfgs: crate, vals =3D cfg.split("=3D", 1) @@ -19,7 +21,45 @@ def args_crates_cfgs(cfgs): =20 return crates_cfgs =20 -def generate_crates(srctree, objtree, sysroot_src, external_src, cfgs): + +class Dependency(T.TypedDict): + crate: int + name: str + + +class Source(T.TypedDict): + include_dirs: list[str] + exclude_dirs: list[str] + + +class Crate(T.TypedDict): + display_name: str + root_module: str + is_workspace_member: bool + deps: list[Dependency] + cfg: list[str] + edition: T.Literal["2021"] + env: dict[str, str] + + +# `T.NotRequired` fields on `Crate` would be better but `T.NotRequired` wa= s added in 3.11. +class ProcMacroCrate(Crate): + is_proc_macro: T.Literal[True] + proc_macro_dylib_path: T.Optional[str] # `pathlib.Path` is not JSON s= erializable. + + +# `T.NotRequired` fields on `Crate` would be better but `T.NotRequired` wa= s added in 3.11. +class CrateWithGenerated(Crate): + source: T.Optional[Source] + + +def generate_crates( + srctree: pathlib.Path, + objtree: pathlib.Path, + sysroot_src: pathlib.Path, + external_src: pathlib.Path, + cfgs: list[str], +) -> list[Crate]: # Generate the configuration list. cfg =3D [] with open(objtree / "include" / "generated" / "rustc_cfg") as fd: @@ -31,37 +71,53 @@ def generate_crates(srctree, objtree, sysroot_src, exte= rnal_src, cfgs): # Now fill the crates list -- dependencies need to come first. # # Avoid O(n^2) iterations by keeping a map of indexes. - crates =3D [] - crates_indexes =3D {} + crates: list[Crate] =3D [] + crates_indexes: dict[str, int] =3D {} crates_cfgs =3D args_crates_cfgs(cfgs) =20 - def append_crate(display_name, root_module, deps, cfg=3D[], is_workspa= ce_member=3DTrue, is_proc_macro=3DFalse): - crate =3D { + def append_crate( + display_name: str, + root_module: pathlib.Path, + deps: list[str], + cfg: list[str] =3D [], + is_workspace_member: bool =3D True, + ) -> None: + crates_indexes[display_name] =3D len(crates) + crates.append({ "display_name": display_name, "root_module": str(root_module), "is_workspace_member": is_workspace_member, - "is_proc_macro": is_proc_macro, "deps": [{"crate": crates_indexes[dep], "name": dep} for dep i= n deps], "cfg": cfg, "edition": "2021", "env": { "RUST_MODFILE": "This is only for rust-analyzer" - } + }, + }) + + def append_proc_macro_crate( + display_name: str, + root_module: pathlib.Path, + deps: list[str], + cfg: list[str] =3D [], + ) -> None: + append_crate(display_name, root_module, deps, cfg) + proc_macro_dylib_name =3D subprocess.check_output( + [os.environ["RUSTC"], "--print", "file-names", "--crate-name",= display_name, "--crate-type", "proc-macro", "-"], + stdin=3Dsubprocess.DEVNULL, + ).decode('utf-8').strip() + crate: ProcMacroCrate =3D { + **crates[-1], + "is_proc_macro": True, + "proc_macro_dylib_path": f"{objtree}/rust/{proc_macro_dylib_na= me}", } - if is_proc_macro: - proc_macro_dylib_name =3D subprocess.check_output( - [os.environ["RUSTC"], "--print", "file-names", "--crate-na= me", display_name, "--crate-type", "proc-macro", "-"], - stdin=3Dsubprocess.DEVNULL, - ).decode('utf-8').strip() - crate["proc_macro_dylib_path"] =3D f"{objtree}/rust/{proc_macr= o_dylib_name}" - crates_indexes[display_name] =3D len(crates) - crates.append(crate) + crates[-1] =3D crate =20 def append_sysroot_crate( - display_name, - deps, - cfg=3D[], - ): + display_name: str, + deps: list[str], + cfg: list[str] =3D [], + ) -> None: append_crate( display_name, sysroot_src / display_name / "src" / "lib.rs", @@ -84,11 +140,10 @@ def generate_crates(srctree, objtree, sysroot_src, ext= ernal_src, cfgs): [], ) =20 - append_crate( + append_proc_macro_crate( "macros", srctree / "rust" / "macros" / "lib.rs", ["std", "proc_macro"], - is_proc_macro=3DTrue, ) =20 append_crate( @@ -98,9 +153,9 @@ def generate_crates(srctree, objtree, sysroot_src, exter= nal_src, cfgs): ) =20 def append_crate_with_generated( - display_name, - deps, - ): + display_name: str, + deps: list[str], + ) -> None: append_crate( display_name, srctree / "rust" / display_name / "lib.rs", @@ -108,19 +163,23 @@ def generate_crates(srctree, objtree, sysroot_src, ex= ternal_src, cfgs): cfg=3Dcfg, ) crates[-1]["env"]["OBJTREE"] =3D str(objtree.resolve(True)) - crates[-1]["source"] =3D { - "include_dirs": [ - str(srctree / "rust" / display_name), - str(objtree / "rust") - ], - "exclude_dirs": [], + crate: CrateWithGenerated =3D { + **crates[-1], + "source": { + "include_dirs": [ + str(srctree / "rust" / display_name), + str(objtree / "rust") + ], + "exclude_dirs": [], + } } + crates[-1] =3D crate =20 append_crate_with_generated("bindings", ["core"]) append_crate_with_generated("uapi", ["core"]) append_crate_with_generated("kernel", ["core", "macros", "build_error"= , "bindings", "uapi"]) =20 - def is_root_crate(build_file, target): + def is_root_crate(build_file: pathlib.Path, target: str) -> bool: try: return f"{target}.o" in open(build_file).read() except FileNotFoundError: @@ -129,7 +188,9 @@ def generate_crates(srctree, objtree, sysroot_src, exte= rnal_src, cfgs): # Then, the rest outside of `rust/`. # # We explicitly mention the top-level folders we want to cover. - extra_dirs =3D map(lambda dir: srctree / dir, ("samples", "drivers")) + extra_dirs: T.Iterable[pathlib.Path] =3D map( + lambda dir: srctree / dir, ("samples", "drivers") + ) if external_src is not None: extra_dirs =3D [external_src] for folder in extra_dirs: @@ -152,7 +213,8 @@ def generate_crates(srctree, objtree, sysroot_src, exte= rnal_src, cfgs): =20 return crates =20 -def main(): + +def main() -> None: parser =3D argparse.ArgumentParser() parser.add_argument("--verbose", "-v", action=3D"store_true") parser.add_argument("--cfgs", action=3D"append", default=3D[]) --=20 2.48.1 From nobody Thu Dec 18 00:05:32 2025 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A979213774D; Wed, 12 Mar 2025 01:17:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742275; cv=none; b=l+2IbdSzr0kXvsNXbpN9bAK0yKLo8er0Qow0TdUmBBgdiZCJudzfOjkatQ9gAVn6rM6yHUMD1w75hG/as3zweNeKOUDNbVs+PA8Rk03kBN3VexqSEj5FWP3C3NXihRnNU/wzt5y/4MwJWMgNTzW3rcDljmvygWpkFyHvOR3PUv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742275; c=relaxed/simple; bh=BgThh1Uj39dsD3ERwfQo2QnWW8SQ1eBROVFyBcK6Ifo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=D2YX1KASoBBi4Dg/Eh9+0n6LK5duR5Sb5CSOhtUg7InSAD8ZFwN4DsY52UgXDvSuDAVL8ScClaOJgWsJMis7uoiPU11+SG1lIEfMnnR+/FbGFUvUelzWfn3hmM8+r1mON2SIXzwGOFE4f6nKn0aQqF7gOSoNNaqpXQ4KXCrDSK4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=J27KX1Hg; arc=none smtp.client-ip=209.85.219.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="J27KX1Hg" Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6e8f05acc13so62332376d6.2; Tue, 11 Mar 2025 18:17:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741742272; x=1742347072; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=FaKtc/l0mW3laduZvTeKZzaRaJDTU/Yr10LNrXCha1k=; b=J27KX1Hg/g+LVUH65QywRmOlsi+IGtXU4UXfZ/YnR2TguaX6gu9eyldembQIgs/w8v 044CAUhGWocKEpfYM0enHOyz10gvXdBSq6feMUTR5fZhWMWycx9jHY1Zp0AnSK/NFWk9 AwXUy3AsQPUAG/Dbww0XAp3TtOJmGi+Q/E27guPufNTUpqpG296Ej7U83C3whJfDHDpR AzVdFG4c/vTo6f1sZKio4Y5Kh1linxNyoT7PcZOLi04HhB5EIKaG70+TdXq5twLkWNpC VRnQy8EMlEW0AKkAwRGyVfY6218/QRO3EjNse40fJuAs+nDA2N+E4BB9rYl2al4/XIV4 VDhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741742272; x=1742347072; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FaKtc/l0mW3laduZvTeKZzaRaJDTU/Yr10LNrXCha1k=; b=ScnBMDzCjSCXmxSiKVhXvVSneLUscBoDm3klA+DVDj0BjKB0pE0W+Y6qvJORm6+iFv QwTUYboOO4me6CldDkbYvcfbpCYKCoP9n+DaCHKCoDbp0Jxt3lCD6HK7q2/jaYr9Mcl1 WWqiEXMZVUeTS0DobiXW9GruKmd2L5VHdVz/OWpCHd7O89nzCFQ1OhpW9W6XAtmf679P 4dEkiGO+86X0a0HWbwRcfm3YqCqw4QvUglaps3OQZJW6+ma1wZKfAgh8dfyqnWz3HIdN /8B6m0KO18kya1TG7PAvbn2mkEszzZHPzYHBAqW75gXZL7mgVBxSkscmbsyVO1m2+MNi ZUIA== X-Forwarded-Encrypted: i=1; AJvYcCXaSosID9K58PGXsa/9+Q0JY1z9kUwCxQ5WPr5rxi2Qf5PW4lLJBnJ45Re6AOiVbRHUTwCo1qcRr7mj4kI=@vger.kernel.org X-Gm-Message-State: AOJu0YzUDkkZ/n4fYFfudE+WK5bQRJWmnb/hHjK1ogh8RvhH7uy/Jnry w5Q0uhDSQ2mtgap9G2SFLm9gI0PulhTEsi/qBlHbvpMhzA5notQE X-Gm-Gg: ASbGnctywhr8vqDudI4wDQrx8g++m/6MvUQSGqPIenKmTd/GP5IwjMtU0KGnCVJtHNI Xpn2eHLnZoLd82Xq3yqA81ddVGp7xojMjGRtv//TpgNsTBbs1CQRFWtC1SFkH790VMYY06WCzeL 9NtpnBiyp906u5EB1jNaKoZHTNAOdZNUwX9oP36tDOVpogluXtXWa1J2EsDZG7ENQctTXyVckCC cCvCaBvCC3jBpdWdugM9tuiKdBNaDTOTbsLWuExPks25c71OwgnxjDJ7Q4lsu6c4oH8QaI1VnI3 2KRIcA1DYkkY9JFFve8EAG4gAJUuBQpLOm8WMoFQazhx8EIHC4fENfqPy4Xwuy7jVg7D X-Google-Smtp-Source: AGHT+IH+iMxjtwH4nwrrqPI7nXqS7kAk+GpkLS5RDJxcyUIIFA1C9nayRM4oxawHNDs6TD6lFvxefw== X-Received: by 2002:a05:6214:80b:b0:6ea:d393:9634 with SMTP id 6a1803df08f44-6ead3939835mr178986d6.3.1741742272466; Tue, 11 Mar 2025 18:17:52 -0700 (PDT) Received: from tamird-mac.local ([2600:4041:5be7:7c00:2017:ee95:21ab:177f]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e8f70915ebsm78599976d6.49.2025.03.11.18.17.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 18:17:51 -0700 (PDT) From: Tamir Duberstein Date: Tue, 11 Mar 2025 21:17:26 -0400 Subject: [PATCH v2 5/7] scripts: generate_rust_analyzer.py: use str(pathlib.Path) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-rust-analyzer-host-v2-5-30220e116511@gmail.com> References: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> In-Reply-To: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Boris-Chengbiao Zhou , Kees Cook , Fiona Behrens Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wirth , Tamir Duberstein X-Mailer: b4 0.15-dev Use the `/` operator on `pathlib.Path` rather than directly crafting a string. This is consistent with all other path manipulation in this script. Signed-off-by: Tamir Duberstein Reviewed-by: Fiona Behrens --- scripts/generate_rust_analyzer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index c73ea8d116a4..1bb185ae2e87 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -109,7 +109,7 @@ def generate_crates( crate: ProcMacroCrate =3D { **crates[-1], "is_proc_macro": True, - "proc_macro_dylib_path": f"{objtree}/rust/{proc_macro_dylib_na= me}", + "proc_macro_dylib_path": str(objtree / "rust" / proc_macro_dyl= ib_name), } crates[-1] =3D crate =20 --=20 2.48.1 From nobody Thu Dec 18 00:05:32 2025 Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C3861C5D76; Wed, 12 Mar 2025 01:17:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742279; cv=none; b=p493MszVKWBo2EtjTt3KIgSpi1rJ6BEgKpD6Y3Co2Y8He9M3DPP41324x8UzFuGnmsfPRUrqyVrcNoZWsbq6un7u1cnovbmAHYNuyJff+klK2WAFDXh8iRsWSuv4QSKnlSaJrHlt1VNVoVQvCA5hBpcoQ+lxRGrHWs0Zm6kp7cg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742279; c=relaxed/simple; bh=ym0uAM3173NwIdccsvRUaTQeHfi8HeK6xwWWzGXaISs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P0950ECdH3jcV7cEUih391dQnM5bBmT55t8lpZlUKcgeOhs5cBuJMKBZVd59BsjVMjnPGGvH5m1p+23SmWcCrZEM9x1GwGBk2vKSKBIMCkuEG6lHyQIOWi0vXDHo7NtJqGUsHOJgL9u82SS7qJcx08c/ulU4Q21c1ShjWMw2GX4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XE1zuuqQ; arc=none smtp.client-ip=209.85.160.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XE1zuuqQ" Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-4769f3e19a9so8696291cf.0; Tue, 11 Mar 2025 18:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741742275; x=1742347075; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=vuT/y5FKHmoEEzYb5QENOtK4YXwQR2+9pGyPJGYhzrk=; b=XE1zuuqQvKqfdltd3GWO3UAW3nBO5c5SWldXK2rq2KZrm/9+2b4mbtNXHCKE2JH4ls ls4X2Fx+6LMTlC9PEbjoPySssAScoL0ePZAgux660UCZKnsnhM/3AkPsC4/KEauJD+VI JQppNXudrbmIR6i2kiwWckg9NO8AEoDSoryNOikT3YYOvKFvOGAClKPZba5ZosI/MYz3 knY0i1dg238AEPBH4EbiNfFMH9+vqsZ+xt1psUh25OXNdmBLsIikAsYXNn/38ec+44KS 0qdYXQ3PdC2xO++a9PtV4D2xdUw8yRJMjPM+GfiaVfp+LH4w1Q21tP2KhQhNeB76J0Cv /Dbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741742275; x=1742347075; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vuT/y5FKHmoEEzYb5QENOtK4YXwQR2+9pGyPJGYhzrk=; b=HsNDaCc87jGhXtsbcHoDNkd/WKXJ391qjP0vkZCgFlrRpe+6DUSZZZW1tfAZUbYyHK 9vH2Kr8VZYGo4E9pRXlJFraLotke5AEcDN7ENgbGpYrT4MSamoi6xnMHWTQ/dC5F1FvS CtRE9NzzxDMnXdvb7Y6pkeD2ymOuWGUbsp1zIB/UBC/Ts7DSgRdlTSU/fQ31Gx6If3Hs VwjBaisJDI+ipHz/CsIxJNaHlQSu5WADs48HCPuQNM0MIhJCxR35h94Usrt0FhQ/A4cH 4OVoZVOlXxqVSsLR4dwtlcfCflMBDcEHtXp6pzKgftn/a4cNBMcrc854ESMlNXmaTipg PKag== X-Forwarded-Encrypted: i=1; AJvYcCU3/h2A2TpLei6HR/m/0399jddRBlFmJCxq6EU5MkAuf+rA4IxjS8suIowkGyMboaCxrjMirdAj/lHCz7k=@vger.kernel.org X-Gm-Message-State: AOJu0YygaTVSPxz1MhBKO5IWOd6Oam/dz8sAckkNVXAk7Skjd3r/1HtJ QZQsEe0WBY0eRijzb+oYUYxvk1dBk26Wz03pyQaixfU+sobV3f8y X-Gm-Gg: ASbGnctVJCjUosFuQTjeP1ucexBTiXDTPMN2x2IemUFJPb1I47MYrqvlJJWLRpfv45N Z1OUl3XR/1rTnAu+9aXT1mMdWvoYvSDoWSw+GjTuQ9DxKscze5e/Ve6avwEmC9LqpGPvqQSOAQs cy6sjAwGtAGS7fog7ZtcPmnj/cZmmEa9+XfdSwn1fyDAOg91PTlCMXkbKAZdCuJk3uKGArgXkrA A1UOwTi8hALwwh03FVXCDGWpXvbsmib/PfwsmDrs+YPG18O5Nq2mgCGciW+bQNNGVTzaz4awoOQ U2NPGXTA0QkvLSFIde17QVuQTj+EuiVH35/nGpD7Zb+I4fyTehxAZvlfum6gstTRlKgA X-Google-Smtp-Source: AGHT+IEIoOnXopKN0MF1B/3JIUyExCdONXIMAt+tn3yriPRLRlhcuPXT2fKYNdhEQR4lggfTpTocJA== X-Received: by 2002:a05:6214:e49:b0:6e8:f5db:d78d with SMTP id 6a1803df08f44-6e90067700amr233796776d6.23.1741742275373; Tue, 11 Mar 2025 18:17:55 -0700 (PDT) Received: from tamird-mac.local ([2600:4041:5be7:7c00:2017:ee95:21ab:177f]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e8f70915ebsm78599976d6.49.2025.03.11.18.17.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 18:17:54 -0700 (PDT) From: Tamir Duberstein Date: Tue, 11 Mar 2025 21:17:27 -0400 Subject: [PATCH v2 6/7] scripts: generate_rust_analyzer.py: identify crates explicitly Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-rust-analyzer-host-v2-6-30220e116511@gmail.com> References: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> In-Reply-To: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Boris-Chengbiao Zhou , Kees Cook , Fiona Behrens Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wirth , Tamir Duberstein X-Mailer: b4 0.15-dev Use the return of `append_crate` to declare dependency on that crate. This allows multiple crates with the same display_name be defined, which we'll use to define host crates separately from target crates. Signed-off-by: Tamir Duberstein Reviewed-by: Fiona Behrens --- scripts/generate_rust_analyzer.py | 60 +++++++++++++++++++----------------= ---- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index 1bb185ae2e87..e1002867735b 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -68,40 +68,38 @@ def generate_crates( line =3D line.replace("\n", "") cfg.append(line) =20 - # Now fill the crates list -- dependencies need to come first. - # - # Avoid O(n^2) iterations by keeping a map of indexes. + # Now fill the crates list. crates: list[Crate] =3D [] - crates_indexes: dict[str, int] =3D {} crates_cfgs =3D args_crates_cfgs(cfgs) =20 def append_crate( display_name: str, root_module: pathlib.Path, - deps: list[str], + deps: list[Dependency], cfg: list[str] =3D [], is_workspace_member: bool =3D True, - ) -> None: - crates_indexes[display_name] =3D len(crates) + ) -> Dependency: + index =3D len(crates) crates.append({ "display_name": display_name, "root_module": str(root_module), "is_workspace_member": is_workspace_member, - "deps": [{"crate": crates_indexes[dep], "name": dep} for dep i= n deps], + "deps": deps, "cfg": cfg, "edition": "2021", "env": { "RUST_MODFILE": "This is only for rust-analyzer" }, }) + return {"crate": index, "name": display_name} =20 def append_proc_macro_crate( display_name: str, root_module: pathlib.Path, - deps: list[str], + deps: list[Dependency], cfg: list[str] =3D [], - ) -> None: - append_crate(display_name, root_module, deps, cfg) + ) -> Dependency: + dep =3D append_crate(display_name, root_module, deps, cfg) proc_macro_dylib_name =3D subprocess.check_output( [os.environ["RUSTC"], "--print", "file-names", "--crate-name",= display_name, "--crate-type", "proc-macro", "-"], stdin=3Dsubprocess.DEVNULL, @@ -112,13 +110,14 @@ def generate_crates( "proc_macro_dylib_path": str(objtree / "rust" / proc_macro_dyl= ib_name), } crates[-1] =3D crate + return dep =20 def append_sysroot_crate( display_name: str, - deps: list[str], + deps: list[Dependency], cfg: list[str] =3D [], - ) -> None: - append_crate( + ) -> Dependency: + return append_crate( display_name, sysroot_src / display_name / "src" / "lib.rs", deps, @@ -129,34 +128,34 @@ def generate_crates( # NB: sysroot crates reexport items from one another so setting up our= transitive dependencies # here is important for ensuring that rust-analyzer can resolve symbol= s. The sources of truth # for this dependency graph are `(sysroot_src / crate / "Cargo.toml" f= or crate in crates)`. - append_sysroot_crate("core", [], cfg=3Dcrates_cfgs.get("core", [])) - append_sysroot_crate("alloc", ["core"]) - append_sysroot_crate("std", ["alloc", "core"]) - append_sysroot_crate("proc_macro", ["core", "std"]) + core =3D append_sysroot_crate("core", [], cfg=3Dcrates_cfgs.get("core"= , [])) + alloc =3D append_sysroot_crate("alloc", [core]) + std =3D append_sysroot_crate("std", [alloc, core]) + proc_macro =3D append_sysroot_crate("proc_macro", [core, std]) =20 - append_crate( + compiler_builtins =3D append_crate( "compiler_builtins", srctree / "rust" / "compiler_builtins.rs", [], ) =20 - append_proc_macro_crate( + macros =3D append_proc_macro_crate( "macros", srctree / "rust" / "macros" / "lib.rs", - ["std", "proc_macro"], + [std, proc_macro], ) =20 - append_crate( + build_error =3D append_crate( "build_error", srctree / "rust" / "build_error.rs", - ["core", "compiler_builtins"], + [core, compiler_builtins], ) =20 def append_crate_with_generated( display_name: str, - deps: list[str], - ) -> None: - append_crate( + deps: list[Dependency], + ) -> Dependency: + dep =3D append_crate( display_name, srctree / "rust" / display_name / "lib.rs", deps, @@ -174,10 +173,11 @@ def generate_crates( } } crates[-1] =3D crate + return dep =20 - append_crate_with_generated("bindings", ["core"]) - append_crate_with_generated("uapi", ["core"]) - append_crate_with_generated("kernel", ["core", "macros", "build_error"= , "bindings", "uapi"]) + bindings =3D append_crate_with_generated("bindings", [core]) + uapi =3D append_crate_with_generated("uapi", [core]) + kernel =3D append_crate_with_generated("kernel", [bindings, build_erro= r, core, macros, uapi]) =20 def is_root_crate(build_file: pathlib.Path, target: str) -> bool: try: @@ -207,7 +207,7 @@ def generate_crates( append_crate( name, path, - ["core", "kernel"], + [core, kernel], cfg=3Dcfg, ) =20 --=20 2.48.1 From nobody Thu Dec 18 00:05:32 2025 Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8390D13774D; Wed, 12 Mar 2025 01:17:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742280; cv=none; b=ioIoKZkN8r6ZpectdmY635R3PdbPP40VWMAABHqvmRTZ0BKf6bslP11HnoGWVUA9GZvcH2ia2ZJqdOKAugpSTgACvkpDFP+qI/etE8DRAKg/N32uz5/hh509c+Mkkzzz9Crp18Zi90JmMPwE5gC9lY3mkdWJEYAbgopv91KajUU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1741742280; c=relaxed/simple; bh=oFLZb+2f3dEKqc3Dj426FJzCsxLtRW2V3ml2C8sU7JU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p2fErlE+v+p/r7ydVzdq8JVAFpX9bIDynKISft5aPvOmCOufNT3Zqf9d5RjuoiCk+0YVDLXO34QWE6tnNdhPZanCatbrRKMqfi3m3Ihn7zkArg+nSrVVmpY5UM+PFO3SR1xY6etW2rgtEarnNDeQKx+zpw3YoOhgUwlKFxDAAVo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=R+tlLYmk; arc=none smtp.client-ip=209.85.222.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="R+tlLYmk" Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-7c0892e4b19so619787585a.3; Tue, 11 Mar 2025 18:17:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741742277; x=1742347077; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=GLcgzo5xr/0iG5n3K7ZIKYHwTAs6P/saBSWm6jDBLCw=; b=R+tlLYmkfZ8HvEQSGYinJnaHbj/fQvALto27bzaXSvd1lyDrbbMslr3dpaQx00GPfW uRs5c+IiaQV6grsQ2t7gx87QwNNUpx2wKynwSkx2Thep5uPqZX9FA++L8cLAvvooc+Ht guDt5XwN4g5+UBglYQqIeKoi6+/x1/x2fPzY++z9kHERQ5lrnBD8ELkRaU0eF9Y3Zt9a 7BoAcvB46FC5Ho2ZeUF77lMSBRegYO2CIrM9qOpodQA0+HQNlyT2OTuFb5tNT0fsyngP pfQ5IHoZiFpK4lOUbgohsKA1LpQMHsdGSMoKOg29j/CwlUgKv2kVeJ/kEbpHl2S8KyQv 2H8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741742277; x=1742347077; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GLcgzo5xr/0iG5n3K7ZIKYHwTAs6P/saBSWm6jDBLCw=; b=v9h3af8fflVOQrIAWhq+4MRTmlVayGwgz4/eWtq3AkbpoEuX4FGBpZaek36cL8BFDn +XzZNRm8FoHLp/pwFYmS8p2K6kd/8VqfxWQIv+9LnMYlfiVpRmcKauVb68UryZna58Jr n+3SQvL/9GqmIWiDtpdreFuTKrFXAW+2CWuQqLY7b+PmBsqgXDW01JMnH/8CKjDFSueE WFaDXGLzPhgzEwSRqIEJ85wRQoeLJf4e599JlQTiruk9VGWMGuBMSnp5AgIMZzX/DLqF PPWwozi2uBcU82gdtpR5oX7cuucp8rfCWxVYzGBi1pgheu1WNKIjVLkJQaSaMFUSxU+H oEug== X-Forwarded-Encrypted: i=1; AJvYcCXAzniarLVva1tj8b4T3sa0oKSCgyfIYtIPRC9rtfATpMPYmiyUZ+kDEfHUigzu854PhcKarPxRkIm+mvw=@vger.kernel.org X-Gm-Message-State: AOJu0Yxyzt+WRmP4Mg/McjHcqpTqbPs1K3PTncZy6GZgJThRoB9PCibC JJz64WDR7Avr87SJP4B3tHR8042AmmCLDe9vX0qnEWhid7BEMSUp X-Gm-Gg: ASbGncsXesF4ChF58dNBI8wKQwkZjGRU2ZE7ke/06vQl44Q7USmRvBI4OfK9kUo/Mvu 8ejq7givtpOe8OiSmQz2QMumE6KVo32XwoM7E3mID2hkNPFmRpDFHFL0Ph9CcjV5zlURrZNy6M5 9/SeLx3N+rgLvpUjAUhDM9/P9wmpLh1RM4Lsite991lyL0jEmPZx1ZCH+vWuidyPAQ8R2PgWiEi kPZ6cW44D5c8iu8zBavYe7wft3I0XG32H/wEi7hX7Xro7OexMvacos9XVoN9+cWKTA+f/TIjs09 wQTqzpGpMYBSCqZDwedHG6GmyM213o99da/WvDQXCSMWgFiKTQvreWgvJJRE4dhU5J/K X-Google-Smtp-Source: AGHT+IELfR2KgODTKut+cF9OaKi/VD7QJ0DCl+UiguwJeYOxo4OQjvdKvFS5kKpmgA9CKnTebm0SfQ== X-Received: by 2002:ad4:458c:0:b0:6ea:d393:962c with SMTP id 6a1803df08f44-6ead3939845mr213926d6.30.1741742277490; Tue, 11 Mar 2025 18:17:57 -0700 (PDT) Received: from tamird-mac.local ([2600:4041:5be7:7c00:2017:ee95:21ab:177f]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6e8f70915ebsm78599976d6.49.2025.03.11.18.17.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Mar 2025 18:17:56 -0700 (PDT) From: Tamir Duberstein Date: Tue, 11 Mar 2025 21:17:28 -0400 Subject: [PATCH v2 7/7] scripts: generate_rust_analyzer.py: define host crates Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250311-rust-analyzer-host-v2-7-30220e116511@gmail.com> References: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> In-Reply-To: <20250311-rust-analyzer-host-v2-0-30220e116511@gmail.com> To: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Boris-Chengbiao Zhou , Kees Cook , Fiona Behrens Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Lukas Wirth , Tamir Duberstein X-Mailer: b4 0.15-dev Define host crates used by the `macros` crate separately from target crates, now that we can uniquely identify crates with the same name. This avoids rust-analyzer thinking the host `core` crate has our target configs applied to it. Suggested-by: Miguel Ojeda Link: https://lore.kernel.org/all/CANiq72mw83RmLYeFFoJW6mUUygoyiA_f1ievSC2p= mBESsQew+w@mail.gmail.com/ Signed-off-by: Tamir Duberstein Reviewed-by: Fiona Behrens --- scripts/generate_rust_analyzer.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/generate_rust_analyzer.py b/scripts/generate_rust_anal= yzer.py index e1002867735b..4832a4901c94 100755 --- a/scripts/generate_rust_analyzer.py +++ b/scripts/generate_rust_analyzer.py @@ -128,10 +128,12 @@ def generate_crates( # NB: sysroot crates reexport items from one another so setting up our= transitive dependencies # here is important for ensuring that rust-analyzer can resolve symbol= s. The sources of truth # for this dependency graph are `(sysroot_src / crate / "Cargo.toml" f= or crate in crates)`. + host_core =3D append_sysroot_crate("core", []) + host_alloc =3D append_sysroot_crate("alloc", [host_core]) + host_std =3D append_sysroot_crate("std", [host_alloc, host_core]) + host_proc_macro =3D append_sysroot_crate("proc_macro", [host_core, hos= t_std]) + core =3D append_sysroot_crate("core", [], cfg=3Dcrates_cfgs.get("core"= , [])) - alloc =3D append_sysroot_crate("alloc", [core]) - std =3D append_sysroot_crate("std", [alloc, core]) - proc_macro =3D append_sysroot_crate("proc_macro", [core, std]) =20 compiler_builtins =3D append_crate( "compiler_builtins", @@ -142,7 +144,7 @@ def generate_crates( macros =3D append_proc_macro_crate( "macros", srctree / "rust" / "macros" / "lib.rs", - [std, proc_macro], + [host_std, host_proc_macro], ) =20 build_error =3D append_crate( --=20 2.48.1