Change 'BackendTypes::BasicBlock: Copy' to 'BackendTypes::BasicBlock: Clone', and carefully consider whether to require associative type impl Copy


pub trait BackendTypes {
    type BasicBlock: Copy;

Does this imply that BasicBlock must be a raw pointer? Whether the abuse of Copy requirements seriously affects the writing of pure Rust codegen backend?(For example, use Rc for memory management, Instead of a raw pointer from an external library)

There are many associative type with this restriction, and I recommend careful consideration of this design.

No, as you can see by the LLVM implementation using a reference:

It can also be an index into a list of basic blocks for the current function.

1 Like

yes, It is exactly what I call the raw pointer, Although it is written like a reference.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.