{"id":2223271,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223271/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260414231905.191063-12-arthur.cohen@embecosm.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null},"msgid":"<20260414231905.191063-12-arthur.cohen@embecosm.com>","date":"2026-04-14T23:18:33","name":"[COMMITTED,12/43] gccrs: Accepts \"compiler_builtins\" attribute","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"240cffd8d7f0f41adda161e1337eae22686916c3","submitter":{"id":83476,"url":"http://patchwork.ozlabs.org/api/1.1/people/83476/?format=json","name":"Arthur Cohen","email":"arthur.cohen@embecosm.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260414231905.191063-12-arthur.cohen@embecosm.com/mbox/","series":[{"id":499900,"url":"http://patchwork.ozlabs.org/api/1.1/series/499900/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=499900","date":"2026-04-14T23:18:24","name":"[COMMITTED,01/43] gccrs: testsuite:Add a testcase for setup_associated_types","version":1,"mbox":"http://patchwork.ozlabs.org/series/499900/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223271/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223271/checks/","tags":{},"headers":{"Return-Path":"<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":["incoming@patchwork.ozlabs.org","gcc-patches@gcc.gnu.org"],"Delivered-To":["patchwork-incoming@legolas.ozlabs.org","gcc-patches@gcc.gnu.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256\n header.s=google header.b=BPl3YL1V;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)","sourceware.org;\n\tdkim=pass (2048-bit key,\n unprotected) header.d=embecosm.com header.i=@embecosm.com header.a=rsa-sha256\n header.s=google header.b=BPl3YL1V","sourceware.org;\n dmarc=none (p=none dis=none) header.from=embecosm.com","sourceware.org; spf=pass smtp.mailfrom=embecosm.com","server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.66"],"Received":["from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fwKt26ylNz1yHc\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 09:16:58 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 313F74BA23E6\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 23:16:57 +0000 (GMT)","from mail-wm1-f66.google.com (mail-wm1-f66.google.com\n [209.85.128.66])\n by sourceware.org (Postfix) with ESMTPS id 68E204BA23FE\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 23:14:27 +0000 (GMT)","by mail-wm1-f66.google.com with SMTP id\n 5b1f17b1804b1-488b150559bso47940175e9.1\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 16:14:27 -0700 (PDT)","from platypus.localdomain (176-147-231-59.abo.bbox.fr.\n [176.147.231.59]) by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488f1dd8806sm3325945e9.3.2026.04.14.16.14.25\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 14 Apr 2026 16:14:25 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 313F74BA23E6","OpenDKIM Filter v2.11.0 sourceware.org 68E204BA23FE"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 68E204BA23FE","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 68E204BA23FE","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776208467; cv=none;\n b=N2ZobxihemIFUEsX55AZVrV01WcZWFDItYUUa6KgIY84A84LbjYBs7Mp/UXLwN9YWVD9yvA/UIDzEBsUGW11XClcfK6lUnMzj1GSMX/pDSRqeik2QjVJDU8jUjw3HaUHPqff1Ygg2cw50CNAVGGlB8yR9svBhzoAUGgmAN/rYoI=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776208467; c=relaxed/simple;\n bh=RkdalBQFIolN/pKmz25yI9A/ioNZpGw6hUABemy+J2A=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=En9AQCS4k7Co8eh9Ahl9b0F2a5sEWFnGWNQ20jfdnpg07k+0hJDVttVQX+vwEzspPQVzr1vBEpeY8GxVHMUqNf+Dr1LMeqwoHrbxoyymR2Vxhy0bM8q4DIbK2xRIvdfpRua6Nr/tbNUkFoY2kIuUPeP6cpsogKfmj9mc4zM9T5g=","ARC-Authentication-Results":"i=1; server2.sourceware.org","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=embecosm.com; s=google; t=1776208466; x=1776813266; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=QoMgKdN9jvsSjEESwW36h7aCuJBmcWTuwmBy2xs8QEI=;\n b=BPl3YL1VcXfHoaAbDubt7CwxRt3+HSgnOBu/Pcl/q/2n3YiKLrOjY7Uqi/Bh7X66vp\n f6e4TpyOSKi2QvcVn2fmQN9wqS6YTWnhULD7GqVtUgExlappzPpjz5ZhSf9jtbpanxCS\n OkdnaHXFuhuYLbi6L/BruuR5p2Hnr3o4PjAjXYp2BY7JGeMhkXz4ELPaxUTAQQaOLwes\n Ohr4yYuN8yc5fg5hkK6q3F1W7/rz+ujMDKPCH+1j93OwUY/845Tb4yq7lbQeXeS6EXFt\n oBp0pkt22en5K/kE6zMskWRQzB444fRNdOSh/++d7KhyZvZnv+xief4pTzvktleef5+x\n 9y+Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776208466; x=1776813266;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=QoMgKdN9jvsSjEESwW36h7aCuJBmcWTuwmBy2xs8QEI=;\n b=T7twujiBuX7ktI6H+4PzLt4rO3XVSlju7xNxOVESPT1B1xEoNtOufTwfKVUjFijMcl\n ibivBsketx/89qWbN+gyKPMNVnpPX9+4Q8YwNe04Xvs8Irs5dGjeEbCbYdlj9VURb1IW\n M5EqpBWIrSDHxJQs52V5Ad849SLZ0EyR1dYOHEAEbHslsk9lgXs0VJJoQ/o8EImGXGLu\n tzO8USc/d8FwmBIhr6kmt0eaLUsJ0UyY27CtN3OqAKiOiKU0iQtXG6tYwA2XBJ5EwRk9\n 3SRm3/9CQyYdCBpIKJjgwkRGIgyJ6hf3Ed9TwlRTENVSDsGDvPfIDJbB9/VqBBOa/6AV\n 4DNQ==","X-Gm-Message-State":"AOJu0Yx2DvlQDuh5zXDMY9CvwyuYaylw21CqgmkfULmF/3MyFvgzqRxR\n zqzQ2X01Gr3Zwn4sS0H8YG7C3VCccw4NpXXiluUbq2zieKTBMa5P2vQgQ9VrXzrkXky8wf2NEOc\n imVscjqVX","X-Gm-Gg":"AeBDievdODrybv0ozhvK+mdkSM7iXe9w/0PbvZNC8lxSdfPSltMlT9+lSqWKp5oPTmZ\n FU5Qt17cZCITCM+PnMuZGs1C9RcAbIZKMEWmHS7rVgKwzls7SNKp6fwkMCzI7r3RbKa7feraIsz\n dDZ3R9qiR4Upm4ERvkWSBrk/IGmcis0lfIYduIjwLhALjYL7yDDDOPD5Z5kFFjbGCeN2ItXf7Cq\n ZOZNzKS4BtETm3/Zd9cRiZKGjY59R43msPcapIj9/qZE6h0v5CHuN3N5KAz/Os/FM48zGg0WVmz\n 8dp0996tusmvLVmM7pSlDObLhQ0VPjnsaJfPTUA45UbstlaxoVhkEF2DYOM++aJwZXDWLT4Rv5o\n TTymhvdFB9uoKT5BvqqmIO0pKnsQFq/NVLILbEG8lo1D6cfPW9lq+houq9pNpAfyqS48fMnn+Wx\n vlHXqo9q0zib6ag8uB+0nUCUJ6qQM42VlkRvQmHHNN5ybwpvkAI0Wn/EalHHas5kc79PwQJKecg\n v0beA==","X-Received":"by 2002:a05:600c:c10f:b0:487:cd8:4c9 with SMTP id\n 5b1f17b1804b1-488d689ca8dmr184117255e9.27.1776208466094;\n Tue, 14 Apr 2026 16:14:26 -0700 (PDT)","From":"arthur.cohen@embecosm.com","To":"gcc-patches@gcc.gnu.org","Cc":"gcc-rust@gcc.gnu.org,\n Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>","Subject":"[COMMITTED 12/43] gccrs: Accepts \"compiler_builtins\" attribute","Date":"Wed, 15 Apr 2026 01:18:33 +0200","Message-ID":"<20260414231905.191063-12-arthur.cohen@embecosm.com>","X-Mailer":"git-send-email 2.50.1","In-Reply-To":"<20260414231905.191063-1-arthur.cohen@embecosm.com>","References":"<20260414231905.191063-1-arthur.cohen@embecosm.com>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"gcc-patches@gcc.gnu.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Gcc-patches mailing list <gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>","List-Archive":"<https://gcc.gnu.org/pipermail/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-request@gcc.gnu.org?subject=help>","List-Subscribe":"<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>","Errors-To":"gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"},"content":"From: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>\n\nThis attribute shall be accepted/rejected depending on the feature\nactivation status.\n\ngcc/rust/ChangeLog:\n\n\t* checks/errors/feature/rust-feature-gate.cc (FeatureGate::visit):\n\tRework visit to avoid multiple iterations. Add check for\n\t\"compiler_builtins\" attribute.\n\t(FeatureGate::check_no_core_attribute): Remove loop.\n\t* checks/errors/feature/rust-feature-gate.h: Update function prototype.\n\t* util/rust-attribute-values.h: Add \"compiler_builtins\" attribute\n\tvalue.\n\t* util/rust-attributes.cc: Add \"compiler_builtins\" to the list of\n\tbuiltin attributes.\n\ngcc/testsuite/ChangeLog:\n\n\t* rust/compile/compiler_builtins_gate.rs: New test.\n\nSigned-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>\n---\n .../errors/feature/rust-feature-gate.cc       | 24 ++++++++++++-------\n .../checks/errors/feature/rust-feature-gate.h |  2 +-\n gcc/rust/util/rust-attribute-values.h         |  2 ++\n gcc/rust/util/rust-attributes.cc              |  1 +\n .../rust/compile/compiler_builtins_gate.rs    |  3 +++\n 5 files changed, 22 insertions(+), 10 deletions(-)\n create mode 100644 gcc/testsuite/rust/compile/compiler_builtins_gate.rs","diff":"diff --git a/gcc/rust/checks/errors/feature/rust-feature-gate.cc b/gcc/rust/checks/errors/feature/rust-feature-gate.cc\nindex 7e21059776b..8c6d5ba2f56 100644\n--- a/gcc/rust/checks/errors/feature/rust-feature-gate.cc\n+++ b/gcc/rust/checks/errors/feature/rust-feature-gate.cc\n@@ -63,7 +63,17 @@ FeatureGate::visit (AST::Crate &crate)\n       rust_error_at (locus, ErrorCode::E0635, \"unknown feature %qs\",\n \t\t     feature.c_str ());\n     }\n-  check_no_core_attribute (crate.inner_attrs);\n+  for (const auto &attribute : crate.inner_attrs)\n+    {\n+      check_no_core_attribute (attribute);\n+\n+      if (attribute.get_path ().as_string ()\n+\t  == Values::Attributes::COMPILER_BUILTINS)\n+\tgate (Feature::Name::COMPILER_BUILTINS, attribute.get_locus (),\n+\t      \"the #[compiler_builtins] attribute is used to identify the \"\n+\t      \"compiler_builtins crate which contains compiler-rt intrinsics \"\n+\t      \"and will never be stable\");\n+    }\n }\n \n void\n@@ -110,15 +120,11 @@ FeatureGate::visit (AST::ExternBlock &block)\n }\n \n void\n-FeatureGate::check_no_core_attribute (\n-  const std::vector<AST::Attribute> &attributes)\n+FeatureGate::check_no_core_attribute (const AST::Attribute &attribute)\n {\n-  for (const AST::Attribute &attr : attributes)\n-    {\n-      if (attr.get_path ().as_string () == Values::Attributes::NO_CORE)\n-\tgate (Feature::Name::NO_CORE, attr.get_locus (),\n-\t      \"no_core is experimental\");\n-    }\n+  if (attribute.get_path ().as_string () == Values::Attributes::NO_CORE)\n+    gate (Feature::Name::NO_CORE, attribute.get_locus (),\n+\t  \"no_core is experimental\");\n }\n \n void\ndiff --git a/gcc/rust/checks/errors/feature/rust-feature-gate.h b/gcc/rust/checks/errors/feature/rust-feature-gate.h\nindex 0675777e0f5..e8bb61b1f61 100644\n--- a/gcc/rust/checks/errors/feature/rust-feature-gate.h\n+++ b/gcc/rust/checks/errors/feature/rust-feature-gate.h\n@@ -54,7 +54,7 @@ public:\n \n private:\n   void gate (Feature::Name name, location_t loc, const std::string &error_msg);\n-  void check_no_core_attribute (const std::vector<AST::Attribute> &attributes);\n+  void check_no_core_attribute (const AST::Attribute &attribute);\n   void check_rustc_attri (const std::vector<AST::Attribute> &attributes);\n   void\n   check_may_dangle_attribute (const std::vector<AST::Attribute> &attributes);\ndiff --git a/gcc/rust/util/rust-attribute-values.h b/gcc/rust/util/rust-attribute-values.h\nindex 7f0b5ca7866..7743d9091c8 100644\n--- a/gcc/rust/util/rust-attribute-values.h\n+++ b/gcc/rust/util/rust-attribute-values.h\n@@ -82,6 +82,8 @@ public:\n   static constexpr auto &RUSTC_LAYOUT_SCALAR_VALID_RANGE_START\n     = \"rustc_layout_scalar_valid_range_start\";\n \n+  static constexpr auto &COMPILER_BUILTINS = \"compiler_builtins\";\n+\n   static constexpr auto &MAY_DANGLE = \"may_dangle\";\n   static constexpr auto &PRELUDE_IMPORT = \"prelude_import\";\n   static constexpr auto &TRACK_CALLER = \"track_caller\";\ndiff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc\nindex 93d71a490d2..cc898971eb9 100644\n--- a/gcc/rust/util/rust-attributes.cc\n+++ b/gcc/rust/util/rust-attributes.cc\n@@ -122,6 +122,7 @@ static const BuiltinAttrDefinition __definitions[]\n      {Attrs::RUSTC_LAYOUT_SCALAR_VALID_RANGE_START, CODE_GENERATION},\n      // TODO: be careful about calling functions marked with this?\n      {Attrs::RUSTC_ARGS_REQUIRED_CONST, CODE_GENERATION},\n+     {Attrs::COMPILER_BUILTINS, CODE_GENERATION},\n      {Attrs::PRELUDE_IMPORT, NAME_RESOLUTION},\n      {Attrs::RUSTC_DIAGNOSTIC_ITEM, STATIC_ANALYSIS},\n      {Attrs::RUSTC_ON_UNIMPLEMENTED, STATIC_ANALYSIS},\ndiff --git a/gcc/testsuite/rust/compile/compiler_builtins_gate.rs b/gcc/testsuite/rust/compile/compiler_builtins_gate.rs\nnew file mode 100644\nindex 00000000000..3417be025d8\n--- /dev/null\n+++ b/gcc/testsuite/rust/compile/compiler_builtins_gate.rs\n@@ -0,0 +1,3 @@\n+#![feature(no_core)]\n+#![no_core]\n+#![compiler_builtins] // { dg-error \"the ..compiler_builtins. attribute is used to identify the compiler_builtins\" }\n","prefixes":["COMMITTED","12/43"]}