From nobody Sat Nov 29 10:48:19 2025 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=1764250736; cv=none; d=zohomail.com; s=zohoarc; b=R6Jmv5RG5TYryOY4yQJQJPnkiVNaRu7UvcA9dye8i6pexPrAhTPLFk5+4rTDLBitWdUtpcxGfVTrjn1lTutR5IEAH5ZjsFNXWd9pSy7NHgdIlMWXI4170e6K6EwjrL4iBcLmgRcJsbhL7DwpDLC3Qc4ZohoHOOqYe1MTT/jiEec= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1764250736; 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=35cW+AZMPXzQdRbMH+IdIxqC+JST8jSEuSl2qWTOWks=; b=LBRr2fziqEs9pxeZ1cg3lIq38MTGT/cH6WImRv0GrzKlI3kxfL5Wyr5uk2CyBtVgR4BsWJ9p/TPslP6DNFY/HKkmxr+ratpv4nJx+XTsCmbgOXTceBKcPrjBQ2KgHnzdOrk/ZHCfIgC6F97lz8O3jjNoa/DQDFLYFOVZpnZWAGM= 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 1764250736811638.3557494606813; Thu, 27 Nov 2025 05:38:56 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1vObwC-0006c4-2U; Thu, 27 Nov 2025 08:21:32 -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 1vObvj-0005dM-UU for qemu-devel@nongnu.org; Thu, 27 Nov 2025 08:21:10 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1vObvg-000284-JC for qemu-devel@nongnu.org; Thu, 27 Nov 2025 08:21:03 -0500 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-410-c-OhUnlWNxaBrz9DRHw4HQ-1; Thu, 27 Nov 2025 08:20:57 -0500 Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-b70b1778687so66651466b.0 for ; Thu, 27 Nov 2025 05:20:57 -0800 (PST) Received: from [192.168.10.48] ([176.206.119.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b76f5162c5csm168898566b.6.2025.11.27.05.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Nov 2025 05:20:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1764249658; 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=35cW+AZMPXzQdRbMH+IdIxqC+JST8jSEuSl2qWTOWks=; b=T+uO4cp98xD1lWMC5n54Aha/DksMS1EP4PGSBGkAJwH0TCMGxISDjrEbS21C7MqZc+1zYp Th/CPALv6dcq5lABIV3TDwMg8PDvqG9b4RuW5vFIxf57n2gCpoMCo0B/JRc5zEeLy+WvJ/ vrObl7s6wmOJDVHlAYXHILsu0rN0YiI= X-MC-Unique: c-OhUnlWNxaBrz9DRHw4HQ-1 X-Mimecast-MFC-AGG-ID: c-OhUnlWNxaBrz9DRHw4HQ_1764249656 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1764249656; x=1764854456; 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=35cW+AZMPXzQdRbMH+IdIxqC+JST8jSEuSl2qWTOWks=; b=AbUhf2c6BFCvURO3nxuIzJFb1EIp1Fk/WEYhEmYgJCHda9rgBYvxRiUoyrX0vJG4qy T7FE7Mxdzfk2ZTm5HRaLV4HEq5W7pe8gpb9l422t2xvCGWq2/9yONd0moLCyU0fqFyRL Iwampp12nxmD8ndZDR6DugAITrpUykGeNG8H812z8hf5aeSvcuPYNWZey/dIxZZaPxjH aMxcuB9j+Xa8gzVo6riM8vl7NdxrwyWN+WY/uOYS5L8sa0wKsL9oNXnmC8B1m0N36mJX nc4k73Mmim2QUHFpL0piui/r2Gkh83aa67gE6cH32GwdQDKQeTGt9HaVZxCUn7Na2dKZ 5Csg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764249656; x=1764854456; 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=35cW+AZMPXzQdRbMH+IdIxqC+JST8jSEuSl2qWTOWks=; b=BdCyrHslDKRZAqM2zotX3q7dxEHtDQV25dEEd5fjdQhvv3gXefo9HKLd54kJyXcf7F hj+SP8W50pNqjMjYVGR6Cdx9zv0bR3p7crIr7rqE7wxeteUs+3E/GAgKKOnlkIAjnMgQ HGKbvjRjZ9Ddj0AheK9fkQgqWf6zHMWwvE9lWfXH6JjJa9V6hZ52WP1qrHWYriXGDrij aAUZDih/fDTskCxH2erHRNub8sII/rZFocnouxfXnlEwTxNRLI5qkWHNJEEUNz2S2ekF rSoADOwbI4BsgT6RMhOTyKwIjEjeOKyOToBgvPyGcYLWJW8th1pldi0duH3owBzNGsly 9Zmw== X-Gm-Message-State: AOJu0Yx1Q/ohg9Uj8okzwNvu9Yu40Pc2HQKE+QQClCNAcw1APRP+dAUa ykRsobz2RDMQC7Hqk+dgZcQ9Xni35TfWYg7sgRdB9Yx1kWOY82Z/khjMeR6/lNDPB1gixESgS2i FijwtLjtXP5NUZ06ZxdXqtH36t0yuRnVuL1Jpf3eU9Y1iaJ4A5VPrjQg2/8em/bR7g8bfpMazhT 2IQj5DwIumGv5lwCT4V7yJvjSh6OJVyVDjjiywodUU X-Gm-Gg: ASbGncvM03wPAdTgkHZ8TfYatRfK2MNSUxHgwchO7ZPYa+3KTCw4Sr90VN/YnsCf4kD OdjuxVO6QRn8315f/XeuD9XEzNd31Pi2CAHBz+9TohsW+W5KhNgEJk9ftVNy6Qy39QElU0IwiVC gE17C1u38XYl25NBIzLru7w5Dw9nVSI5X33p/Wuf7yvifvKQv/llUHMl7HeJeXHCgCoXscRfdhU yTrLCZblAwbYvmPFvWD19vmkW71COVAs2HeC0WSCI0N8Kh4/6Dbk+Q+O/gKlbGIPjgLxU7t2M8B Jq01BqYBxVz7R3XJDLS28hEDX26pYrVqwnUQ0cfk+UBCUpUtVf6KFse9BKQfeSlst0M4h+locm+ 4D3YCB7p2QmFiEwwRlHRHyCPfIxf60qcciyG50Ln/LYT1ILYS5PutJW/5bcYAwxhUXEfwgv8sSX DymVBnjSKQztKCVjs= X-Received: by 2002:a17:907:2d11:b0:b73:853d:540e with SMTP id a640c23a62f3a-b767170c823mr2707245666b.30.1764249655063; Thu, 27 Nov 2025 05:20:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IGLkSAX/ex76yeg+naPEWLopgu3EY8SdxOS3m/Q7KCanmYDR6Wnsq+TcIYxujg2u6gn2qQCRQ== X-Received: by 2002:a17:907:2d11:b0:b73:853d:540e with SMTP id a640c23a62f3a-b767170c823mr2707242666b.30.1764249654592; Thu, 27 Nov 2025 05:20:54 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Cc: qemu-rust@nongnu.org Subject: [PATCH 7/9] rust: move strict lints handling to meson.build Date: Thu, 27 Nov 2025 14:20:34 +0100 Message-ID: <20251127132036.84384-8-pbonzini@redhat.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251127132036.84384-1-pbonzini@redhat.com> References: <20251127132036.84384-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 client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -22 X-Spam_score: -2.3 X-Spam_bar: -- X-Spam_report: (-2.3 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.224, 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_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_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: 1764250737321019200 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. Signed-off-by: Paolo Bonzini --- meson.build | 7 +++---- scripts/rust/rustc_args.py | 20 ++------------------ 2 files changed, 5 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..8fb77785350 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 @@ -104,13 +102,6 @@ def generate_lint_flags(cargo_toml: CargoTOML, strict_= lints: bool) -> Iterable[s else: raise Exception(f"invalid level {level} for {prefix}{lint}= ") =20 - 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.sort(key=3Dlambda x: x.priority) for lint in lint_list: yield from lint.flags @@ -187,13 +178,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 +191,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.51.1