Skip to content

Parse expression instead of literal in attributes #4016

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

Merged
merged 1 commit into from
Aug 2, 2025

Conversation

P-E-P
Copy link
Member

@P-E-P P-E-P commented Jul 30, 2025

No description provided.

@P-E-P P-E-P force-pushed the attribute-parser-core branch 3 times, most recently from ff0f136 to 0580e33 Compare July 30, 2025 14:24
@P-E-P
Copy link
Member Author

P-E-P commented Jul 30, 2025

@powerboat9 I've just seen that this PR clashes with #3914 , #3914 contains some other changes I wished to work on next (rustc_allow_const_fn_unstable) is it ready to merge ? Could you bring up some PRs with some of those changes ? Should we merge this PR ?

@powerboat9
Copy link
Collaborator

I'll create some PRs -- I think this PR in particular is ~equivalent to a commit I have ready, although I need to do some rebasing + conflict resolution to find that

@powerboat9
Copy link
Collaborator

I've got #4018, along with a follow-up commit ready that's ~equivalent to this PR. I think I'll probably just use the latter commit to make suggestions for this PR

@P-E-P P-E-P force-pushed the attribute-parser-core branch 5 times, most recently from 44cde04 to 4f93901 Compare August 1, 2025 17:54
@P-E-P P-E-P requested a review from powerboat9 August 1, 2025 17:55
Copy link
Collaborator

@powerboat9 powerboat9 left a comment

Choose a reason for hiding this comment

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

Otherwise, looks good. I wouldn't be noticing these if I wasn't making line-by-line comparisons with powerboat9@a690152

@P-E-P P-E-P force-pushed the attribute-parser-core branch from 4f93901 to be8b265 Compare August 1, 2025 21:46
gcc/rust/ChangeLog:

	* ast/rust-ast.cc (AttributeParser::parse_path_meta_item): Parse
	expression instead of literal. Update variant name.
	(MetaItemPathLit::to_attribute): Remove function.
	(AttributeParser::parse_path_meta_item): Update name.
	(MetaItemPathLit::check_cfg_predicate): Likewise.
	(MetaItemPathExpr::check_cfg_predicate): Likewise.
	(MetaItemPathLit::accept_vis): Likewise.
	(MetaItemPathExpr::accept_vis): Likewise.
	* ast/rust-ast-collector.h: Update prototype and adapt code to new
	expression.
	* ast/rust-ast-collector.cc: Update code to expr.
	* ast/rust-ast-full-decls.h (class MetaItemPathLit): Likewise.
	(class MetaItemPathExpr): Likewise.
	* ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise.
	* ast/rust-ast-visitor.h: Likewise.
	* ast/rust-ast.h (class MetaItemPathLit): Rename class from here...
	(class MetaItemPathExpr): ... to here.
	* ast/rust-expr.h (class MetaItemPathLit): Rename class from here...
	(class MetaItemPathExpr): ...to here.
	* expand/rust-derive.h: Update class name.
	* expand/rust-expand-visitor.cc (ExpandVisitor::visit): Likewise.
	* expand/rust-expand-visitor.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.
	* resolve/rust-early-name-resolver.cc (EarlyNameResolver::visit):
	Likewise.
	* resolve/rust-early-name-resolver.h: Likewise.
	* util/rust-attributes.cc (AttributeChecker::visit): Likewise.
	* util/rust-attributes.h: Likewise.

Signed-off-by: Pierre-Emmanuel Patry <[email protected]>
@P-E-P P-E-P force-pushed the attribute-parser-core branch from be8b265 to c743eaa Compare August 1, 2025 23:07
@P-E-P P-E-P added this pull request to the merge queue Aug 2, 2025
Merged via the queue into Rust-GCC:master with commit b77dfdb Aug 2, 2025
13 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.

2 participants