Skip to content

gccrs: Resolve lang item types - #4803

Merged
philberty merged 1 commit into
Rust-GCC:masterfrom
powerboat9:ty-resolve
Aug 20, 2026
Merged

gccrs: Resolve lang item types#4803
philberty merged 1 commit into
Rust-GCC:masterfrom
powerboat9:ty-resolve

Conversation

@powerboat9

Copy link
Copy Markdown
Collaborator

Lang items might not already be resolved when an expression depending on them is resolved.

@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, can you add a testcase for it? also leaving it to @philberty for review

Lang items might not already be resolved when an expression depending on
them is resolved.

The new test is a copy of for-loop1.rs in the same directory, but the
main function item is moved towards the top of the file. It still
produces a compiler error after type checking, but that can be resolved
in another patch.

gcc/rust/ChangeLog:

	* typecheck/rust-hir-type-check-expr.cc
	(TypeCheckExpr::visit (BoxExpr)): Attempt to resolve lang item,
	instead of just looking it up.
	(TypeCheckExpr::visit (RangeFromToExpr)): Likewise.
	(TypeCheckExpr::visit (RangeFromExpr)): Likewise.
	(TypeCheckExpr::visit (RangeToExpr)): Likewise.
	(TypeCheckExpr::visit (RangeFullExpr)): Likewise.

gcc/testsuite/ChangeLog:

	* rust/compile/for-loop3.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
@powerboat9

Copy link
Copy Markdown
Collaborator Author

Added test case

@philberty philberty 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 thats the correct fix

@philberty

Copy link
Copy Markdown
Member

good catch with that testcase it ices making an issue for myself for it

@philberty
philberty enabled auto-merge August 20, 2026 13:52
@philberty
philberty added this pull request to the merge queue Aug 20, 2026
Merged via the queue into Rust-GCC:master with commit e56b411 Aug 20, 2026
13 checks passed
@powerboat9
powerboat9 deleted the ty-resolve branch August 20, 2026 22:43
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