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

Fail to parse async function #2650

Closed
P-E-P opened this issue Oct 6, 2023 · 5 comments · Fixed by #2736
Closed

Fail to parse async function #2650

P-E-P opened this issue Oct 6, 2023 · 5 comments · Fixed by #2736

Comments

@P-E-P
Copy link
Member

P-E-P commented Oct 6, 2023

GCCRS fails to parse an async function

I tried this code:

pub async fn a() -> u32 {
    1
}

I expected to see this happen: Compile correctly

Instead, this happened:

./test.rs:1:5: error: failed to parse item in crate
    1 | pub async fn a() -> u32 {
      |     ^~~~~

Meta

007166c

@P-E-P P-E-P added the bug label Oct 6, 2023
@P-E-P P-E-P added this to the GCC 14.1 release milestone Oct 6, 2023
@P-E-P P-E-P added the parser label Oct 6, 2023
@mvvsmk
Copy link
Contributor

mvvsmk commented Oct 16, 2023

Hey , @P-E-P could you assign this to me, I'll start working on it. :)

@officialhemant511
Copy link

i think GCCRS is a tool that aims to provide compatibility with the C language and may not support all Rust language features, such as async/await. Therefore, if you're trying to use async/await in your code, GCCRS may not be the appropriate tool for that specific task.i think we work with c code here...

@P-E-P
Copy link
Member Author

P-E-P commented Oct 20, 2023

i think GCCRS is a tool that aims to provide compatibility with the C language and may not support all Rust language features, such as async/await. Therefore, if you're trying to use async/await in your code, GCCRS may not be the appropriate tool for that specific task.i think we work with c code here...

We're trying to support rust version 1.49 for now. Async/await syntax were introduced in version 1.38 of the language, this means we should support those. Even if asynchronous code may not be the highest priority, this issue reduce the gap between rust and our parser. This is mandatory to be able to parse all rustc's test suite, we're only a few percentage away.

@P-E-P
Copy link
Member Author

P-E-P commented Nov 9, 2023

@mvvsmk have you made any progress so far ? I think we'll need this earlier than expected as I'm working on AST validation. If you feel you won't be able to work on this soon I could reassign the issue, don't put any pressure on yourself or anything.

Also if you need any help to solve this, tell me.

@mvvsmk
Copy link
Contributor

mvvsmk commented Nov 10, 2023

Hey @P-E-P , I made the changes two weeks ago and forgot to make a PR. Apologies for the delay; it completely slipped my mind, been a bit busy last month. I have made the PR now. Could you code review my PR, if I missed something do let me know.

mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 10, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions.
gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item):Added ASYNC case.
	(Parser::parse_vis_item):Added a switch case to handle ASYNC.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650.rs: New test.

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 16, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 17, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 17, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 21, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 21, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 21, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
@P-E-P P-E-P linked a pull request Nov 21, 2023 that will close this issue
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 21, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
mvvsmk added a commit to mvvsmk/gccrs that referenced this issue Nov 21, 2023
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
github-merge-queue bot pushed a commit that referenced this issue Nov 21, 2023
Fixes issue #2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 17, 2024
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 26, 2024
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Jan 26, 2024
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
CohenArthur pushed a commit to CohenArthur/gccrs that referenced this issue Feb 5, 2024
Fixes issue Rust-GCC#2650
The parser now parses ASYNC functions. Added ASYNC case to parse_item
Added a new function parse_async_item which is called in
parse_vis_item to handle the ASYNC case. Parse_async_item
also checks the current Rust edition and generates an error if the
edition is 2015

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_item): Likewise.
	(Parser::parse_vis_item): Likewise.
	(Parser::parse_async_item): Likewise.
	* parse/rust-parse.h: Made declaration for parse_async_item.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-2650-1.rs: New test.(edition=2018)
	* rust/compile/issue-2650-2.rs: New test.(edition=2015)

Signed-off-by: M V V S Manoj Kumar <mvvsmanojkumar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants