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?


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


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

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.