Is it possible to auto implement traits in a custom rustup target?

I am exploring targetting SWF/AS3 bytecode from Rust by creating a rustup target. I have in mind that every struct will output an ActionScript class, therefore everything should be expected to be garbage-collected.

Here is the ActionScript 3 bytecode overview.

If I want to support the following features, which path do I have to take?

CloneRef

I would have to support a trait CloneRef to support cloning a type by reference.

air_inherit

I doubt it is possible to use HIR or MIR to implement the following air_inherit attribute:

#[air_inherit(Control)]
struct Button;

Where air_inherit will implement Deref<Control>, AsRef<Control> and AsRef<DisplayObject>. I want to implement AsRef for every ascending type.

Pretty sure this is a "no, you're working at the wrong level or wanting to create a different language", but whether I'm right or wrong, this is a topic better suited for IRLO.

If you cross-post it, drop a note here.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.