Skip to content

Add base for implementing extern types#2865

Merged
CohenArthur merged 3 commits into
Rust-GCC:masterfrom
CohenArthur:extern-types-handling
Feb 29, 2024
Merged

Add base for implementing extern types#2865
CohenArthur merged 3 commits into
Rust-GCC:masterfrom
CohenArthur:extern-types-handling

Conversation

@CohenArthur

@CohenArthur CohenArthur commented Feb 20, 2024

Copy link
Copy Markdown
Member

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

@CohenArthur CohenArthur force-pushed the extern-types-handling branch from c3fa889 to 32f7c26 Compare February 20, 2024 15:24
gcc/rust/ChangeLog:

	* resolve/rust-ast-resolve-implitem.h: Declare external types as new
	types.
@CohenArthur CohenArthur force-pushed the extern-types-handling branch from 32f7c26 to 0b5d678 Compare February 27, 2024 15:37
@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
Copy Markdown
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
Copy Markdown
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
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.

2 participants