Skip to content

Various tokenstream fixes#2128

Merged
CohenArthur merged 5 commits into
Rust-GCC:masterfrom
P-E-P:tokenstream-fixes
Apr 17, 2023
Merged

Various tokenstream fixes#2128
CohenArthur merged 5 commits into
Rust-GCC:masterfrom
P-E-P:tokenstream-fixes

Conversation

@P-E-P

@P-E-P P-E-P commented Apr 17, 2023

Copy link
Copy Markdown
Member

Upon looking at #2122 I discovered a bug in QualifiedPathInTypes, the scope resolution token was wrong, a colon was used instead. Whilst investigating the bug I found a few more.

  • Fix a case were outer attributes were incorrectly set as inner attributes
  • Fix the lifetime token string representation to use a single quote alone
  • Fix the output of a function's body when there is no return type.
  • Fix missing path in function call tokenstream output
  • Fix the original bug around scope resolution token output

P-E-P added 5 commits April 17, 2023 16:00
Lifetime string representation used two single quotes instead of one.

gcc/rust/ChangeLog:

	* lex/rust-token.cc (Token::as_string): Fix lifetime string
	representation.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
In some cases, while parsing an outer attribute, the parser would return
an inner attribute.

gcc/rust/ChangeLog:

	* parse/rust-parse-impl.h (Parser::parse_outer_attribute): Fix
	attribute status.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Function body were skipped in tokenstream when no return type was
provided.

gcc/rust/ChangeLog:

	* ast/rust-ast-tokenstream.cc (TokenStream::visit_function_common):
	Fix function body output.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
The associated type was not kept in the tokenstream.

gcc/rust/ChangeLog:

	* ast/rust-ast-tokenstream.cc (TokenStream::visit): Keep
	associated type.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Qualified types had a simple colon output instead of full scope
resolution tokens in QualifiedPathInTypes.

gcc/rust/ChangeLog:

	* ast/rust-ast-tokenstream.cc (TokenStream::visit): Fix scope
	resolution token output.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

@CohenArthur CohenArthur left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@CohenArthur CohenArthur enabled auto-merge April 17, 2023 16:38
@CohenArthur CohenArthur added this pull request to the merge queue Apr 17, 2023
Merged via the queue into Rust-GCC:master with commit b2c44f0 Apr 17, 2023
@P-E-P P-E-P deleted the tokenstream-fixes branch November 21, 2023 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants