{"id":2223308,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223308/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260414231905.191063-43-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-43-arthur.cohen@embecosm.com>","date":"2026-04-14T23:19:04","name":"[COMMITTED,43/43] gccrs: backend: Prevent error_mark_node from leaking into const context","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"bf515c2416608b628b33cf195940f7fbc7a6dc87","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-43-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/2223308/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223308/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=R2tU+3Ki;\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=R2tU+3Ki","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.67"],"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 4fwLKb5XWhz1yHM\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 09:37:23 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 6517C4BA2E26\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 23:37:21 +0000 (GMT)","from mail-wm1-f67.google.com (mail-wm1-f67.google.com\n [209.85.128.67])\n by sourceware.org (Postfix) with ESMTPS id 41A044BA2E06\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 23:15:22 +0000 (GMT)","by mail-wm1-f67.google.com with SMTP id\n 5b1f17b1804b1-488ba840146so60213105e9.1\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 16:15:22 -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.15.17\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 14 Apr 2026 16:15:18 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 6517C4BA2E26","OpenDKIM Filter v2.11.0 sourceware.org 41A044BA2E06"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 41A044BA2E06","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 41A044BA2E06","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776208522; cv=none;\n b=erokqBS0qvEeYe+3U9Fa1EP8a350r7OzIeC5Gdg9xd3zgzrwg+fLpzivN4dtVDu3cbpUkbiNSd+0KZz8WnR3HgrAagyypPu9vijUYjmK/6VUySuoVk5lkMa6lv/55QBYK3CZgTt0NnxGs7y3GoURUsIiGBP6mJYbtZOitqrecY8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776208522; c=relaxed/simple;\n bh=6hQqbYm3P9Kx1+t2OP+oPJXvy+6hwoAsJY+0dDjwUiA=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=WzmOlKzO7Hit+aa+4EQncivBG1Sm8Aqu0WQxapBMQMlavpN2IOJ2JOs9yRI988T1KfiYIHB21DhIZUvgLO5f1EDu8jhnxMO41f97Z4+dIU1WBHy92cevUNAnToxu7/8UIaV726VZkjo/8Oj6vRAQu6oxJ9gI0qp0WCu4+WrsLag=","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=1776208521; x=1776813321; 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=MlEpK8Z2Njb5p84tTxPbcwV+iSbFuvhezPq5j0pmAYU=;\n b=R2tU+3KiXE7cHfZNHMcXL13sdJHj/TqyzoERB1Vwng3n3ErPe9Ws/dy8ERiV76KgVh\n iIz4tJqe+dUF9qfuCuIr/8N2gJ1TYpcyG9h6A2r5W6m7HTOU3Sm9RuA5Iv6F9vPuQs4m\n CikDy3qLjaovVt/AaED9sKiYPn+T8xXm6MVKeBCx+bxcFLZzX9wKNRNK6RH0zIpWLmS6\n LomiJC0f+6l/4uM2JCR+MLDFxN2qV8p2ivdA8qKKkNt/eganIp+BaJUfIKsJscudhh+f\n P9IroemUbAvZjdFF5etfq3mPYhmCH8Wr6EnIwZ5RtuzjQW8QBVgEKT9h2wvbRZaHS8ew\n ivfQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776208521; x=1776813321;\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=MlEpK8Z2Njb5p84tTxPbcwV+iSbFuvhezPq5j0pmAYU=;\n b=OdREdCRnoYyrNguFTwFPZWhK6R8ij4QiHqA1lOxj3saomOsfwHWja/iyiQOKGlIZ9h\n bCvW4kH4koj6HVCpxTfvq1x1XZrfqYDm4w15nKB8XtlEcAwYHDas9Lf2SiqymWLPLePt\n 7o/Yd9KC8uXjxkohQ1brMKwg/biX+kC68FBJYxIkOhWT2+NAbn/6JZGxzj/QOAEpWd7F\n 2T8bi139Lhiq6WVhsBktzVMnKZMcSypJoLnUADde3TWHlMn1LphPRDAiMl3l4b1gUeNT\n aTn02DF8P9ljLEE1F9Bbcc5MAMg7VdS+7AOWPprZFkjpo92sIm+L+TTZHvN0OVHQwuEO\n 1kSA==","X-Gm-Message-State":"AOJu0Yy5xVmbgu+ISaGo2ZiHZ7ifT4emcuLxkvI6TkZHGKx9JvIoCg3I\n L881TOYvi8QAc2LI6FUutWR+G/P9J07Yv2P48KJMT5e/v/IDQ5qW/wS4/IVsQuyE/5ahntS3ei+\n Y071mEDz3","X-Gm-Gg":"AeBDiesmouhLrLKQ7O3p/LxUxS4Yh70St4nUxRNsffsyUNbBA3nDAKjThjibOzi3FYa\n rzTSMdW8zId+oLbnYm+m6rxwonPOfgy5PBQCfUkHEBn/fJrFMlmaq/6kvOqnm6ykj/TfikJ7SJO\n 4qXRptaIal6b74rJd1kPEpNG0qnvEKSKbjU+dR02/r8V7pL4A8aH0YjqJLFqzgAPj7cqrQglnxa\n b/feEglYeUTQCaldjMPQcAPs+3F2E2ERZxMEFyxHao95ejRDmK1Ohw8uGZjpqFJYag6TwpddN8n\n Y0EAAiZJGETCD0lDVbJHF7zZaU9DAiEwmi6I8m2nD2d0yM32INI+CjbsVGa4TiLhg5/CvUeGsG3\n eq4Ios57c5q4kPalqxp76ipCPV+CCOe6j5cbBXS2ibhdpK7jyGO/hr4fzuFeBRQqgVP85kGklbF\n 84Vyzsb4KaKuLGi7PiTp0XFsYYWHvbh1B6ThWisRbICPNxewjZEzv2vHgfiEh5Nt3gG+TlKNzc3\n 5iGIw==","X-Received":"by 2002:a05:600c:34cc:b0:485:557d:9fe with SMTP id\n 5b1f17b1804b1-488d67e65e7mr254105975e9.12.1776208520615;\n Tue, 14 Apr 2026 16:15:20 -0700 (PDT)","From":"arthur.cohen@embecosm.com","To":"gcc-patches@gcc.gnu.org","Cc":"gcc-rust@gcc.gnu.org,\n\tjayant chauhan <0001jayant@gmail.com>","Subject":"[COMMITTED 43/43] gccrs: backend: Prevent error_mark_node from\n leaking into const context","Date":"Wed, 15 Apr 2026 01:19:04 +0200","Message-ID":"<20260414231905.191063-43-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: jayant chauhan <0001jayant@gmail.com>\n\nFixes Rust-GCC#3910\n\ngcc/rust/ChangeLog:\n\n\t* backend/rust-compile-item.cc (CompileItem::visit): Do not insert\n\tconst_expr into the context if it is an error_mark_node.\n\t* backend/rust-compile-implitem.cc (CompileTraitItem::visit): Likewise.\n\ngcc/testsuite/ChangeLog:\n\n\t* rust/compile/issue-3910.rs: New test.\n\nSigned-off-by: jayant chauhan <0001jayant@gmail.com>\n---\n gcc/rust/backend/rust-compile-implitem.cc |  8 ++++++--\n gcc/rust/backend/rust-compile-item.cc     |  7 +++++--\n gcc/testsuite/rust/compile/issue-3910.rs  | 14 ++++++++++++++\n 3 files changed, 25 insertions(+), 4 deletions(-)\n create mode 100644 gcc/testsuite/rust/compile/issue-3910.rs","diff":"diff --git a/gcc/rust/backend/rust-compile-implitem.cc b/gcc/rust/backend/rust-compile-implitem.cc\nindex f4adaa2dd10..c94f439e1d6 100644\n--- a/gcc/rust/backend/rust-compile-implitem.cc\n+++ b/gcc/rust/backend/rust-compile-implitem.cc\n@@ -44,8 +44,12 @@ CompileTraitItem::visit (HIR::TraitItemConst &constant)\n \t\t\t     resolved_type, canonical_path, const_value_expr,\n \t\t\t     constant.get_locus (),\n \t\t\t     const_value_expr.get_locus ());\n-  ctx->push_const (const_expr);\n-  ctx->insert_const_decl (constant.get_mappings ().get_hirid (), const_expr);\n+  if (const_expr != error_mark_node)\n+    {\n+      ctx->push_const (const_expr);\n+      ctx->insert_const_decl (constant.get_mappings ().get_hirid (),\n+\t\t\t      const_expr);\n+    }\n \n   reference = const_expr;\n }\ndiff --git a/gcc/rust/backend/rust-compile-item.cc b/gcc/rust/backend/rust-compile-item.cc\nindex 28694361b1b..f9b003cf535 100644\n--- a/gcc/rust/backend/rust-compile-item.cc\n+++ b/gcc/rust/backend/rust-compile-item.cc\n@@ -129,8 +129,11 @@ CompileItem::visit (HIR::ConstantItem &constant)\n \t\t\t     const_value_expr.get_locus ());\n   ctx->pop_const_context ();\n \n-  ctx->push_const (const_expr);\n-  ctx->insert_const_decl (mappings.get_hirid (), const_expr);\n+  if (const_expr != error_mark_node)\n+    {\n+      ctx->push_const (const_expr);\n+      ctx->insert_const_decl (mappings.get_hirid (), const_expr);\n+    }\n   reference = const_expr;\n }\n \ndiff --git a/gcc/testsuite/rust/compile/issue-3910.rs b/gcc/testsuite/rust/compile/issue-3910.rs\nnew file mode 100644\nindex 00000000000..57022943e0f\n--- /dev/null\n+++ b/gcc/testsuite/rust/compile/issue-3910.rs\n@@ -0,0 +1,14 @@\n+#![feature(no_core)]\n+#![no_core]\n+\n+struct B<const M: u32> {}\n+\n+impl<const M: u32> B<M> {\n+    const M: u32 = M;\n+}\n+\n+struct C;\n+\n+impl<const M: u32> C { // { dg-error \"unconstrained type parameter\" }\n+    const USE_M: u32 = M;\n+}\n\\ No newline at end of file\n","prefixes":["COMMITTED","43/43"]}