Skip to content

feat: allow deriving Trace without Drop/Finalize#116

Open
CertainLach wants to merge 3 commits intoManishearth:masterfrom
CertainLach:trivially-drop
Open

feat: allow deriving Trace without Drop/Finalize#116
CertainLach wants to merge 3 commits intoManishearth:masterfrom
CertainLach:trivially-drop

Conversation

@CertainLach
Copy link
Copy Markdown
Contributor

To allow structs with generated Trace impl to be destructured

Custom Drop implementation still can't be written, because generated
TriviallyDrop implementation tries to destruct value, which is only
possible when there is no user defined Drop impl

Empty Finalize impl generated too, because it will never be called

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
@Manishearth
Copy link
Copy Markdown
Owner

cc @kneecaw

Comment thread gc/src/trace.rs Outdated
@Manishearth
Copy link
Copy Markdown
Owner

cc @mystor

Comment thread gc_derive/src/lib.rs Outdated
Comment thread gc_derive/src/lib.rs Outdated
Comment thread gc_derive/src/lib.rs Outdated
Comment thread gc_derive/src/lib.rs Outdated
Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
@CertainLach
Copy link
Copy Markdown
Contributor Author

Didn't meant to bother you with broken code, accidentally pushed, and then was busy, sorry.

CertainLach added a commit to CertainLach/jrsonnet that referenced this pull request Jun 5, 2021
Some manual Trace/Finalize implementations can be replaced with derives
with Manishearth/rust-gc#116 getting merged

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
CertainLach added a commit to CertainLach/jrsonnet that referenced this pull request Jun 5, 2021
Some manual Trace/Finalize implementations can be replaced with derives
with Manishearth/rust-gc#116 getting merged

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
Copy link
Copy Markdown
Owner

@Manishearth Manishearth left a comment

Choose a reason for hiding this comment

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

Sorry about the delay! This looks good, happy to merge it in but would like some additional comments.

Ideally, it would be nice if this could be documented somewhere too.

Comment thread gc_derive/src/lib.rs
#drop_impl
}
} else {
s.bind_with(|_| BindStyle::Move);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Can we add some comments here as to why this branch is safe?

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.

3 participants