Skip to content

Make ConstantItem use Identifier#3810

Merged
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
powerboat9:use-delim
Jun 6, 2025
Merged

Make ConstantItem use Identifier#3810
CohenArthur merged 1 commit into
Rust-GCC:masterfrom
powerboat9:use-delim

Conversation

@powerboat9

Copy link
Copy Markdown
Collaborator

No description provided.

The change to ASTLoweringExternItem is necessary, since with this patch
Identifier can be implicitly converted to std::string.

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit): Handle
	changed type of ConstantItem::identifier.
	* ast/rust-ast.cc (ConstantItem::as_string): Likewise.
	* ast/rust-ast.h (operator const std::string &): New member
	function.
	* ast/rust-item.h (ConstantItem::identifier): Change type from
	std::string to Identifier.
	(ConstantItem::ConstantItem): Handle changed type of identifier
	field.
	(ConstantItem::is_unnamed): Likewise.
	(ConstantItem::get_identifier): Likewise.
	* hir/rust-ast-lower-extern.h (ASTLoweringExternItem::visit):
	Avoid discarding location of wildcard patterns.
	* lex/rust-token.cc: Include "rust-ast.h".
	(Token::make_identifier): Add overload accepting an Identifier
	instance.
	* lex/rust-token.h (class Identifier): Add forward declaration
	in order to...
	(Token::make_identifier): ...declare an overload for this static
	member function.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@CohenArthur CohenArthur added this pull request to the merge queue Jun 6, 2025
Merged via the queue into Rust-GCC:master with commit d4014a3 Jun 6, 2025
12 checks passed
@powerboat9 powerboat9 deleted the use-delim branch June 6, 2025 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants