From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x535.google.com (mail-ed1-x535.google.com [IPv6:2a00:1450:4864:20::535]) by sourceware.org (Postfix) with ESMTPS id 6A8F0385E459 for ; Thu, 1 Aug 2024 14:59:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6A8F0385E459 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embecosm.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6A8F0385E459 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::535 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524445; cv=none; b=hUb6glTHE7TjffAODvcABwEcYmvAfDrCPNz7dW1r3cnxyan+1e2kAQPOnWK9I0rYjq45iR3GK9Q3JpfxHKF1AtMUZhdqRzLdsRCR3hFycaYSqQWk/arl2I6jKpqobSS88U+D7ezCGBzaSbcVWO7AR5PlGUu6l0b7FBnqcoa3oi4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722524445; c=relaxed/simple; bh=tL4Bk9JYpupRsiQQUsL9IkbXb6y77/BO4eHhtiys+D8=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=vAVljgT1DkGDWAdbqoJhFsJRyRGK8U0EMrxKFASmqo1cDiZwoHr7Foae/VmvyXOSFVwEWzlqy0imwkxUsPeAPN2jc4xjXq5HsN0iHhALHrP5dxFcGKV9HT1Dfs/e23L2eBWnhb5ILsyE3CUwTX4FDEOU4eh8iJRh5vfKDp7sT4I= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-ed1-x535.google.com with SMTP id 4fb4d7f45d1cf-5a2ffc346ceso9976191a12.1 for ; Thu, 01 Aug 2024 07:59:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; t=1722524388; x=1723129188; darn=gcc.gnu.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=ueLb8+yBiNIR8z7L39bfkISYqvMk7DwGXMxh31B6TFI=; b=DnoGWek8AqiOknRdtZro5HhHNeXC7h3nQGn8GfXUTpuZtICu20JOnpry6BBTOVSMVj KAMh3uCY46OkSeogu2zKw9hkj0R5rmfK37wXzW0BK74R3PHLv6MrBC0DjuJ3+7Hpo98m ebOV8Azi35p3brxwHj55L4sur3HK2stG66Eyf5gpQilqe2B4+Jhhg7LkLBwnLhQ+f8uc D1kJJ6zC9MBhUuv/d1xiupBx/gp7I4hHP+xbtw9ohC7jy7Q0B6bdptzxXZZJklPyxGEu PAmYVw1jS2wdypaj7j0NVtZEqQx1O31Vt7XLFDagDLMZa4Sc7K9CN8fKKDCbDjp907St pIbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722524388; x=1723129188; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ueLb8+yBiNIR8z7L39bfkISYqvMk7DwGXMxh31B6TFI=; b=sHSyDk1fSJfChGpt7n/WU3ZtCak/ATio7KFocyS9tj2SB4JbJxqddx4sxJCnXjaKTv bEGB7WTkJiHvV4OgxSBOwgGPbfticok7yo+5KSncCv231HUQyiCunH4qGgxIo2EgabHf dktbFMjW1MTr28LjMfiLRHQv7wjohsA1FSyqqn8aoXkmfje5c1xcAx65Zm3xSOejXZCW IdgkZnW9IqdIbYsP7oYqr2SUsNE5KhcTHa1p1A4OVvlfR8uC5NAYqanrdfWgVDiAU1NH EV9/tBqqFKmoGv1Cpze+7kpupg9iSVtWxVCuBo+ro+HTDwydx+K979ZqUapbrhvwGV5P mOXQ== X-Gm-Message-State: AOJu0YwWjpIB/3Afr5B0WAtVaizgIalRGpmG17/o7fswK9MdpxpVG3V6 YJz/1RB7Isu9iusgOMUhI2h9USLcsrlee00UTDFULPoS12WYlvs5iAPsNbmEbXn46RhxQK12jIy DLaL0 X-Google-Smtp-Source: AGHT+IH28hmqzPssd8oz95IbpAoijFHduhylXyIiGp1puBLvK7F8eG0xBaBnrvQyUCkdnaFktVlPlA== X-Received: by 2002:a50:e602:0:b0:5a2:763e:b8bf with SMTP id 4fb4d7f45d1cf-5b7f53146d9mr430988a12.25.1722524388451; Thu, 01 Aug 2024 07:59:48 -0700 (PDT) Received: from platypus.lan ([2a04:cec2:9:dc84:3622:6733:ff49:ee91]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5ac63590592sm10252456a12.25.2024.08.01.07.59.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 07:59:47 -0700 (PDT) From: Arthur Cohen To: gcc-patches@gcc.gnu.org Cc: gcc-rust@gcc.gnu.org, Pierre-Emmanuel Patry Subject: [PATCH 085/125] gccrs: Unit struct constructor shall be resolved Date: Thu, 1 Aug 2024 16:57:21 +0200 Message-ID: <20240801145809.366388-87-arthur.cohen@embecosm.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801145809.366388-2-arthur.cohen@embecosm.com> References: <20240801145809.366388-2-arthur.cohen@embecosm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Pierre-Emmanuel Patry Unit struct have a special constructor that should be added to the struct namespace in order to be resolved later when called. As it is a function it should be added in the value namespace. gcc/rust/ChangeLog: * resolve/rust-toplevel-name-resolver-2.0.cc (GlobbingVisitor::visit): Add the struct constructor when the struct is a unit. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc index 4134b9a4620..75d9bb82131 100644 --- a/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc +++ b/gcc/rust/resolve/rust-toplevel-name-resolver-2.0.cc @@ -68,8 +68,13 @@ void GlobbingVisitor::visit (AST::StructStruct &struct_item) { if (struct_item.get_visibility ().is_public ()) - ctx.insert_shadowable (struct_item.get_identifier (), - struct_item.get_node_id (), Namespace::Values); + { + ctx.insert_shadowable (struct_item.get_identifier (), + struct_item.get_node_id (), Namespace::Types); + if (struct_item.is_unit_struct ()) + ctx.insert_shadowable (struct_item.get_identifier (), + struct_item.get_node_id (), Namespace::Values); + } } void -- 2.45.2