Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add lang-item paths #3068

Merged
merged 3 commits into from
Aug 19, 2024
Merged

Conversation

CohenArthur
Copy link
Member

This PR cleans up the existing base Path* nodes and creates a new Path tagged union for representing lang items paths.

@CohenArthur CohenArthur added this to the Lang items path fixes milestone Jun 25, 2024
@P-E-P P-E-P self-requested a review June 26, 2024 12:58
@CohenArthur CohenArthur force-pushed the lang-items-paths branch 3 times, most recently from 3cc1ed5 to 528b711 Compare July 3, 2024 12:43
@CohenArthur CohenArthur marked this pull request as draft July 4, 2024 14:57
@CohenArthur CohenArthur force-pushed the lang-items-paths branch 2 times, most recently from 263b2f0 to 3250976 Compare August 14, 2024 12:45
@CohenArthur CohenArthur marked this pull request as ready for review August 19, 2024 11:15
This method was used only for stripping PathPattern AST nodes during
`cfg-strip`, which seems like a misnomer and makes it a good candidate
for simplification.

gcc/rust/ChangeLog:

	* ast/rust-path.h (class PathInExpression): Remove `remove_all_segments`
	method, add a `marked_for_strip` flag instead.
Inherit directly from ExprWithoutBlock instead.

gcc/rust/ChangeLog:

	* ast/rust-ast.h (class PathExpr): Remove class.
	* ast/rust-path.h (class PathInExpression): Inherit from ExprWithoutBlock.
	(class QualifiedPathInExpression): Likewise.
Create a base Path class which is derived into two children classes for
regular paths and lang item paths. This allows it to hold either the
segments of a fully formed path, or the node ID of a lang-item path.
This is required in order to create these special paths
which do not have segments, and do not necessarily have a canonical
form - they only depend on where the item was defined.

gcc/rust/ChangeLog:

	* ast/rust-ast-full-decls.h (class PathPattern): Rename PathPattern to...
	(class Path): ...Path
	* ast/rust-ast-collector.cc (TokenCollector::visit): Add required methods
	for LangItemPath and RegularPath.
	* ast/rust-ast-collector.h: Likewise.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
	* ast/rust-ast-visitor.h: Likewise.
	* ast/rust-path.cc (PathPattern::as_string): Likewise.
	(RegularPath::as_string): Likewise.
	(LangItemPath::as_string): Likewise.
	(PathPattern::convert_to_simple_path): Likewise.
	(RegularPath::convert_to_simple_path): Likewise.
	(RegularPath::accept_vis): Likewise.
	(LangItemPath::accept_vis): Likewise.
	(PathInExpression::as_string): Likewise.
	(QualifiedPathInExpression::as_string): Likewise.
	* ast/rust-path.h (class PathPattern): Likewise.
	(class Path): Likewise.
	(class RegularPath): Likewise.
	(class LangItemPath): Likewise.
	(class PathInExpression): Likewise.
	(class QualifiedPathInExpression): Likewise.
	* ast/rust-pattern.h (class PathPattern): Likewise.
	(class Path): Likewise.
	* expand/rust-derive.h: Likewise.
	* hir/rust-ast-lower-base.cc (ASTLoweringBase::visit): Likewise.
	* hir/rust-ast-lower-base.h: Likewise.
	* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): Likewise.
	* resolve/rust-ast-resolve-base.h: Likewise.
@CohenArthur CohenArthur added this pull request to the merge queue Aug 19, 2024
Merged via the queue into Rust-GCC:master with commit d44051d Aug 19, 2024
9 checks passed
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.

1 participant