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

Add base for implementing extern types #2865

Merged
merged 3 commits into from Feb 29, 2024

Conversation

CohenArthur
Copy link
Member

@CohenArthur CohenArthur commented Feb 20, 2024

This PR adds the required HIR node and visitors for implementing extern types properly. The only step currently being performed is the lowering of AST extern types to their HIR counterpart.

  • Needs fixing of the commit format

gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-implitem.h: Declare external types as new
	types.
@CohenArthur CohenArthur marked this pull request as ready for review February 27, 2024 15:37
gcc/rust/ChangeLog:

	* hir/tree/rust-hir-item.h (class ExternalTypeItem): New class.
	* hir/tree/rust-hir.cc (ExternalTypeItem::as_string): Likewise.
	* backend/rust-compile-extern.h: Add base for handling HIR::ExternalTypeItem
	node.
	* checks/errors/borrowck/rust-bir-builder-struct.h: Likewise.
	* checks/errors/borrowck/rust-function-collector.h: Likewise.
	* checks/errors/rust-const-checker.cc (ConstChecker::visit): Likewise.
	* checks/errors/rust-const-checker.h: Likewise.
	* checks/errors/rust-unsafe-checker.cc (UnsafeChecker::visit): Likewise.
	* checks/errors/rust-unsafe-checker.h: Likewise.
	* hir/rust-ast-lower-extern.h: Likewise.
	* hir/rust-hir-dump.cc (Dump::visit): Likewise.
	* hir/rust-hir-dump.h: Likewise.
	* hir/tree/rust-hir-full-decls.h (class ExternalTypeItem): Likewise.
	* hir/tree/rust-hir-visitor.h: Likewise.
	(ExternalTypeItem::accept_vis): Likewise.
	* typecheck/rust-hir-type-check-implitem.cc (TypeCheckTopLevelExternItem::visit): Likewise.
	* typecheck/rust-hir-type-check-implitem.h: Likewise.
gcc/rust/ChangeLog:

	* hir/rust-ast-lower-extern.h: Lower to HIR::ExternalTypeItem nodes.
	* hir/tree/rust-hir-item.h (class ExternalTypeItem): Create private
	visibility by default as extern types have no visibility - add a comment
	about the correctness of this.
ExternalTypeItem (Analysis::NodeMapping mappings, Identifier item_name,
location_t locus)
: ExternalItem (std::move (mappings), std::move (item_name),
Visibility (Visibility::PRIVATE),
Copy link
Member

Choose a reason for hiding this comment

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

Extern types may accept pub visibility modifiers.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'll take care of this in a later PR, I think it'll be easier

@CohenArthur CohenArthur added this pull request to the merge queue Feb 29, 2024
Merged via the queue into Rust-GCC:master with commit 9ee5b51 Feb 29, 2024
9 checks passed
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.

None yet

2 participants