servo: Drop impls for DOM types should be forbidden

@pcwalton @Manishearth @asajeffrey I recall discussing this topic in Berlin, but I can’t find the notes I thought I took. Attempting to reconstruct from memory:

  • there exist DOM objects that have Drop impls for various reasons
  • there was agreement that it should be possible to run some code in response to a GC finalizer (eg. webgl objects need to be able to unreference their graphics resources)
  • the easiest way to ban Drop impls is to make the #[dom_struct] macro also add an empty Drop impl, which will conflict with any manual implementation
  • for any code which does require a valid Drop, we can create inner structs that only hold the data required for that implementation and nothing more

Does this make sense? My memory is haziest when it comes to the last point.

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 33 (24 by maintainers)

Commits related to this issue

Most upvoted comments

@willypuzzle https://github.com/servo/servo/issues/26488#issuecomment-640237906 describes the work that needs to happen right now. One PR per interface where the existing Drop implementation is refined and minimized would be best to work on his incrementally.

Please assign me the issue then.

Done.

Anyway, I tried but two branch are too different the #28302 is about 6500 commits behind main. Too many conflicts, I can try to copy the modifications by hand in the new branch having as root main.

In that time we moved from compiler plugins to crown so yeah, it does make sense to start on more fresh base, but use PR as reference.

@jdm May I try this issue? This is the first time to contribute to Servo for me.