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 derive(Debug) stub #3398

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

CohenArthur
Copy link
Member

@CohenArthur CohenArthur commented Jan 29, 2025

Adds a fake implementation of derive(Debug) which generates a stub impl block

@CohenArthur
Copy link
Member Author

Putting it as a draft since some cleanup is needed

gcc/rust/ChangeLog:

	* ast/rust-ast-builder.cc (Builder::type_path): New functions.
	* ast/rust-ast-builder.h: Declare them.
gcc/rust/ChangeLog:

	* ast/rust-ast-builder.cc: New methods.
	* ast/rust-ast-builder.h: Declare them.
gcc/rust/ChangeLog:

	* expand/rust-derive.cc (DeriveVisitor::setup_impl_generics): New method.
	* expand/rust-derive.h: Declare it, define DeriveVisitor::ImplGenerics struct.
gcc/rust/ChangeLog:

	* expand/rust-derive-clone.cc: Cleanup using DeriveVisitor::setup_impl_generics.
	* expand/rust-derive-copy.cc: Likewise.
gcc/rust/ChangeLog:

	* expand/rust-derive-debug.cc: New file.
	* expand/rust-derive-debug.h: New file.
	* Make-lang.in: Compile them.
	* expand/rust-derive.cc (DeriveVisitor::derive): Call into DeriveDebug.

gcc/testsuite/ChangeLog:

	* rust/compile/derive-debug1.rs: New test.
	* rust/compile/nr2/exclude: Exclude it.
@CohenArthur CohenArthur marked this pull request as ready for review January 30, 2025 12:12
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.

1 participant