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

Avoid visiting nonexistant function parameter types during nr2.0 #3168

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

powerboat9
Copy link
Contributor

This makes 3 more tests pass with name resolution 2.0

@@ -3548,6 +3548,8 @@ class NamedFunctionParam
* '_'). */
bool has_name () const { return name != "_" && name != ""; }

bool has_type () const { return param_type != nullptr; }
Copy link
Member

Choose a reason for hiding this comment

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

If a NamedFunctionParam cannot have a type then we should probably wrap the type pointer within an optional.

@powerboat9 powerboat9 force-pushed the func-fix branch 2 times, most recently from d650189 to 56190de Compare September 23, 2024 21:57
Copy link
Member

@P-E-P P-E-P left a comment

Choose a reason for hiding this comment

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

There are some errors on gcc 4.8 but otherwise it looks fine.

gcc/rust/ChangeLog:

	* ast/rust-ast-visitor.h
	(DefaultASTVisitor::visit): Add overload for tl::optional<T &>.
	* ast/rust-item.h
	(SelfParam::get_type): Return tl::optional<Type &>.

	* ast/rust-ast-collector.cc
	(TokenCollector::visit): Handle changed return type of
	SelfParam::get_type.
	* expand/rust-cfg-strip.cc
	(CfgStrip::visit): Likewise.
	* hir/rust-ast-lower-base.cc
	(ASTLoweringBase::lower_self): Likewise.
	* resolve/rust-ast-resolve-item.cc
	(ResolveTraitItems::visit): Likewise.
	(ResolveItem::visit): Likewise.
	* resolve/rust-ast-resolve-stmt.h
	(ResolveStmt::visit): Likewise.
	* resolve/rust-default-resolver.cc
	(DefaultResolver::visit): Likewise, and properly handle empty
	optional.

gcc/testsuite/ChangeLog:

	* rust/compile/nr2/exclude: Remove entries.

Signed-off-by: Owen Avery <[email protected]>
@powerboat9
Copy link
Contributor Author

It looks like this was mostly superseded by another PR, I'm on the fence with discarding this PR, combining it with something else, or just merging it with some tweaks.

@powerboat9 powerboat9 marked this pull request as draft October 5, 2024 21:30
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