Skip to content

Drop impls for DOM types should be forbidden #26488

@jdm

Description

@jdm

@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.

Metadata

Metadata

Assignees

Labels

A-content/bindingsThe DOM bindingsA-content/scriptRelated to the script threadE-more-complexVariable effort required; may require a mentor. Recommended solution is clearly described in the issI-safetySome piece of code violates memory safety guarantees.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions