Skip to content

Conversation

@lucbf
Copy link
Contributor

@lucbf lucbf commented Nov 28, 2025

previously the compiler emmited:

expecting ‘(’ but ‘identifier’ found

now it emmits:

unexpected token 'identifier' - expected bare function

code example:

impl Foo for
fn my_function() {
//do something
}

@lucbf
Copy link
Contributor Author

lucbf commented Nov 28, 2025

Not sure if I'm doing things right, but I had to delete my previous branch to rebase to the current gccrs

@P-E-P
Copy link
Member

P-E-P commented Nov 28, 2025

Not sure if I'm doing things right, but I had to delete my previous branch to rebase to the current gccrs

No this doesn't feel right. You don't have to delete anything to rebase your work on top of master. If you maintain a master branch on your fork then you can simply fetch it from the main repository and rebase it, either with your local git or online using the "sync fork" button.

@lucbf
Copy link
Contributor Author

lucbf commented Nov 28, 2025

I pushed the button and suddenly all the compiler checks failed, but I guess I could just delete my local branch

@lucbf
Copy link
Contributor Author

lucbf commented Nov 28, 2025

Alpine build couldn't run properly because It couldn't download gettext-0.22.tar.gz

return nullptr;

auto t = lexer.peek_token ();
if (t->get_id () == IDENTIFIER)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should probably replace this condition with != LEFT_PAREN

Copy link
Collaborator

Choose a reason for hiding this comment

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

unless this is just intended to cover the identifier case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It definitely wouldn't be right to check for just one case

@lucbf lucbf changed the title Adds check for IDENTIFIER at parse_bare_function_type Adds check for token at parse_bare_function_type Nov 28, 2025
@lucbf lucbf changed the title Adds check for token at parse_bare_function_type Add check for token at parse_bare_function_type Nov 28, 2025
Comment on lines 9684 to 9685
if (!skip_token (LEFT_PAREN))
return nullptr;
Copy link
Member

Choose a reason for hiding this comment

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

This condition can be removed, we've already checked for a LEFT_PAREN and returned a nullptr, we only need to skip it.

lucbf added 5 commits December 1, 2025 16:14
gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h: new error

Signed-off-by: Lúcio Boari Fleury <[email protected]>
gcc/testsuite/ChangeLog:

	* rust/compile/invalid_impl_for.rs: triggers check for identifier

Signed-off-by: Lúcio Boari Fleury <[email protected]>
gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h: (parse_bare_function_type) broadens check

gcc/testsuite/ChangeLog:

	* rust/compile/invalid_impl_for.rs: broadens regex

Signed-off-by: Lúcio Boari Fleury <[email protected]>
gcc/testsuite/ChangeLog:

	* rust/compile/invalid_impl_for.rs: nothing should change in principle

Signed-off-by: Lúcio Boari Fleury <[email protected]>
gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h: (parse_bare_function_type) remove redundancy

Signed-off-by: Lúcio Boari Fleury <[email protected]>
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.

3 participants