From nobody Thu Jan 8 13:19:45 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1766827115; cv=none; d=zohomail.com; s=zohoarc; b=LYZrlSETQhLnt5YuPl7PVQF4RjUVnWov6NXMN6o1D+UOubZl4/i5b3fCFQJsv19U2UBtAc9I0M+uDGToGBfcJTUEmnCvvyCWB5s6dBRhTf6xSX4wdfNmR0EW6uUOBrJnmiiCCa+R6AA8hOrcsACpGS3jTKV/w0SNk4i8vrwJJk8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766827115; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=5xP6RbDJdxuVF1c+h4BfUbKLKE7O4fF3Vh5w0OqHTD4=; b=LapKevw6KCzl7vHpdLTLIZsS2jlH19IeS9DDT+c4leCzUylb6iyXjlkNyO5pgIFWcnRJKWasWY5cpXc+F0nwnWgkyeMcZ3xOWI1U7YVjC9nNmOp5MkRThmNyY7dutc8OBS5oWTj2C/jL6bvG4GoTjMkCl1vQl9/d4a1MdduQxqU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1766827115553512.2409519320821; Sat, 27 Dec 2025 01:18:35 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vZQQi-0004x5-96; Sat, 27 Dec 2025 04:17:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZQQg-0004vt-TD for qemu-devel@nongnu.org; Sat, 27 Dec 2025 04:17:42 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vZQQe-00032Y-9m for qemu-devel@nongnu.org; Sat, 27 Dec 2025 04:17:42 -0500 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-275-oRe9ZkfpPpSmtjOgZBnf1A-1; Sat, 27 Dec 2025 04:17:36 -0500 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-4779b3749a8so54867355e9.1 for ; Sat, 27 Dec 2025 01:17:36 -0800 (PST) Received: from [192.168.10.48] ([151.95.145.106]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4324ea82fa1sm48076085f8f.23.2025.12.27.01.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Dec 2025 01:17:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1766827059; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5xP6RbDJdxuVF1c+h4BfUbKLKE7O4fF3Vh5w0OqHTD4=; b=SHsLEeeinrHkk7bQMqNMpkMF15Th+Yd9bCSGDrRY3IvnC/PiDCQroQvTkZcsxm4dASyHhs hYW9vo5MbW30O2wv80/vU/T10jlWSuserOA1p8LXRe/PIH2wjRoiRakYGBxwCVozlM2K9M ZLZt3TUsdCw2sfTehhhyWOzPh/xeDEU= X-MC-Unique: oRe9ZkfpPpSmtjOgZBnf1A-1 X-Mimecast-MFC-AGG-ID: oRe9ZkfpPpSmtjOgZBnf1A_1766827056 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1766827054; x=1767431854; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5xP6RbDJdxuVF1c+h4BfUbKLKE7O4fF3Vh5w0OqHTD4=; b=LLrW52SEvVC710rz0V1wqRTAM40bq+yIm+dkyR7ubr1J7zN4RV9rHzTUxPRnl8bl1j zXqxdcCrq6QhlVL5PRDtSeqr5XPBMAkzjara5eRMX+u1PlXU/9XYlA6mJqtVcOdn4fKL tFeCaAoDUA4TeHSL1ZdF59F1GcFE8I0gEN/eJEofX+VVct6Ah1dXNFW2U5z8B1X7x/44 ataPdlIVUUJXGZC6fXF59myxqGOIe6PcgMogYjSh3wQa1eNC00obMhF3FUzw3rIB28iW xNvBq9uD77z8iK/VfcT7+En6vBPQm6nJDdXmRftYSjhzrkeLOOmS9TU58B/bLCdk6R2n sHxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766827054; x=1767431854; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=5xP6RbDJdxuVF1c+h4BfUbKLKE7O4fF3Vh5w0OqHTD4=; b=nDNxUiyXDWBsv2XaPyuHAnVaaPdcsGlmohlkcWb31hcy8/YT8e51MuscCbmwMXRpZf tmF4HGwPKmnkY9LvJmHQ4U5mcyr/Cejrs6C1IQDCQxnPkUSv5iZEQhoMjllFvZfDZZ/n epSYk2nce3lUnJqC5DQ+axzfHdeCTwiWKSr7kwGxVyoMIyLHFWcF0hO6wRUNFQ8yIffd qVQz/mij5Kia/kQKrKjATL3YaXxiLx77ABAJnhGXoKCtaGVjdVCaSPZ0xd6OMggd2Fnm GhHJ2o8z6wc7yQ7RCDksuPf3WCjZKqmiSJT1DIWTgL9KZNsBy1BO6BiW8qfdJkuQK2b7 IY0Q== X-Gm-Message-State: AOJu0YyURvjfA9Vc1J/uDShXfVaXocFQYBeGmu/elGRRlCGbIRZdhOLf lS0zgs9Plv/S2Yc7cxMBySqBB088OXDGWNwaDzKQ04j29DTjP5S/6DVgPCFaYSP0pDBM6dTF1hz vj3rmMAmHHs8KrZMqCrMOcnGP+rdDWcOo3hE46larzMc2lHBMmKXaj4exyXOcWJ5tpJ7z7P+iLT wA/AUnzZ20omdFNYGBu0Z9SVNlBvS+4pQ0eo1bO6sc X-Gm-Gg: AY/fxX6UGduvbTF+fatZkwYTN2G4ythFY/m5gmh3/yRdpUQBgeP8JI4yECCPExZFYYo G2tbY3guK/pfIzYl7gHV0KczffABBN4wIFgysPwFV2AGj+Jh1gMlwWGOhc1eyCwWGHShRqQJsLG W9MBC+9gRpjPNtpoi46Ef8u5UfA6Bwhk5nUltsCVzm2k13DhJKIUtro/S/thdzZXao26ZnsS8qV 2PKVRyPhmocjvKiN/yDdZn6j0aB6wLVs6OFXHkAod3HAkGTBe5H82yiHDuoaECxeUj+JKeiIHEJ /gpw1/osWcmC3ZrVBuSZc7a+Hn2gluNU6Z/lJmgdepDKFuEf1KG9DzG1L8JdDzGcKmMyaJ2K2Dt nsuIFc2EjFtzPGsC1HbUf/j/edxKm885Ri9HLFtPzHvrwmSVVvhosPg4yF0aE1DPWECUL14ViAf 0BfgYDkM8+IH0pm88= X-Received: by 2002:a05:600c:19c6:b0:477:7b9a:bb0a with SMTP id 5b1f17b1804b1-47d4cb41658mr52598825e9.21.1766827054119; Sat, 27 Dec 2025 01:17:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IFYvmmj3BK11NvnSycBHmzd+Lmg1JzeV29inqTR3Znqp/L8j2XTZWBpKwB0CBu7B+CzDdG22Q== X-Received: by 2002:a05:600c:19c6:b0:477:7b9a:bb0a with SMTP id 5b1f17b1804b1-47d4cb41658mr52598515e9.21.1766827053669; Sat, 27 Dec 2025 01:17:33 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: Zhao Liu Subject: [PULL 036/153] rust: move strict lints handling to meson.build Date: Sat, 27 Dec 2025 10:14:23 +0100 Message-ID: <20251227091622.20725-37-pbonzini@redhat.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251227091622.20725-1-pbonzini@redhat.com> References: <20251227091622.20725-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.129.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1766827117370158500 Content-Type: text/plain; charset="utf-8" Simplify rustc_args.py, and align its code with what Meson's own Cargo.toml translator does in v1.10. Bump unknown_lints to "forbid", so that it will certainly override Cargo.to= ml's "allow" level. Reviewed-by: Zhao Liu Signed-off-by: Paolo Bonzini --- meson.build | 7 +++---- scripts/rust/rustc_args.py | 21 +++------------------ 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/meson.build b/meson.build index 270181038bf..e6a11cefdb7 100644 --- a/meson.build +++ b/meson.build @@ -128,14 +128,13 @@ if have_rust rustc_args =3D [find_program('scripts/rust/rustc_args.py'), '--rustc-version', rustc.version(), '--workspace', meson.project_source_root() / 'rust'] - if get_option('strict_rust_lints') - rustc_args +=3D ['--strict-lints'] - endif - rustfmt =3D find_program('rustfmt', required: false) =20 rustc_lint_args =3D run_command(rustc_args, '--lints', capture: true, check: true).stdout().strip().splitlines() + if get_option('strict_rust_lints') + rustc_lint_args +=3D ['-Dwarnings', '-Funknown_lints'] + endif =20 # Apart from procedural macros, our Rust executables will often link # with C code, so include all the libraries that C code needs. This diff --git a/scripts/rust/rustc_args.py b/scripts/rust/rustc_args.py index 63b0748e0d3..8098053720a 100644 --- a/scripts/rust/rustc_args.py +++ b/scripts/rust/rustc_args.py @@ -35,8 +35,6 @@ except ImportError: import tomli as tomllib =20 -STRICT_LINTS =3D {"unknown_lints", "warnings"} - =20 class CargoTOML: tomldata: Mapping[Any, Any] @@ -82,7 +80,7 @@ class LintFlag: priority: int =20 =20 -def generate_lint_flags(cargo_toml: CargoTOML, strict_lints: bool) -> Iter= able[str]: +def generate_lint_flags(cargo_toml: CargoTOML) -> Iterable[str]: """Converts Cargo.toml lints to rustc -A/-D/-F/-W flags.""" =20 toml_lints =3D cargo_toml.lints @@ -103,13 +101,7 @@ def generate_lint_flags(cargo_toml: CargoTOML, strict_= lints: bool) -> Iterable[s flag =3D "-F" else: raise Exception(f"invalid level {level} for {prefix}{lint}= ") - - if not (strict_lints and lint in STRICT_LINTS): - lint_list.append(LintFlag(flags=3D[flag, prefix + lint], p= riority=3Dpriority)) - - if strict_lints: - for lint in STRICT_LINTS: - lint_list.append(LintFlag(flags=3D["-D", lint], priority=3D100= 0000)) + lint_list.append(LintFlag(flags=3D[flag, prefix + lint], prior= ity=3Dpriority)) =20 lint_list.sort(key=3Dlambda x: x.priority) for lint in lint_list: @@ -187,13 +179,6 @@ def main() -> None: required=3DFalse, default=3D"1.0.0", ) - parser.add_argument( - "--strict-lints", - action=3D"store_true", - dest=3D"strict_lints", - help=3D"apply stricter checks (for nightly Rust)", - default=3DFalse, - ) args =3D parser.parse_args() if args.verbose: logging.basicConfig(level=3Dlogging.DEBUG) @@ -207,7 +192,7 @@ def main() -> None: cargo_toml =3D CargoTOML(args.cargo_toml, None) =20 if args.lints: - for tok in generate_lint_flags(cargo_toml, args.strict_lints): + for tok in generate_lint_flags(cargo_toml): print(tok) =20 if rustc_version >=3D (1, 80): --=20 2.52.0